summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-02-26 03:12:09 +0000
committerJeremy Allison <jra@samba.org>2002-02-26 03:12:09 +0000
commit2ff93902451a234e78490a1b18c2fae43d997b01 (patch)
treeca8eac874c2baa56b2aadf685ff5855328bbf50d /source3/printing
parent2f8452fd49dd34da5cd07629dcba937861dd0731 (diff)
downloadsamba-2ff93902451a234e78490a1b18c2fae43d997b01.tar.gz
samba-2ff93902451a234e78490a1b18c2fae43d997b01.tar.bz2
samba-2ff93902451a234e78490a1b18c2fae43d997b01.zip
Fixup the sending of printer change messages from job changes.
Jeremy. (This used to be commit 28d4e7a3e2bd8f15ef807b821e4300a72bbc6904)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/printing.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index f783f8d590..7d4a52c351 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -246,16 +246,6 @@ 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
****************************************************************************/
@@ -321,6 +311,20 @@ static void set_updating_pid(fstring printer_name, BOOL delete)
}
/****************************************************************************
+ Send a message saying the queue changed.
+****************************************************************************/
+
+static void send_queue_message(const char *printer_name, uint32 high, uint32 low)
+{
+ char msg[8 + sizeof(fstring)];
+ SIVAL(msg,0,low);
+ SIVAL(msg,4,high);
+ fstrcpy(&msg[8], printer_name);
+
+ message_send_all(conn_tdb_ctx(), MSG_PRINTER_NOTIFY, msg, 8 + strlen(printer_name) + 1, False, NULL);
+}
+
+/****************************************************************************
update the internal database from the system print queue for a queue in the background
****************************************************************************/
@@ -452,7 +456,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 ));
- broadcast_printer_notify(printer_name);
+ send_queue_message(printer_name, 0, PRINTER_CHANGE_JOB);
}
/* store the new queue status structure */
@@ -696,7 +700,7 @@ BOOL print_job_delete(struct current_user *user, int jobid, WERROR *errcode)
printer_name = PRINTERNAME(snum);
- broadcast_printer_notify(printer_name);
+ send_queue_message(printer_name, 0, PRINTER_CHANGE_JOB);
return !print_job_exists(jobid);
}
@@ -739,7 +743,7 @@ BOOL print_job_pause(struct current_user *user, int jobid, WERROR *errcode)
printer_name = PRINTERNAME(snum);
- broadcast_printer_notify(printer_name);
+ send_queue_message(printer_name, 0, PRINTER_CHANGE_JOB);
/* how do we tell if this succeeded? */
@@ -782,7 +786,7 @@ BOOL print_job_resume(struct current_user *user, int jobid, WERROR *errcode)
printer_name = PRINTERNAME(snum);
- broadcast_printer_notify(printer_name);
+ send_queue_message(printer_name, 0, PRINTER_CHANGE_JOB);
return True;
}
@@ -1282,7 +1286,7 @@ BOOL print_queue_pause(struct current_user *user, int snum, WERROR *errcode)
printer_name = PRINTERNAME(snum);
- broadcast_printer_notify(printer_name);
+ send_queue_message(printer_name, 0, PRINTER_CHANGE_JOB);
return True;
}
@@ -1314,7 +1318,7 @@ BOOL print_queue_resume(struct current_user *user, int snum, WERROR *errcode)
printer_name = PRINTERNAME(snum);
- broadcast_printer_notify(printer_name);
+ send_queue_message(printer_name, 0, PRINTER_CHANGE_JOB);
return True;
}
@@ -1350,7 +1354,7 @@ BOOL print_queue_purge(struct current_user *user, int snum, WERROR *errcode)
printer_name = PRINTERNAME(snum);
- broadcast_printer_notify(printer_name);
+ send_queue_message(printer_name, 0, PRINTER_CHANGE_JOB);
return True;
}