Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No event is generated when a job is held or released #1947

Closed
michaelrsweet opened this issue Aug 29, 2006 · 2 comments
Closed

No event is generated when a job is held or released #1947

michaelrsweet opened this issue Aug 29, 2006 · 2 comments

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.2-current
CUPS.org User: jlovell

No event is generated when a job is held or released.

As you said in email:

This isn't well-defined in the spec, but I believe that holding an
active job should generate both job-state-changed and job-config-changed
events and holding an already held job with a new job-hold-until value
should generate only a job-config-changed event.  Setting the
job-hold-until value to the same value should not generate any events.

After a little testing this appears to be the only event that's missing.

Thanks!

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in Subversion repository.

@michaelrsweet
Copy link
Collaborator Author

"str1947.patch":

Index: ipp.c

--- ipp.c (revision 5905)
+++ ipp.c (working copy)
@@ -6216,6 +6216,9 @@

cupsdHoldJob(job);

  • cupsdAddEvent(CUPSD_EVENT_JOB_STATE, job->printer, job,

  •            "Job held by user.");
    

    if ((newattr = ippFindAttribute(con->request, "job-hold-until",
    IPP_TAG_KEYWORD)) == NULL)
    newattr = ippFindAttribute(con->request, "job-hold-until", IPP_TAG_NAME);
    @@ -6249,6 +6252,9 @@
    */

    cupsdSetJobHoldUntil(job, attr->values[0].string.text);
    +

  • cupsdAddEvent(CUPSD_EVENT_JOB_CONFIG_CHANGED, job->printer, job,

  •              "Job job-hold-until value changed by user.");
    

    }

    cupsdLogMessage(CUPSD_LOG_INFO, "Job %d was held by "%s".", jobid,
    @@ -7287,6 +7293,9 @@

    attr->value_tag = IPP_TAG_KEYWORD;
    attr->values[0].string.text = _cupsStrAlloc("no-hold");
    +

  • cupsdAddEvent(CUPSD_EVENT_JOB_CONFIG_CHANGED, job->printer, job,

  •              "Job job-hold-until value changed by user.");
    

    }

    /*
    @@ -7295,6 +7304,9 @@

    cupsdReleaseJob(job);

  • cupsdAddEvent(CUPSD_EVENT_JOB_STATE, job->printer, job,

  •            "Job released by user.");
    

    cupsdLogMessage(CUPSD_LOG_INFO, "Job %d was released by "%s".", jobid,
    username);

@@ -8156,6 +8168,7 @@
resource[HTTP_MAX_URI];
/* Resource portion of URI /
int port; /
Port portion of URI */

  • int event; /* Events? */

cupsdLogMessage(CUPSD_LOG_DEBUG2, "set_job_attrs(%p[%d], %s)", con,
@@ -8257,6 +8270,8 @@

cupsdLoadJob(job);

  • event = 0;

for (attr = con->request->attrs; attr; attr = attr->next)
{
if (attr->group_tag != IPP_TAG_JOB || !attr->name)
@@ -8320,7 +8335,10 @@
return;
}
else if (con->response->request.status.status_code == IPP_OK)

  •  {
     cupsdSetJobPriority(job, attr->values[0].integer);
    
  •    event |= CUPSD_EVENT_JOB_CONFIG_CHANGED;
    
  •  }
    
    }
    else if (!strcmp(attr->name, "job-state"))
    {
    @@ -8351,6 +8369,8 @@
    {
    job->state->values[0].integer = attr->values[0].integer;
    job->state_value = (ipp_jstate_t)attr->values[0].integer;
    +
  •            event |= CUPSD_EVENT_JOB_STATE;
      }
      break;
    

@@ -8425,6 +8445,8 @@
cupsdReleaseJob(job);
else
cupsdHoldJob(job);
+

  •    event |= CUPSD_EVENT_JOB_CONFIG_CHANGED | CUPSD_EVENT_JOB_STATE;
    

    }
    }
    else if (attr->value_tag == IPP_TAG_DELETEATTR)
    @@ -8445,6 +8467,8 @@
    job->attrs->last = job->attrs->prev;

     _ippFreeAttr(attr2);
    
  •    event |= CUPSD_EVENT_JOB_CONFIG_CHANGED;
    

    }
    }
    else
    @@ -8454,6 +8478,8 @@
    */

    copy_attribute(job->attrs, attr, 0);
    +

  •  event |= CUPSD_EVENT_JOB_CONFIG_CHANGED;
    

    }
    }

@@ -8464,6 +8490,19 @@
cupsdSaveJob(job);

/*

  • * Send events as needed...
  • */
  • if (event & CUPSD_EVENT_JOB_STATE)
  • cupsdAddEvent(CUPSD_EVENT_JOB_STATE, job->printer, job,
  •              job->state_value == IPP_JOB_HELD ?
    
  •         "Job held by user." : "Job restarted by user.");
    
  • if (event & CUPSD_EVENT_JOB_CONFIG_CHANGED)
  • cupsdAddEvent(CUPSD_EVENT_JOB_CONFIG_CHANGED, job->printer, job,
  •              "Job options changed by user.");
    
  • /*
    • Start jobs if possible...
      */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant