]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Add support for Apple recoverable:/recovered: messages and
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 1 Feb 2006 16:29:57 +0000 (16:29 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Wed, 1 Feb 2006 16:29:57 +0000 (16:29 +0000)
com.apple.print.recoverable-message attribute.

scheduler/ipp.c:
    - copy_printer_attrs(): Copy com.apple.print.recoverable-message
      attribute as needed.

scheduler/job.c
    - cupsdUpdateJob(): Handle recoverable: and recovered: messages.

scheduler/printers.c
    - cupsdAddPrinterHistory(): Add com.apple.print.recoverable-message
      to history.
    - cupsdDeletePrinter(): Clear recoverable string as needed.

scheduler/printers.h
    - Add recoverable string to cupsd_printer_t structure.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@5039 7a7537e8-13f0-0310-91df-b6672ffda945

scheduler/ipp.c
scheduler/job.c
scheduler/printers.c
scheduler/printers.h

index 91e89e474b3ed82c704595d4677d050fc4a96d58..9aae5a8a5d67c0d8c2dd506d9ad79152e242f92f 100644 (file)
@@ -3694,6 +3694,14 @@ copy_printer_attrs(
 
   curtime = time(NULL);
 
+#ifdef __APPLE__
+  if ((!ra || cupsArrayFind(ra, "com.apple.print.recoverable-message")) &&
+      printer->recoverable)
+    ippAddString(con->response, IPP_TAG_PRINTER, IPP_TAG_TEXT,
+                 "com.apple.print.recoverable-message", NULL,
+                printer->recoverable);
+#endif /* __APPLE__ */
+
   if (!ra || cupsArrayFind(ra, "printer-current-time"))
     ippAddDate(con->response, IPP_TAG_PRINTER, "printer-current-time",
                ippTimeToDate(curtime));
index 179fa8e79db8cc67921032901befbb5f54f329cb..ce7884574019d74db5ce05c78eec95456045daf1 100644 (file)
@@ -2441,6 +2441,32 @@ cupsdUpdateJob(cupsd_job_t *job) /* I - Job to check */
 
       /**** TODO ****/
     }
+#ifdef __APPLE__
+    else if (!strncmp(message, "recoverable:", 12))
+    {
+      cupsdSetPrinterReasons(job->printer,
+                             "+com.apple.print.recoverable-warning");
+
+      message += 12;
+      while (isspace(*message & 255))
+        message ++;
+
+      cupsdSetString(&job->printer->recoverable, message);
+      cupsdAddPrinterHistory(job->printer);
+    }
+    else if (!strncmp(message, "recovered:", 10))
+    {
+      cupsdSetPrinterReasons(job->printer,
+                             "-com.apple.print.recoverable-warning");
+
+      message += 10;
+      while (isspace(*message & 255))
+        message ++;
+
+      cupsdSetString(&job->printer->recoverable, message);
+      cupsdAddPrinterHistory(job->printer);
+    }
+#endif /* __APPLE__ */
     else
     {
      /*
index a1b22f41a372a944ad2b31abf34883ebf9362e27..a42c0a7eaedaa5d6a74ac0a57542184a9373d6a4 100644 (file)
@@ -242,6 +242,11 @@ cupsdAddPrinterHistory(
   ippAddBoolean(history, IPP_TAG_PRINTER, "printer-is-shared", p->shared);
   ippAddString(history, IPP_TAG_PRINTER, IPP_TAG_TEXT, "printer-state-message",
                NULL, p->state_message);
+#ifdef __APPLE__
+  if (p->recoverable)
+    ippAddString(history, IPP_TAG_PRINTER, IPP_TAG_TEXT,
+                 "com.apple.print.recoverable-message", NULL, p->recoverable);
+#endif /* __APPLE__ */
   if (p->num_reasons == 0)
     ippAddString(history, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
                  "printer-state-reasons", NULL,
@@ -796,6 +801,10 @@ cupsdDeletePrinter(
   cupsdClearString(&p->op_policy);
   cupsdClearString(&p->error_policy);
 
+#ifdef __APPLE__
+  cupsdClearString(&p->recoverable);
+#endif /* __APPLE__ */
+
   free(p);
 
  /*
index 44f20eb9bc71c5ea97cc0b23b1730f2ded466f30..7e35565248c9415091ba77dae8d103a8b84eb9d4 100644 (file)
@@ -80,6 +80,9 @@ typedef struct cupsd_printer_s
   int          num_history;            /* Number of history collections */
   ipp_t                **history;              /* History data */
   int          sequence_number;        /* Increasing sequence number */
+#ifdef __APPLE__
+  char         *recoverable;           /* com.apple.print.recoverable-message */
+#endif /* __APPLE__ */
 } cupsd_printer_t;