[gnome-settings-daemon] print-notifications: Don't use DBus recipient URI for remote servers



commit 2c7af2055e36b816c24b39831477d55570b50e11
Author: Marek Kasik <mkasik redhat com>
Date:   Tue Jul 23 15:11:39 2013 +0200

    print-notifications: Don't use DBus recipient URI for remote servers
    
    Using DBus for notify-recipient-uri is useless for remote servers.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=678623

 .../gsd-print-notifications-manager.c              |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/plugins/print-notifications/gsd-print-notifications-manager.c 
b/plugins/print-notifications/gsd-print-notifications-manager.c
index 223853c..86bec39 100644
--- a/plugins/print-notifications/gsd-print-notifications-manager.c
+++ b/plugins/print-notifications/gsd-print-notifications-manager.c
@@ -146,6 +146,20 @@ is_local_dest (const char  *name,
         return !is_remote;
 }
 
+static gboolean
+server_is_local (const gchar *server_name)
+{
+        if (server_name != NULL &&
+            (g_ascii_strncasecmp (server_name, "localhost", 9) == 0 ||
+             g_ascii_strncasecmp (server_name, "127.0.0.1", 9) == 0 ||
+             g_ascii_strncasecmp (server_name, "::1", 3) == 0 ||
+             server_name[0] == '/')) {
+                return TRUE;
+        } else {
+                return FALSE;
+        }
+}
+
 static int
 strcmp0(const void *a, const void *b)
 {
@@ -905,8 +919,10 @@ renew_subscription (gpointer data)
                                        "notify-events", num_events, NULL, events);
                         ippAddString (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_KEYWORD,
                                       "notify-pull-method", NULL, "ippget");
-                        ippAddString (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_URI,
-                                      "notify-recipient-uri", NULL, "dbus://");
+                        if (server_is_local (cupsServer ())) {
+                                ippAddString (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_URI,
+                                              "notify-recipient-uri", NULL, "dbus://");
+                        }
                         ippAddInteger (request, IPP_TAG_SUBSCRIPTION, IPP_TAG_INTEGER,
                                        "notify-lease-duration", SUBSCRIPTION_DURATION);
                         response = cupsDoRequest (http, request, "/");


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