cb06f24
diff -up cups-1.4b1/backend/ipp.c.eggcups cups-1.4b1/backend/ipp.c
cb06f24
--- cups-1.4b1/backend/ipp.c.eggcups	2008-10-15 19:27:45.000000000 +0100
cb06f24
+++ cups-1.4b1/backend/ipp.c	2008-11-11 15:43:30.000000000 +0000
cb06f24
@@ -51,6 +51,70 @@ static char	pstmpname[1024] = "";	/* Tem
4f25cbd
 static char	tmpfilename[1024] = "";	/* Temporary spool file name */
4f25cbd
 static int	job_cancelled = 0;	/* Job cancelled? */
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...
cb06f24
@@ -1058,6 +1122,15 @@ main(int  argc,				/* I - Number of comm
86be035
                       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
+
bd63485
     ippDelete(response);
bd63485
 
bd63485
     if (job_cancelled)
cb06f24
diff -up cups-1.4b1/backend/Makefile.eggcups cups-1.4b1/backend/Makefile
cb06f24
--- cups-1.4b1/backend/Makefile.eggcups	2008-10-06 22:08:27.000000000 +0100
cb06f24
+++ cups-1.4b1/backend/Makefile	2008-11-11 15:45:31.000000000 +0000
cb06f24
@@ -188,7 +188,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)
cb06f24
+	$(CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS) $(CUPSDLIBS)
bd63485
 	$(RM) http
bd63485
 	$(LN) ipp http
bd63485
 
cb06f24
diff -up cups-1.4b1/scheduler/subscriptions.c.eggcups cups-1.4b1/scheduler/subscriptions.c
cb06f24
--- cups-1.4b1/scheduler/subscriptions.c.eggcups	2008-08-01 22:11:55.000000000 +0100
cb06f24
+++ cups-1.4b1/scheduler/subscriptions.c	2008-11-11 15:43:30.000000000 +0000
cb06f24
@@ -1302,13 +1302,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
 
cb06f24
@@ -1344,7 +1344,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);