]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The IPP backend now updates the cupsMandatory values when the printer
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Tue, 27 Jan 2015 16:51:17 +0000 (16:51 +0000)
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>
Tue, 27 Jan 2015 16:51:17 +0000 (16:51 +0000)
configuration changes (<rdar://problem/18126570>)

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@12424 a1ca3aef-8c08-0410-bb20-df032aa958be

CHANGES.txt
backend/ipp.c

index 8f68ffab20f35cbcebb4ff1d3b774ace53372106..0b938c33a4d6bf025cf2a2ba44a9f2f30dd8476c 100644 (file)
@@ -1,4 +1,4 @@
-CHANGES.txt - 2.1b1 - 2015-01-26
+CHANGES.txt - 2.1b1 - 2015-01-27
 --------------------------------
 
 CHANGES IN CUPS V2.1b1
@@ -10,5 +10,7 @@ CHANGES IN CUPS V2.1b1
        - The IPP backend now sends the job-pages-per-set attribute when
          printing multiple copy jobs with finishings
          (<rdar://problem/16792757>)
+       - The IPP backend now updates the cupsMandatory values when the printer
+         configuration changes (<rdar://problem/18126570>)
        - No longer install banner files since third-party banner filters now
          supply their own (STR #4518)
index 54870d1f666af06806d387364277416617a5f53c..ee482058ad9f6dc9e5d15ec5661134a5863666ba 100644 (file)
@@ -121,6 +121,7 @@ static const char * const pattrs[] =        /* Printer attributes we want */
   "printer-alert",
   "printer-alert-description",
   "printer-is-accepting-jobs",
+  "printer-mandatory-job-attributes",
   "printer-state",
   "printer-state-message",
   "printer-state-reasons"
@@ -144,6 +145,8 @@ static cups_option_t        *attr_cache = NULL;
 static cups_array_t    *state_reasons; /* Array of printe-state-reasons keywords */
 static char            tmpfilename[1024] = "";
                                        /* Temporary spool file name */
+static char            mandatory_attrs[1024] = "";
+                                       /* cupsMandatory value */
 
 
 /*
@@ -1294,11 +1297,16 @@ main(int  argc,                         /* I - Number of command-line args */
       * Load the PPD file and generate PWG attribute mapping information...
       */
 
+      ppd_attr_t *mandatory;           /* cupsMandatory value */
+
       ppd = ppdOpenFile(getenv("PPD"));
       pc  = _ppdCacheCreateWithPPD(ppd);
 
       ppdMarkDefaults(ppd);
       cupsMarkOptions(ppd, num_options, options);
+
+      if ((mandatory = ppdFindAttr(ppd, "cupsMandatory", NULL)) != NULL)
+        strlcpy(mandatory_attrs, mandatory->value, sizeof(mandatory_attrs));
     }
   }
   else
@@ -3221,6 +3229,7 @@ report_printer_state(ipp_t *ipp)  /* I - IPP response */
 {
   ipp_attribute_t      *pa,            /* printer-alert */
                        *pam,           /* printer-alert-message */
+                       *pmja,          /* printer-mandatory-job-attributes */
                        *psm,           /* printer-state-message */
                        *reasons,       /* printer-state-reasons */
                        *marker;        /* marker-* attributes */
@@ -3241,6 +3250,26 @@ report_printer_state(ipp_t *ipp) /* I - IPP response */
                               IPP_TAG_TEXT)) != NULL)
     report_attr(pam);
 
+  if ((pmja = ippFindAttribute(ipp, "printer-mandatory-job-attributes", IPP_TAG_KEYWORD)) != NULL)
+  {
+    int        i,                              /* Looping var */
+       count = ippGetCount(pmja);      /* Number of values */
+
+    for (i = 0, valptr = value; i < count; i ++, valptr += strlen(valptr))
+    {
+      if (i)
+        snprintf(valptr, sizeof(value) - (size_t)(valptr - value), " %s", ippGetString(pmja, i, NULL));
+      else
+        strlcpy(value, ippGetString(pmja, i, NULL), sizeof(value));
+    }
+
+    if (strcmp(value, mandatory_attrs))
+    {
+      strlcpy(mandatory_attrs, value, sizeof(mandatory_attrs));
+      fprintf(stderr, "PPD: cupsMandatory=\"%s\"\n", value);
+    }
+  }
+
   if ((psm = ippFindAttribute(ipp, "printer-state-message",
                               IPP_TAG_TEXT)) != NULL)
   {