cups/cups-delete-active-printer.patch
2009-12-09 11:39:16 +00:00

111 lines
3.4 KiB
Diff

diff -up cups-1.4.2/CHANGES.txt.delete-active-printer cups-1.4.2/CHANGES.txt
diff -up cups-1.4.2/scheduler/job.c.delete-active-printer cups-1.4.2/scheduler/job.c
--- cups-1.4.2/scheduler/job.c.delete-active-printer 2009-12-09 11:24:50.946891977 +0000
+++ cups-1.4.2/scheduler/job.c 2009-12-09 11:25:32.145892252 +0000
@@ -168,7 +168,7 @@ static mime_filter_t gziptoany_filter =
static int compare_active_jobs(void *first, void *second, void *data);
static int compare_jobs(void *first, void *second, void *data);
static void dump_job_history(cupsd_job_t *job);
-static void finalize_job(cupsd_job_t *job);
+static void finalize_job(cupsd_job_t *job, int set_job_state);
static void free_job_history(cupsd_job_t *job);
static char *get_options(cupsd_job_t *job, int banner_page, char *copies,
size_t copies_size, char *title,
@@ -1297,7 +1297,7 @@ cupsdDeleteJob(cupsd_job_t *job, /
cupsd_jobaction_t action)/* I - Action */
{
if (job->printer)
- finalize_job(job);
+ finalize_job(job, 1);
if (action == CUPSD_JOB_PURGE)
{
@@ -2298,7 +2298,7 @@ cupsdSetJobState(
*/
if (oldstate == IPP_JOB_PROCESSING)
- stop_job(job, action != CUPSD_JOB_DEFAULT);
+ stop_job(job, action);
/*
* Set the new job state...
@@ -2505,8 +2505,8 @@ cupsdSetJobState(
* Finalize the job immediately if we forced things...
*/
- if (action == CUPSD_JOB_FORCE)
- finalize_job(job);
+ if (action >= CUPSD_JOB_FORCE)
+ finalize_job(job, 0);
/*
* Update the server "busy" state...
@@ -2741,7 +2741,8 @@ free_job_history(cupsd_job_t *job) /* I
*/
static void
-finalize_job(cupsd_job_t *job) /* I - Job */
+finalize_job(cupsd_job_t *job, /* I - Job */
+ int set_job_state) /* I - 1 = set the job state */
{
ipp_pstate_t printer_state; /* New printer state value */
ipp_jstate_t job_state; /* New job state value */
@@ -3027,7 +3028,9 @@ finalize_job(cupsd_job_t *job) /* I - J
* Update the printer and job state.
*/
- cupsdSetJobState(job, job_state, CUPSD_JOB_DEFAULT, "%s", message);
+ if (job_state != job->state_value)
+ cupsdSetJobState(job, job_state, CUPSD_JOB_DEFAULT, "%s", message);
+
cupsdSetPrinterState(job->printer, printer_state,
printer_state == IPP_PRINTER_STOPPED);
update_job_attrs(job, 0);
@@ -3995,15 +3998,34 @@ stop_job(cupsd_job_t *job, /* I -
if (action == CUPSD_JOB_DEFAULT && !job->kill_time)
job->kill_time = time(NULL) + JobKillDelay;
- else if (action == CUPSD_JOB_FORCE)
+ else if (action >= CUPSD_JOB_FORCE)
job->kill_time = 0;
for (i = 0; job->filters[i]; i ++)
if (job->filters[i] > 0)
- cupsdEndProcess(job->filters[i], action == CUPSD_JOB_FORCE);
+ {
+ cupsdEndProcess(job->filters[i], action >= CUPSD_JOB_FORCE);
+
+ if (action >= CUPSD_JOB_FORCE)
+ job->filters[i] = -job->filters[i];
+ }
if (job->backend > 0)
- cupsdEndProcess(job->backend, action == CUPSD_JOB_FORCE);
+ {
+ cupsdEndProcess(job->backend, action >= CUPSD_JOB_FORCE);
+
+ if (action >= CUPSD_JOB_FORCE)
+ job->backend = -job->backend;
+ }
+
+ if (action >= CUPSD_JOB_FORCE)
+ {
+ /*
+ * Clear job status...
+ */
+
+ job->status = 0;
+ }
}
@@ -4393,7 +4415,7 @@ update_job(cupsd_job_t *job) /* I - Job
* Handle the end of job stuff...
*/
- finalize_job(job);
+ finalize_job(job, 1);
/*
* Check for new jobs...