[gnome-settings-daemon/gnome-3-8] print-notifications: Don't use DBus recipient URI for remote servers
- From: Marek Kašík <mkasik src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/gnome-3-8] print-notifications: Don't use DBus recipient URI for remote servers
- Date: Thu, 5 Sep 2013 08:58:42 +0000 (UTC)
commit feb7fa0007a573038cbce9d857ffee19b06b5d3f
Author: Marek Kasik <mkasik redhat com>
Date: Thu Sep 5 10:57:41 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]