ce62dc
diff -up cups-2.2.5/backend/ipp.c.eggcups cups-2.2.5/backend/ipp.c
ce62dc
--- cups-2.2.5/backend/ipp.c.eggcups	2017-10-13 20:22:26.000000000 +0200
ce62dc
+++ cups-2.2.5/backend/ipp.c	2017-10-17 18:56:42.409024451 +0200
ce62dc
@@ -149,6 +149,70 @@ static char		tmpfilename[1024] = "";
ce62dc
 static char		mandatory_attrs[1024] = "";
ce62dc
 					/* cupsMandatory value */
ce62dc
 
ce62dc
+#if HAVE_DBUS
ce62dc
+#include <dbus/dbus.h>
ce62dc
+
ce62dc
+static DBusConnection *dbus_connection = NULL;
ce62dc
+
ce62dc
+static int
ce62dc
+init_dbus (void)
ce62dc
+{
ce62dc
+  DBusConnection *connection;
ce62dc
+  DBusError error;
ce62dc
+
ce62dc
+  if (dbus_connection &&
ce62dc
+      !dbus_connection_get_is_connected (dbus_connection)) {
ce62dc
+    dbus_connection_unref (dbus_connection);
ce62dc
+    dbus_connection = NULL;
ce62dc
+  }
ce62dc
+
ce62dc
+  dbus_error_init (&error);
ce62dc
+  connection = dbus_bus_get (getuid () ? DBUS_BUS_SESSION : DBUS_BUS_SYSTEM, &error);
ce62dc
+  if (connection == NULL) {
ce62dc
+    dbus_error_free (&error);
ce62dc
+    return -1;
ce62dc
+  }
ce62dc
+
ce62dc
+  dbus_connection = connection;
ce62dc
+  return 0;
ce62dc
+}
ce62dc
+
ce62dc
+int
ce62dc
+dbus_broadcast_queued_remote (const char *printer_uri,
ce62dc
+			      ipp_status_t status,
ce62dc
+			      unsigned int local_job_id,
ce62dc
+			      unsigned int remote_job_id,
ce62dc
+			      const char *username,
ce62dc
+			      const char *printer_name)
ce62dc
+{
ce62dc
+  DBusMessage *message;
ce62dc
+  DBusMessageIter iter;
ce62dc
+  const char *errstr;
ce62dc
+
ce62dc
+  if (!dbus_connection || !dbus_connection_get_is_connected (dbus_connection)) {
ce62dc
+    if (init_dbus () || !dbus_connection)
ce62dc
+      return -1;
ce62dc
+  }
ce62dc
+
ce62dc
+  errstr = ippErrorString (status);
ce62dc
+  message = dbus_message_new_signal ("/com/redhat/PrinterSpooler",
ce62dc
+				     "com.redhat.PrinterSpooler",
ce62dc
+				     "JobQueuedRemote");
ce62dc
+  dbus_message_iter_init_append (message, &iter);
ce62dc
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &printer_uri);
ce62dc
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &errstr);
ce62dc
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_UINT32, &local_job_id);
ce62dc
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_UINT32, &remote_job_id);
ce62dc
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &username);
ce62dc
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &printer_name);
ce62dc
+
ce62dc
+  dbus_connection_send (dbus_connection, message, NULL);
ce62dc
+  dbus_connection_flush (dbus_connection);
ce62dc
+  dbus_message_unref (message);
ce62dc
+
ce62dc
+  return 0;
ce62dc
+}
ce62dc
+#endif /* HAVE_DBUS */
ce62dc
 
ce62dc
 /*
ce62dc
  * Local functions...
ce62dc
@@ -1743,6 +1807,15 @@ main(int  argc,				/* I - Number of comm
ce62dc
       fprintf(stderr, "DEBUG: Print job accepted - job ID %d.\n", job_id);
ce62dc
     }
ce62dc
 
ce62dc
+#if HAVE_DBUS
ce62dc
+    dbus_broadcast_queued_remote (argv[0],
ce62dc
+				  ipp_status,
ce62dc
+				  atoi (argv[1]),
ce62dc
+				  job_id,
ce62dc
+				  argv[2],
ce62dc
+				  getenv ("PRINTER"));
ce62dc
+#endif /* HAVE_DBUS */
ce62dc
+
ce62dc
     ippDelete(response);
ce62dc
 
ce62dc
     if (job_canceled)
ce62dc
diff -up cups-2.2.5/backend/Makefile.eggcups cups-2.2.5/backend/Makefile
ce62dc
--- cups-2.2.5/backend/Makefile.eggcups	2017-10-17 18:56:42.409024451 +0200
ce62dc
+++ cups-2.2.5/backend/Makefile	2017-10-17 18:59:11.696781116 +0200
ce62dc
@@ -262,7 +262,7 @@ dnssd:	dnssd.o ../cups/$(LIBCUPS) libbac
ce62dc
 
ce62dc
 ipp:	ipp.o ../cups/$(LIBCUPS) libbackend.a
ce62dc
 	echo Linking $@...
ce62dc
-	$(LD_CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS)
ce62dc
+	$(LD_CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS) $(SERVERLIBS)
ce62dc
 	$(RM) http
ce62dc
 	$(LN) ipp http
ce62dc
 
ce62dc
diff -up cups-2.2.5/scheduler/subscriptions.c.eggcups cups-2.2.5/scheduler/subscriptions.c
ce62dc
--- cups-2.2.5/scheduler/subscriptions.c.eggcups	2017-10-13 20:22:26.000000000 +0200
ce62dc
+++ cups-2.2.5/scheduler/subscriptions.c	2017-10-17 18:56:42.409024451 +0200
ce62dc
@@ -1291,13 +1291,13 @@ cupsd_send_dbus(cupsd_eventmask_t event,
ce62dc
     what = "PrinterAdded";
ce62dc
   else if (event & CUPSD_EVENT_PRINTER_DELETED)
ce62dc
     what = "PrinterRemoved";
ce62dc
-  else if (event & CUPSD_EVENT_PRINTER_CHANGED)
ce62dc
-    what = "QueueChanged";
ce62dc
   else if (event & CUPSD_EVENT_JOB_CREATED)
ce62dc
     what = "JobQueuedLocal";
ce62dc
   else if ((event & CUPSD_EVENT_JOB_STATE) && job &&
ce62dc
            job->state_value == IPP_JOB_PROCESSING)
ce62dc
     what = "JobStartedLocal";
ce62dc
+  else if (event & (CUPSD_EVENT_PRINTER_CHANGED|CUPSD_EVENT_JOB_STATE_CHANGED|CUPSD_EVENT_PRINTER_STATE_CHANGED))
ce62dc
+    what = "QueueChanged";
ce62dc
   else
ce62dc
     return;
ce62dc
 
ce62dc
@@ -1333,7 +1333,7 @@ cupsd_send_dbus(cupsd_eventmask_t event,
ce62dc
   dbus_message_append_iter_init(message, &iter);
ce62dc
   if (dest)
ce62dc
     dbus_message_iter_append_string(&iter, dest->name);
ce62dc
-  if (job)
ce62dc
+  if (job && strcmp (what, "QueueChanged") != 0)
ce62dc
   {
ce62dc
     dbus_message_iter_append_uint32(&iter, job->id);
ce62dc
     dbus_message_iter_append_string(&iter, job->username);