]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Map destination-uris to phone and faxPrefix options (Issue #459)
authorMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 21 Sep 2022 18:32:33 +0000 (14:32 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 21 Sep 2022 18:32:33 +0000 (14:32 -0400)
scheduler/job.c

index 58d1443895ac881fdcaf5229629a738e55cda8ae..b83ea64856af9de1d771d4413218903028b173e8 100644 (file)
@@ -3872,6 +3872,23 @@ get_options(cupsd_job_t *job,            /* I - Job */
       num_pwgppds = cupsAddOption("OutputOrder", "Reverse", num_pwgppds, &pwgppds);
   }
 
+ /*
+  * Map destination-uris value...
+  */
+
+  if ((job->printer->type & CUPS_PRINTER_FAX) && (attr = ippFindAttribute(job->attrs, "destination-uris", IPP_TAG_BEGIN_COLLECTION)) != NULL)
+  {
+    ipp_t *ipp = ippGetCollection(attr, 0);    // Collection value
+    const char *destination_uri = ippGetString(ippFindAttribute(ipp, "destination-uri", IPP_TAG_URI), 0, NULL);
+    const char *pre_dial_string = ippGetString(ippFindAttribute(ipp, "pre-dial-string", IPP_TAG_TEXT), 0, NULL);
+
+    if (destination_uri && !strncmp(destination_uri, "tel:", 4))
+      num_pwgppds = cupsAddOption("phone", destination_uri + 4, num_pwgppds, &pwgppds);
+
+    if (pre_dial_string)
+      num_pwgppds = cupsAddOption("faxPrefix", pre_dial_string, num_pwgppds, &pwgppds);
+  }
+
  /*
   * Figure out how much room we need...
   */