summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMarek Kasik <mkasik@redhat.com>2013-09-05 10:57:41 +0200
committerMarek Kasik <mkasik@redhat.com>2013-09-05 10:57:41 +0200
commitfeb7fa0007a573038cbce9d857ffee19b06b5d3f (patch)
tree81a384d50f3da1d08183b75e4fe1546e95ee1d7d /plugins
parent61f3702b8cc138b79e6131f26d3079ab593ce581 (diff)
downloadgnome-settings-daemon-feb7fa0007a573038cbce9d857ffee19b06b5d3f.tar.gz
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
Diffstat (limited to 'plugins')
-rw-r--r--plugins/print-notifications/gsd-print-notifications-manager.c20
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 223853cb..86bec39a 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, "/");