Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions cups/dest.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ typedef struct _cups_dnssd_data_s // Enumeration data
cups_array_t *devices; // Devices found so far
int num_dests; // Number of lpoptions destinations
cups_dest_t *dests; // lpoptions destinations
int num_local; // Number of local cupsd queues
cups_dest_t *local_dests; // Local cupsd queues
char def_name[1024], // Default printer name, if any
*def_instance; // Default printer instance, if any
} _cups_dnssd_data_t;
Expand Down Expand Up @@ -2845,6 +2847,26 @@ cups_dest_query_cb(
if (!have_pdf && !have_raster)
device->state = _CUPS_DNSSD_INCOMPATIBLE;
}
else if (!_cups_strcasecmp(key, "rp"))
{
// Suppress local printer being re-discovered via DNS-SD
const char *rp_name = value;
int i;

if (!_cups_strncasecmp(rp_name, "printers/", 9))
rp_name += 9;

for (i = 0; i < data->num_local; i++)
{
if (!_cups_strcasecmp(rp_name, data->local_dests[i].name))
{
device->state = _CUPS_DNSSD_INCOMPATIBLE;
DEBUG_printf("6cups_dest_query_cb: "
"Suppressing local printer '%s'.", rp_name);
break;
}
}
}
else if (!_cups_strcasecmp(key, "printer-type"))
{
// Value is either NNNN or 0xXXXX
Expand Down Expand Up @@ -3177,6 +3199,8 @@ cups_enum_dests(
{
// Get the list of local printers and pass them to the callback function...
num_dests = _cupsGetDests(http, IPP_OP_CUPS_GET_PRINTERS, NULL, &dests, data.type, data.mask);
data.num_local = num_dests;
data.local_dests = dests;

if (data.def_name[0])
{
Expand Down
Loading