2c90aa
diff -up cups-2.2.10/backend/ipp.c.eggcups cups-2.2.10/backend/ipp.c
2c90aa
--- cups-2.2.10/backend/ipp.c.eggcups	2018-12-07 20:41:56.000000000 +0100
2c90aa
+++ cups-2.2.10/backend/ipp.c	2018-12-14 14:17:25.594421897 +0100
2c90aa
@@ -152,6 +152,70 @@ static char		tmpfilename[1024] = "";
8d1f53
 static char		mandatory_attrs[1024] = "";
8d1f53
 					/* cupsMandatory value */
bd6348
 
bd6348
+#if HAVE_DBUS
bd6348
+#include <dbus dbus.h="">
bd6348
+
bd6348
+static DBusConnection *dbus_connection = NULL;
bd6348
+
bd6348
+static int
bd6348
+init_dbus (void)
bd6348
+{
bd6348
+  DBusConnection *connection;
bd6348
+  DBusError error;
bd6348
+
bd6348
+  if (dbus_connection &&
bd6348
+      !dbus_connection_get_is_connected (dbus_connection)) {
bd6348
+    dbus_connection_unref (dbus_connection);
bd6348
+    dbus_connection = NULL;
bd6348
+  }
8d1f53
+
bd6348
+  dbus_error_init (&error);
bd6348
+  connection = dbus_bus_get (getuid () ? DBUS_BUS_SESSION : DBUS_BUS_SYSTEM, &error);
bd6348
+  if (connection == NULL) {
bd6348
+    dbus_error_free (&error);
bd6348
+    return -1;
bd6348
+  }
bd6348
+
bd6348
+  dbus_connection = connection;
bd6348
+  return 0;
bd6348
+}
bd6348
+
bd6348
+int
bd6348
+dbus_broadcast_queued_remote (const char *printer_uri,
bd6348
+			      ipp_status_t status,
bd6348
+			      unsigned int local_job_id,
bd6348
+			      unsigned int remote_job_id,
bd6348
+			      const char *username,
bd6348
+			      const char *printer_name)
bd6348
+{
bd6348
+  DBusMessage *message;
bd6348
+  DBusMessageIter iter;
bd6348
+  const char *errstr;
bd6348
+
bd6348
+  if (!dbus_connection || !dbus_connection_get_is_connected (dbus_connection)) {
bd6348
+    if (init_dbus () || !dbus_connection)
bd6348
+      return -1;
bd6348
+  }
bd6348
+
bd6348
+  errstr = ippErrorString (status);
bd6348
+  message = dbus_message_new_signal ("/com/redhat/PrinterSpooler",
bd6348
+				     "com.redhat.PrinterSpooler",
bd6348
+				     "JobQueuedRemote");
bd6348
+  dbus_message_iter_init_append (message, &iter);
bd6348
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &printer_uri);
bd6348
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &errstr);
bd6348
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_UINT32, &local_job_id);
bd6348
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_UINT32, &remote_job_id);
bd6348
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &username);
bd6348
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &printer_name);
bd6348
+
bd6348
+  dbus_connection_send (dbus_connection, message, NULL);
bd6348
+  dbus_connection_flush (dbus_connection);
bd6348
+  dbus_message_unref (message);
8d1f53
+
bd6348
+  return 0;
bd6348
+}
bd6348
+#endif /* HAVE_DBUS */
bd6348
 
bd6348
 /*
4f25cb
  * Local functions...
2c90aa
@@ -1753,6 +1817,15 @@ main(int  argc,				/* I - Number of comm
5b01eb
       fprintf(stderr, "DEBUG: Print job accepted - job ID %d.\n", job_id);
bd6348
     }
bd6348
 
bd6348
+#if HAVE_DBUS
bd6348
+    dbus_broadcast_queued_remote (argv[0],
bd6348
+				  ipp_status,
bd6348
+				  atoi (argv[1]),
bd6348
+				  job_id,
bd6348
+				  argv[2],
bd6348
+				  getenv ("PRINTER"));
bd6348
+#endif /* HAVE_DBUS */
bd6348
+
bd6348
     ippDelete(response);
bd6348
 
5b01eb
     if (job_canceled)
2c90aa
diff -up cups-2.2.10/backend/Makefile.eggcups cups-2.2.10/backend/Makefile
2c90aa
--- cups-2.2.10/backend/Makefile.eggcups	2018-12-14 14:17:25.595421889 +0100
2c90aa
+++ cups-2.2.10/backend/Makefile	2018-12-14 14:18:52.465712525 +0100
2c90aa
@@ -263,7 +263,7 @@ dnssd:	dnssd.o ../cups/$(LIBCUPS) libbac
bd6348
 
cb06f2
 ipp:	ipp.o ../cups/$(LIBCUPS) libbackend.a
bd6348
 	echo Linking $@...
cd3910
-	$(LD_CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS)
cd3910
+	$(LD_CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS) $(SERVERLIBS)
2c90aa
 	$(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
bd6348
 	$(RM) http
bd6348
 	$(LN) ipp http
2c90aa
diff -up cups-2.2.10/scheduler/subscriptions.c.eggcups cups-2.2.10/scheduler/subscriptions.c
2c90aa
--- cups-2.2.10/scheduler/subscriptions.c.eggcups	2018-12-07 20:41:56.000000000 +0100
2c90aa
+++ cups-2.2.10/scheduler/subscriptions.c	2018-12-14 14:17:25.595421889 +0100
cd3910
@@ -1291,13 +1291,13 @@ cupsd_send_dbus(cupsd_eventmask_t event,
eb99a8
     what = "PrinterAdded";
eb99a8
   else if (event & CUPSD_EVENT_PRINTER_DELETED)
eb99a8
     what = "PrinterRemoved";
eb99a8
-  else if (event & CUPSD_EVENT_PRINTER_CHANGED)
eb99a8
-    what = "QueueChanged";
eb99a8
   else if (event & CUPSD_EVENT_JOB_CREATED)
eb99a8
     what = "JobQueuedLocal";
eb99a8
   else if ((event & CUPSD_EVENT_JOB_STATE) && job &&
eb99a8
            job->state_value == IPP_JOB_PROCESSING)
eb99a8
     what = "JobStartedLocal";
eb99a8
+  else if (event & (CUPSD_EVENT_PRINTER_CHANGED|CUPSD_EVENT_JOB_STATE_CHANGED|CUPSD_EVENT_PRINTER_STATE_CHANGED))
eb99a8
+    what = "QueueChanged";
eb99a8
   else
eb99a8
     return;
eb99a8
 
cd3910
@@ -1333,7 +1333,7 @@ cupsd_send_dbus(cupsd_eventmask_t event,
eb99a8
   dbus_message_append_iter_init(message, &iter);
eb99a8
   if (dest)
eb99a8
     dbus_message_iter_append_string(&iter, dest->name);
eb99a8
-  if (job)
eb99a8
+  if (job && strcmp (what, "QueueChanged") != 0)
eb99a8
   {
eb99a8
     dbus_message_iter_append_uint32(&iter, job->id);
eb99a8
     dbus_message_iter_append_string(&iter, job->username);