]> git.pld-linux.org Git - packages/cups.git/blame - cups-eggcups.patch
Release 4 (by relup.sh)
[packages/cups.git] / cups-eggcups.patch
CommitLineData
5565574e
AM
1diff -up cups-2.3.0/backend/ipp.c.eggcups cups-2.3.0/backend/ipp.c
2--- cups-2.3.0/backend/ipp.c.eggcups 2019-08-23 17:19:38.000000000 +0200
3+++ cups-2.3.0/backend/ipp.c 2019-10-07 12:14:25.385111933 +0200
4@@ -143,6 +143,70 @@ static char tmpfilename[1024] = "";
b3b50933
AM
5 static char mandatory_attrs[1024] = "";
6 /* cupsMandatory value */
7
8+#if HAVE_DBUS
9+#include <dbus/dbus.h>
10+
11+static DBusConnection *dbus_connection = NULL;
12+
13+static int
14+init_dbus (void)
15+{
16+ DBusConnection *connection;
17+ DBusError error;
18+
19+ if (dbus_connection &&
20+ !dbus_connection_get_is_connected (dbus_connection)) {
21+ dbus_connection_unref (dbus_connection);
22+ dbus_connection = NULL;
23+ }
24+
25+ dbus_error_init (&error);
26+ connection = dbus_bus_get (getuid () ? DBUS_BUS_SESSION : DBUS_BUS_SYSTEM, &error);
27+ if (connection == NULL) {
28+ dbus_error_free (&error);
29+ return -1;
30+ }
31+
32+ dbus_connection = connection;
33+ return 0;
34+}
35+
36+int
37+dbus_broadcast_queued_remote (const char *printer_uri,
38+ ipp_status_t status,
39+ unsigned int local_job_id,
40+ unsigned int remote_job_id,
41+ const char *username,
42+ const char *printer_name)
43+{
44+ DBusMessage *message;
45+ DBusMessageIter iter;
46+ const char *errstr;
47+
48+ if (!dbus_connection || !dbus_connection_get_is_connected (dbus_connection)) {
49+ if (init_dbus () || !dbus_connection)
50+ return -1;
51+ }
52+
53+ errstr = ippErrorString (status);
54+ message = dbus_message_new_signal ("/com/redhat/PrinterSpooler",
55+ "com.redhat.PrinterSpooler",
56+ "JobQueuedRemote");
57+ dbus_message_iter_init_append (message, &iter);
58+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &printer_uri);
59+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &errstr);
60+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_UINT32, &local_job_id);
61+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_UINT32, &remote_job_id);
62+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &username);
63+ dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &printer_name);
64+
65+ dbus_connection_send (dbus_connection, message, NULL);
66+ dbus_connection_flush (dbus_connection);
67+ dbus_message_unref (message);
68+
69+ return 0;
70+}
71+#endif /* HAVE_DBUS */
72
73 /*
74 * Local functions...
5565574e 75@@ -1768,6 +1832,15 @@ main(int argc, /* I - Number of comm
b3b50933
AM
76 fprintf(stderr, "DEBUG: Print job accepted - job ID %d.\n", job_id);
77 }
78
79+#if HAVE_DBUS
80+ dbus_broadcast_queued_remote (argv[0],
81+ ipp_status,
82+ atoi (argv[1]),
83+ job_id,
84+ argv[2],
85+ getenv ("PRINTER"));
86+#endif /* HAVE_DBUS */
87+
88 ippDelete(response);
89
90 if (job_canceled)
5565574e
AM
91diff -up cups-2.3.0/backend/Makefile.eggcups cups-2.3.0/backend/Makefile
92--- cups-2.3.0/backend/Makefile.eggcups 2019-10-07 12:14:25.385111933 +0200
93+++ cups-2.3.0/backend/Makefile 2019-10-07 12:16:00.457569406 +0200
94@@ -257,7 +257,7 @@ dnssd: dnssd.o ../cups/$(LIBCUPS) libbac
b3b50933
AM
95
96 ipp: ipp.o ../cups/$(LIBCUPS) libbackend.a
97 echo Linking $@...
5565574e
AM
98- $(LD_CC) $(ALL_LDFLAGS) -o ipp ipp.o libbackend.a $(LINKCUPS)
99+ $(LD_CC) $(LDFLAGS) -o ipp ipp.o libbackend.a $(LINKCUPS) $(SERVERLIBS)
c8c61f35 100 $(CODE_SIGN) -s "$(CODE_SIGN_IDENTITY)" $@
5565574e
AM
101 $(RM) http https ipps
102 for file in $(IPPALIASES); do \
103diff -up cups-2.3.0/scheduler/subscriptions.c.eggcups cups-2.3.0/scheduler/subscriptions.c
104--- cups-2.3.0/scheduler/subscriptions.c.eggcups 2019-08-23 17:19:38.000000000 +0200
105+++ cups-2.3.0/scheduler/subscriptions.c 2019-10-07 12:18:21.736478684 +0200
106@@ -1257,13 +1257,13 @@ cupsd_send_dbus(cupsd_eventmask_t event,
b3b50933
AM
107 what = "PrinterAdded";
108 else if (event & CUPSD_EVENT_PRINTER_DELETED)
109 what = "PrinterRemoved";
110- else if (event & CUPSD_EVENT_PRINTER_CHANGED)
111- what = "QueueChanged";
112 else if (event & CUPSD_EVENT_JOB_CREATED)
113 what = "JobQueuedLocal";
114 else if ((event & CUPSD_EVENT_JOB_STATE) && job &&
5565574e 115 job->state_value == IPP_JOB_PROCESSING)
b3b50933
AM
116 what = "JobStartedLocal";
117+ else if (event & (CUPSD_EVENT_PRINTER_CHANGED|CUPSD_EVENT_JOB_STATE_CHANGED|CUPSD_EVENT_PRINTER_STATE_CHANGED))
118+ what = "QueueChanged";
119 else
120 return;
121
5565574e 122@@ -1299,7 +1299,7 @@ cupsd_send_dbus(cupsd_eventmask_t event,
b3b50933
AM
123 dbus_message_append_iter_init(message, &iter);
124 if (dest)
125 dbus_message_iter_append_string(&iter, dest->name);
126- if (job)
127+ if (job && strcmp (what, "QueueChanged") != 0)
128 {
129 dbus_message_iter_append_uint32(&iter, job->id);
130 dbus_message_iter_append_string(&iter, job->username);
This page took 0.060519 seconds and 4 git commands to generate.