[gtk+] printing: Show Avahi printers on IPv6 network



commit 36d2324891d330d54156558e1405c9a0d7426157
Author: Marek Kasik <mkasik redhat com>
Date:   Tue Mar 12 16:26:37 2013 +0100

    printing: Show Avahi printers on IPv6 network
    
    Create correct URIs for printers on IPv6 networks.

 modules/printbackends/cups/gtkprintbackendcups.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/modules/printbackends/cups/gtkprintbackendcups.c 
b/modules/printbackends/cups/gtkprintbackendcups.c
index 4d095de..60faad0 100644
--- a/modules/printbackends/cups/gtkprintbackendcups.c
+++ b/modules/printbackends/cups/gtkprintbackendcups.c
@@ -2533,6 +2533,7 @@ avahi_resolver_found_cb (GaServiceResolver  *resolver,
 {
   GtkPrintBackendCups *backend = GTK_PRINT_BACKEND_CUPS (user_data);
   AvahiStringList     *item;
+  const gchar         *protocol_string;
   gchar                host[AVAHI_ADDRESS_STR_MAX];
   gchar               *suffix = NULL;
   gchar               *printer_uri;
@@ -2546,9 +2547,14 @@ avahi_resolver_found_cb (GaServiceResolver  *resolver,
   if (suffix)
     {
       if (g_strcmp0 (type, "_ipp._tcp") == 0)
-        printer_uri = g_strdup_printf ("ipp://%s:%u/%s", host, port, suffix);
+        protocol_string = "ipp";
       else
-        printer_uri = g_strdup_printf ("ipps://%s:%u/%s", host, port, suffix);
+        protocol_string = "ipps";
+
+      if (protocol == GA_PROTOCOL_INET6)
+        printer_uri = g_strdup_printf ("%s://[%s]:%u/%s", protocol_string, host, port, suffix);
+      else
+        printer_uri = g_strdup_printf ("%s://%s:%u/%s", protocol_string, host, port, suffix);
 
       cups_request_avahi_printer_info (printer_uri,
                                        host,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]