MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cupsdAddEvent

Function cupsdAddEvent

scheduler/subscriptions.c:49–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47 */
48
49void
50cupsdAddEvent(
51 cupsd_eventmask_t event, /* I - Event */
52 cupsd_printer_t *dest, /* I - Printer associated with event */
53 cupsd_job_t *job, /* I - Job associated with event */
54 const char *text, /* I - Notification text */
55 ...) /* I - Additional arguments as needed */
56{
57 int i, /* Looping var */
58 scount; /* Number of subscriptions */
59 va_list ap; /* Pointer to additional arguments */
60 char ftext[1024]; /* Formatted text buffer */
61 ipp_attribute_t *attr; /* Printer/job attribute */
62 cupsd_event_t *temp = NULL; /* New event pointer */
63 cupsd_subscription_t *sub; /* Current subscription */
64
65
66 cupsdLogMessage(CUPSD_LOG_DEBUG2,
67 "cupsdAddEvent(event=%s, dest=%p(%s), job=%p(%d), text=\"%s\", ...)",
68 cupsdEventName(event), dest, dest ? dest->name : "",
69 job, job ? job->id : 0, text);
70
71 /*
72 * Keep track of events with any OS-supplied notification mechanisms...
73 */
74
75 LastEvent |= event;
76
77#ifdef HAVE_DBUS
78 cupsd_send_dbus(event, dest, job);
79#endif /* HAVE_DBUS */
80
81 /*
82 * Return if we aren't keeping events...
83 */
84
85 if (MaxEvents <= 0)
86 {
87 cupsdLogMessage(CUPSD_LOG_WARN,
88 "cupsdAddEvent: Discarding %s event since MaxEvents is %d!",
89 cupsdEventName(event), MaxEvents);
90 return;
91 }
92
93 /*
94 * Then loop through the subscriptions and add the event to the corresponding
95 * caches...
96 */
97
98 if (job && !dest)
99 dest = cupsdFindPrinter(job->dest);
100
101 _cupsRWLockRead(&SubscriptionsLock);
102
103 for (i = 0, scount = cupsArrayCount(Subscriptions); i < scount; i ++)
104 {
105 /*
106 * Check if this subscription requires this event...

Callers 15

cupsdLogFCMessageFunction · 0.85
cupsdProcessIPPRequestFunction · 0.85
accept_jobsFunction · 0.85
add_classFunction · 0.85
add_jobFunction · 0.85
add_printerFunction · 0.85
authenticate_jobFunction · 0.85
create_local_bg_threadFunction · 0.85
delete_printerFunction · 0.85
hold_jobFunction · 0.85
reject_jobsFunction · 0.85
release_jobFunction · 0.85

Calls 15

cupsdLogMessageFunction · 0.85
cupsdEventNameFunction · 0.85
cupsd_send_dbusFunction · 0.85
cupsdFindPrinterFunction · 0.85
_cupsRWLockReadFunction · 0.85
cupsArrayCountFunction · 0.85
cupsArrayIndexFunction · 0.85
_cupsRWUnlockFunction · 0.85
ippNewFunction · 0.85
ippAddStringFunction · 0.85
ippAddIntegerFunction · 0.85
ippAddOctetStringFunction · 0.85

Tested by

no test coverage detected