2015-06-29 11:47:50 +00:00
|
|
|
diff -up cups-2.1b1/backend/ipp.c.eggcups cups-2.1b1/backend/ipp.c
|
|
|
|
--- cups-2.1b1/backend/ipp.c.eggcups 2015-05-28 03:19:14.000000000 +0200
|
|
|
|
+++ cups-2.1b1/backend/ipp.c 2015-06-29 12:56:54.872807227 +0200
|
|
|
|
@@ -149,6 +149,70 @@ static char tmpfilename[1024] = "";
|
|
|
|
static char mandatory_attrs[1024] = "";
|
|
|
|
/* cupsMandatory value */
|
2006-11-03 12:12:18 +00:00
|
|
|
|
|
|
|
+#if HAVE_DBUS
|
|
|
|
+#include <dbus/dbus.h>
|
|
|
|
+
|
|
|
|
+static DBusConnection *dbus_connection = NULL;
|
|
|
|
+
|
|
|
|
+static int
|
|
|
|
+init_dbus (void)
|
|
|
|
+{
|
|
|
|
+ DBusConnection *connection;
|
|
|
|
+ DBusError error;
|
|
|
|
+
|
|
|
|
+ if (dbus_connection &&
|
|
|
|
+ !dbus_connection_get_is_connected (dbus_connection)) {
|
|
|
|
+ dbus_connection_unref (dbus_connection);
|
|
|
|
+ dbus_connection = NULL;
|
|
|
|
+ }
|
2015-06-29 11:47:50 +00:00
|
|
|
+
|
2006-11-03 12:12:18 +00:00
|
|
|
+ dbus_error_init (&error);
|
|
|
|
+ connection = dbus_bus_get (getuid () ? DBUS_BUS_SESSION : DBUS_BUS_SYSTEM, &error);
|
|
|
|
+ if (connection == NULL) {
|
|
|
|
+ dbus_error_free (&error);
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dbus_connection = connection;
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+int
|
|
|
|
+dbus_broadcast_queued_remote (const char *printer_uri,
|
|
|
|
+ ipp_status_t status,
|
|
|
|
+ unsigned int local_job_id,
|
|
|
|
+ unsigned int remote_job_id,
|
|
|
|
+ const char *username,
|
|
|
|
+ const char *printer_name)
|
|
|
|
+{
|
|
|
|
+ DBusMessage *message;
|
|
|
|
+ DBusMessageIter iter;
|
|
|
|
+ const char *errstr;
|
|
|
|
+
|
|
|
|
+ if (!dbus_connection || !dbus_connection_get_is_connected (dbus_connection)) {
|
|
|
|
+ if (init_dbus () || !dbus_connection)
|
|
|
|
+ return -1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ errstr = ippErrorString (status);
|
|
|
|
+ message = dbus_message_new_signal ("/com/redhat/PrinterSpooler",
|
|
|
|
+ "com.redhat.PrinterSpooler",
|
|
|
|
+ "JobQueuedRemote");
|
|
|
|
+ dbus_message_iter_init_append (message, &iter);
|
|
|
|
+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &printer_uri);
|
|
|
|
+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &errstr);
|
|
|
|
+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_UINT32, &local_job_id);
|
|
|
|
+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_UINT32, &remote_job_id);
|
|
|
|
+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &username);
|
|
|
|
+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &printer_name);
|
|
|
|
+
|
|
|
|
+ dbus_connection_send (dbus_connection, message, NULL);
|
|
|
|
+ dbus_connection_flush (dbus_connection);
|
|
|
|
+ dbus_message_unref (message);
|
2015-06-29 11:47:50 +00:00
|
|
|
+
|
2006-11-03 12:12:18 +00:00
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+#endif /* HAVE_DBUS */
|
|
|
|
|
|
|
|
/*
|
2007-07-18 11:55:01 +00:00
|
|
|
* Local functions...
|
2015-06-29 11:47:50 +00:00
|
|
|
@@ -1700,6 +1764,15 @@ main(int argc, /* I - Number of comm
|
2013-04-19 10:52:50 +00:00
|
|
|
fprintf(stderr, "DEBUG: Print job accepted - job ID %d.\n", job_id);
|
2006-11-03 12:12:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
+#if HAVE_DBUS
|
|
|
|
+ dbus_broadcast_queued_remote (argv[0],
|
|
|
|
+ ipp_status,
|
|
|
|
+ atoi (argv[1]),
|
|
|
|
+ job_id,
|
|
|
|
+ argv[2],
|
|
|
|
+ getenv ("PRINTER"));
|
|
|
|
+#endif /* HAVE_DBUS */
|
|
|
|
+
|
|
|
|
ippDelete(response);
|
|
|
|
|
2013-04-19 10:52:50 +00:00
|
|
|
if (job_canceled)
|
2015-06-29 11:47:50 +00:00
|
|
|
diff -up cups-2.1b1/backend/Makefile.eggcups cups-2.1b1/backend/Makefile
|
|
|
|
--- cups-2.1b1/backend/Makefile.eggcups 2014-05-09 00:42:44.000000000 +0200
|
|
|
|
+++ cups-2.1b1/backend/Makefile 2015-06-29 12:54:55.753026774 +0200
|
|
|
|
@@ -264,7 +264,7 @@ dnssd: dnssd.o ../cups/$(LIBCUPS) libbac
|
2006-11-03 12:12:18 +00:00
|
|
|
|
2008-11-12 16:09:54 +00:00
|
|
|
ipp: ipp.o ../cups/$(LIBCUPS) libbackend.a
|
2006-11-03 12:12:18 +00:00
|
|
|
echo Linking $@...
|
2008-11-12 16:09:54 +00:00
|
|
|
- $(CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS)
|
2011-05-26 14:27:09 +00:00
|
|
|
+ $(CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LIBS) $(SERVERLIBS)
|
2006-11-03 12:12:18 +00:00
|
|
|
$(RM) http
|
|
|
|
$(LN) ipp http
|
|
|
|
|
2015-06-29 11:47:50 +00:00
|
|
|
diff -up cups-2.1b1/scheduler/subscriptions.c.eggcups cups-2.1b1/scheduler/subscriptions.c
|
|
|
|
--- cups-2.1b1/scheduler/subscriptions.c.eggcups 2014-02-06 19:33:34.000000000 +0100
|
|
|
|
+++ cups-2.1b1/scheduler/subscriptions.c 2015-06-29 12:54:55.753026774 +0200
|
|
|
|
@@ -1293,13 +1293,13 @@ cupsd_send_dbus(cupsd_eventmask_t event,
|
2007-06-13 16:43:07 +00:00
|
|
|
what = "PrinterAdded";
|
|
|
|
else if (event & CUPSD_EVENT_PRINTER_DELETED)
|
|
|
|
what = "PrinterRemoved";
|
|
|
|
- else if (event & CUPSD_EVENT_PRINTER_CHANGED)
|
|
|
|
- what = "QueueChanged";
|
|
|
|
else if (event & CUPSD_EVENT_JOB_CREATED)
|
|
|
|
what = "JobQueuedLocal";
|
|
|
|
else if ((event & CUPSD_EVENT_JOB_STATE) && job &&
|
|
|
|
job->state_value == IPP_JOB_PROCESSING)
|
|
|
|
what = "JobStartedLocal";
|
|
|
|
+ else if (event & (CUPSD_EVENT_PRINTER_CHANGED|CUPSD_EVENT_JOB_STATE_CHANGED|CUPSD_EVENT_PRINTER_STATE_CHANGED))
|
|
|
|
+ what = "QueueChanged";
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
|
2015-06-29 11:47:50 +00:00
|
|
|
@@ -1335,7 +1335,7 @@ cupsd_send_dbus(cupsd_eventmask_t event,
|
2007-06-13 16:43:07 +00:00
|
|
|
dbus_message_append_iter_init(message, &iter);
|
|
|
|
if (dest)
|
|
|
|
dbus_message_iter_append_string(&iter, dest->name);
|
|
|
|
- if (job)
|
|
|
|
+ if (job && strcmp (what, "QueueChanged") != 0)
|
|
|
|
{
|
|
|
|
dbus_message_iter_append_uint32(&iter, job->id);
|
|
|
|
dbus_message_iter_append_string(&iter, job->username);
|