@@ -5714,7 +5714,6 @@ on_job_state (CupsNotifier *object,
5714
5714
int dest_index = 0 ;
5715
5715
int valid_dest_found = 0 ;
5716
5716
char uri [HTTP_MAX_URI ];
5717
- /*int job_id = 0;*/
5718
5717
int num_options ;
5719
5718
cups_option_t * options ;
5720
5719
int num_of_printers ;
@@ -5732,11 +5731,6 @@ on_job_state (CupsNotifier *object,
5732
5731
"printer-is-accepting-jobs"
5733
5732
};
5734
5733
http_t * conn = NULL ;
5735
- static const char * jattrs [] =
5736
- {
5737
- "job-id" ,
5738
- "job-state"
5739
- };
5740
5734
5741
5735
debug_printf ("on_job_state() in THREAD %ld\n" , pthread_self ());
5742
5736
@@ -5836,48 +5830,13 @@ on_job_state (CupsNotifier *object,
5836
5830
/* We have remote CUPS queue(s) and so are using the implicitclass
5837
5831
backend */
5838
5832
debug_printf ("[CUPS Notification] %s is using the \"implicitclass\" CUPS backend, so let us search for a destination for this job.\n" , printer );
5833
+
5839
5834
/* We keep track of the printer which we used last time and start
5840
5835
checking with the next printer this time, to get a "round robin"
5841
5836
type of printer usage instead of having most jobs going to the first
5842
5837
printer in the list. Method taken from the cupsdFindAvailablePrinter()
5843
5838
function of the scheduler/classes.c file of CUPS. */
5844
5839
5845
- /* Find the ID of the current job */
5846
- request = ippNewRequest (IPP_GET_JOBS );
5847
- httpAssembleURIf (HTTP_URI_CODING_ALL , uri , sizeof (uri ), "ipp" , NULL ,
5848
- "localhost" , ippPort (), "/printers/%s" , printer );
5849
- ippAddString (request , IPP_TAG_OPERATION , IPP_TAG_URI ,
5850
- "printer-uri" , NULL , uri );
5851
- ippAddStrings (request , IPP_TAG_OPERATION , IPP_TAG_KEYWORD ,
5852
- "requested-attributes" ,
5853
- sizeof (jattrs ) / sizeof (jattrs [0 ]), NULL , jattrs );
5854
- job_id = 0 ;
5855
- if ((response = cupsDoRequest (conn , request , "/" )) != NULL ) {
5856
- /* Get the current active job on this queue... */
5857
- ipp_jstate_t jobstate = IPP_JOB_PENDING ;
5858
- for (attr = ippFirstAttribute (response ); attr != NULL ;
5859
- attr = ippNextAttribute (response )) {
5860
- if (!ippGetName (attr )) {
5861
- if (jobstate == IPP_JOB_PROCESSING )
5862
- break ;
5863
- else
5864
- continue ;
5865
- }
5866
- if (!strcmp (ippGetName (attr ), "job-id" ) &&
5867
- ippGetValueTag (attr ) == IPP_TAG_INTEGER )
5868
- job_id = ippGetInteger (attr , 0 );
5869
- else if (!strcmp (ippGetName (attr ), "job-state" ) &&
5870
- ippGetValueTag (attr ) == IPP_TAG_ENUM )
5871
- jobstate = (ipp_jstate_t )ippGetInteger (attr , 0 );
5872
- }
5873
- if (jobstate != IPP_JOB_PROCESSING )
5874
- job_id = 0 ;
5875
- ippDelete (response );
5876
- }
5877
- if (job_id == 0 )
5878
- debug_printf ("ERROR: could not determine ID of current job on %s\n" ,
5879
- printer );
5880
-
5881
5840
if (q -> last_printer < 0 ||
5882
5841
q -> last_printer >= cupsArrayCount (remote_printers ))
5883
5842
q -> last_printer = 0 ;
@@ -6169,7 +6128,7 @@ on_job_state (CupsNotifier *object,
6169
6128
"requesting-user-name" , NULL , cupsUser ());
6170
6129
if (dest_host ) {
6171
6130
q -> last_printer = dest_index ;
6172
- snprintf (buf , sizeof (buf ), "\"%d %s %s %s\"" , job_id ,destination_uri ,
6131
+ snprintf (buf , sizeof (buf ), "\"%d %s %s %s\"" , job_id , destination_uri ,
6173
6132
document_format , resolution );
6174
6133
debug_printf ("Destination for job %d to %s: %s:%d, queue %s\n" ,
6175
6134
job_id , printer , dest_host , dest_port , dest_name );
0 commit comments