fecfdf6
diff -up cups-1.5.3/backend/ipp.c.eggcups cups-1.5.3/backend/ipp.c
fecfdf6
--- cups-1.5.3/backend/ipp.c.eggcups	2012-05-05 01:00:01.000000000 +0200
fecfdf6
+++ cups-1.5.3/backend/ipp.c	2012-05-15 16:50:41.142868986 +0200
fecfdf6
@@ -138,6 +138,70 @@ static cups_array_t	*state_reasons;	/* A
4743e10
 static char		tmpfilename[1024] = "";
4743e10
 					/* Temporary spool file name */
bd63485
 
bd63485
+#if HAVE_DBUS
bd63485
+#include <dbus/dbus.h>
bd63485
+
bd63485
+static DBusConnection *dbus_connection = NULL;
bd63485
+
bd63485
+static int
bd63485
+init_dbus (void)
bd63485
+{
bd63485
+  DBusConnection *connection;
bd63485
+  DBusError error;
bd63485
+
bd63485
+  if (dbus_connection &&
bd63485
+      !dbus_connection_get_is_connected (dbus_connection)) {
bd63485
+    dbus_connection_unref (dbus_connection);
bd63485
+    dbus_connection = NULL;
bd63485
+  }
bd63485
+  
bd63485
+  dbus_error_init (&error);
bd63485
+  connection = dbus_bus_get (getuid () ? DBUS_BUS_SESSION : DBUS_BUS_SYSTEM, &error);
bd63485
+  if (connection == NULL) {
bd63485
+    dbus_error_free (&error);
bd63485
+    return -1;
bd63485
+  }
bd63485
+
bd63485
+  dbus_connection = connection;
bd63485
+  return 0;
bd63485
+}
bd63485
+
bd63485
+int
bd63485
+dbus_broadcast_queued_remote (const char *printer_uri,
bd63485
+			      ipp_status_t status,
bd63485
+			      unsigned int local_job_id,
bd63485
+			      unsigned int remote_job_id,
bd63485
+			      const char *username,
bd63485
+			      const char *printer_name)
bd63485
+{
bd63485
+  DBusMessage *message;
bd63485
+  DBusMessageIter iter;
bd63485
+  const char *errstr;
bd63485
+
bd63485
+  if (!dbus_connection || !dbus_connection_get_is_connected (dbus_connection)) {
bd63485
+    if (init_dbus () || !dbus_connection)
bd63485
+      return -1;
bd63485
+  }
bd63485
+
bd63485
+  errstr = ippErrorString (status);
bd63485
+  message = dbus_message_new_signal ("/com/redhat/PrinterSpooler",
bd63485
+				     "com.redhat.PrinterSpooler",
bd63485
+				     "JobQueuedRemote");
bd63485
+  dbus_message_iter_init_append (message, &iter);
bd63485
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &printer_uri);
bd63485
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &errstr);
bd63485
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_UINT32, &local_job_id);
bd63485
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_UINT32, &remote_job_id);
bd63485
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &username);
bd63485
+  dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &printer_name);
bd63485
+
bd63485
+  dbus_connection_send (dbus_connection, message, NULL);
bd63485
+  dbus_connection_flush (dbus_connection);
bd63485
+  dbus_message_unref (message);
bd63485
+  
bd63485
+  return 0;
bd63485
+}
bd63485
+#endif /* HAVE_DBUS */
bd63485
 
bd63485
 /*
4f25cbd
  * Local functions...
fecfdf6
@@ -1520,6 +1584,15 @@ main(int  argc,				/* I - Number of comm
4743e10
                            _("Print file accepted - job ID %d."), job_id);
bd63485
     }
bd63485
 
bd63485
+#if HAVE_DBUS
bd63485
+    dbus_broadcast_queued_remote (argv[0],
bd63485
+				  ipp_status,
bd63485
+				  atoi (argv[1]),
bd63485
+				  job_id,
bd63485
+				  argv[2],
bd63485
+				  getenv ("PRINTER"));
bd63485
+#endif /* HAVE_DBUS */
bd63485
+
fecfdf6
     fprintf(stderr, "DEBUG: job-id=%d\n", job_id);
bd63485
     ippDelete(response);
bd63485
 
fecfdf6
diff -up cups-1.5.3/backend/Makefile.eggcups cups-1.5.3/backend/Makefile
fecfdf6
--- cups-1.5.3/backend/Makefile.eggcups	2012-04-23 19:42:12.000000000 +0200
fecfdf6
+++ cups-1.5.3/backend/Makefile	2012-05-15 16:48:17.253871982 +0200
4743e10
@@ -212,7 +212,7 @@ dnssd:	dnssd.o ../cups/$(LIBCUPS) libbac
bd63485
 
cb06f24
 ipp:	ipp.o ../cups/$(LIBCUPS) libbackend.a
bd63485
 	echo Linking $@...
cb06f24
-	$(CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS)
5bd20b0
+	$(CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS) $(SERVERLIBS)
bd63485
 	$(RM) http
bd63485
 	$(LN) ipp http
bd63485
 
fecfdf6
diff -up cups-1.5.3/scheduler/subscriptions.c.eggcups cups-1.5.3/scheduler/subscriptions.c
fecfdf6
--- cups-1.5.3/scheduler/subscriptions.c.eggcups	2012-02-12 06:48:09.000000000 +0100
fecfdf6
+++ cups-1.5.3/scheduler/subscriptions.c	2012-05-15 16:48:17.253871982 +0200
fecfdf6
@@ -1314,13 +1314,13 @@ cupsd_send_dbus(cupsd_eventmask_t event,
eb99a8d
     what = "PrinterAdded";
eb99a8d
   else if (event & CUPSD_EVENT_PRINTER_DELETED)
eb99a8d
     what = "PrinterRemoved";
eb99a8d
-  else if (event & CUPSD_EVENT_PRINTER_CHANGED)
eb99a8d
-    what = "QueueChanged";
eb99a8d
   else if (event & CUPSD_EVENT_JOB_CREATED)
eb99a8d
     what = "JobQueuedLocal";
eb99a8d
   else if ((event & CUPSD_EVENT_JOB_STATE) && job &&
eb99a8d
            job->state_value == IPP_JOB_PROCESSING)
eb99a8d
     what = "JobStartedLocal";
eb99a8d
+  else if (event & (CUPSD_EVENT_PRINTER_CHANGED|CUPSD_EVENT_JOB_STATE_CHANGED|CUPSD_EVENT_PRINTER_STATE_CHANGED))
eb99a8d
+    what = "QueueChanged";
eb99a8d
   else
eb99a8d
     return;
eb99a8d
 
fecfdf6
@@ -1356,7 +1356,7 @@ cupsd_send_dbus(cupsd_eventmask_t event,
eb99a8d
   dbus_message_append_iter_init(message, &iter);
eb99a8d
   if (dest)
eb99a8d
     dbus_message_iter_append_string(&iter, dest->name);
eb99a8d
-  if (job)
eb99a8d
+  if (job && strcmp (what, "QueueChanged") != 0)
eb99a8d
   {
eb99a8d
     dbus_message_iter_append_uint32(&iter, job->id);
eb99a8d
     dbus_message_iter_append_string(&iter, job->username);