summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Pool <mbp@samba.org>2001-12-21 00:37:09 +0000
committerMartin Pool <mbp@samba.org>2001-12-21 00:37:09 +0000
commitdf28dee653ea2f685c7779fed80fe639784699f5 (patch)
tree839cb128855b65a87ab51b10b6866bb377e7fab9
parentb379c92273a32c197bd8ae3e7dfb36b764b41920 (diff)
downloadsamba-df28dee653ea2f685c7779fed80fe639784699f5.tar.gz
samba-df28dee653ea2f685c7779fed80fe639784699f5.tar.bz2
samba-df28dee653ea2f685c7779fed80fe639784699f5.zip
Factor out a broadcast_printer_notify() routine.
(This used to be commit d32598c953e7a500f707a02608c44203bc5941ec)
-rw-r--r--source3/printing/printing.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index fe16ee7283..0a97cb52b3 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -246,6 +246,16 @@ static int traverse_fn_delete(TDB_CONTEXT *t, TDB_DATA key, TDB_DATA data, void
return 0;
}
+/**
+ * Send PRINTER NOTIFY to all processes.
+ **/
+void broadcast_printer_notify(const char *printer_name)
+{
+ /* include NUL */
+ message_send_all(conn_tdb_ctx(), MSG_PRINTER_NOTIFY, printer_name,
+ strlen(printer_name) + 1, False, NULL);
+}
+
/****************************************************************************
check if the print queue has been updated recently enough
****************************************************************************/
@@ -442,7 +452,7 @@ static void print_queue_update_background(int snum)
if( qcount != get_queue_status(snum, &old_status)) {
DEBUG(10,("print_queue_update: queue status change %d jobs -> %d jobs for printer %s\n",
old_status.qcount, qcount, printer_name ));
- message_send_all(conn_tdb_ctx(), MSG_PRINTER_NOTIFY, printer_name, strlen(printer_name) + 1, False);
+ broadcast_printer_notify(printer_name);
}
/* store the new queue status structure */
@@ -688,7 +698,7 @@ BOOL print_job_delete(struct current_user *user, int jobid, WERROR *errcode)
printer_name = PRINTERNAME(snum);
- message_send_all(conn_tdb_ctx(), MSG_PRINTER_NOTIFY, printer_name, strlen(printer_name) + 1, False);
+ broadcast_printer_notify(printer_name);
return !print_job_exists(jobid);
}
@@ -731,7 +741,7 @@ BOOL print_job_pause(struct current_user *user, int jobid, WERROR *errcode)
printer_name = PRINTERNAME(snum);
- message_send_all(conn_tdb_ctx(), MSG_PRINTER_NOTIFY, printer_name, strlen(printer_name) + 1, False);
+ broadcast_printer_notify(printer_name);
/* how do we tell if this succeeded? */
@@ -774,7 +784,7 @@ BOOL print_job_resume(struct current_user *user, int jobid, WERROR *errcode)
printer_name = PRINTERNAME(snum);
- message_send_all(conn_tdb_ctx(),MSG_PRINTER_NOTIFY, printer_name, strlen(printer_name) + 1, False);
+ broadcast_printer_notify(printer_name);
return True;
}
@@ -1274,7 +1284,7 @@ BOOL print_queue_pause(struct current_user *user, int snum, WERROR *errcode)
printer_name = PRINTERNAME(snum);
- message_send_all(conn_tdb_ctx(),MSG_PRINTER_NOTIFY, printer_name, strlen(printer_name) + 1, False);
+ broadcast_printer_notify(printer_name);
return True;
}
@@ -1306,7 +1316,7 @@ BOOL print_queue_resume(struct current_user *user, int snum, WERROR *errcode)
printer_name = PRINTERNAME(snum);
- message_send_all(conn_tdb_ctx(),MSG_PRINTER_NOTIFY, printer_name, strlen(printer_name) + 1, False);
+ broadcast_printer_notify(printer_name);
return True;
}
@@ -1342,7 +1352,7 @@ BOOL print_queue_purge(struct current_user *user, int snum, WERROR *errcode)
printer_name = PRINTERNAME(snum);
- message_send_all(conn_tdb_ctx(),MSG_PRINTER_NOTIFY, printer_name, strlen(printer_name) + 1, False);
+ broadcast_printer_notify(printer_name);
return True;
}