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