thorsson_cups 0.0.27 → 0.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/cups.c +11 -5
- metadata +2 -2
data/ext/cups.c
CHANGED
|
@@ -441,9 +441,11 @@ static VALUE cups_cancel_print(int argc, VALUE* argv, VALUE self)
|
|
|
441
441
|
*
|
|
442
442
|
* Return uri for requested printer.
|
|
443
443
|
*/
|
|
444
|
-
|
|
444
|
+
static VALUE cups_get_device_uri(VALUE self, VALUE printerName)
|
|
445
|
+
{
|
|
445
446
|
// Don't have to lift a finger unless the printer exists.
|
|
446
|
-
if (!printer_exists(printerName))
|
|
447
|
+
if (!printer_exists(printerName))
|
|
448
|
+
{
|
|
447
449
|
rb_raise(rb_eRuntimeError, "The printer or destination doesn't exist!");
|
|
448
450
|
}
|
|
449
451
|
|
|
@@ -461,14 +463,18 @@ static VALUE cups_cancel_print(int argc, VALUE* argv, VALUE self)
|
|
|
461
463
|
httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL, "localhost", 0, "/printers/%s", printer);
|
|
462
464
|
ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, uri);
|
|
463
465
|
|
|
464
|
-
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
|
465
|
-
|
|
466
|
+
if ((response = cupsDoRequest(http, request, "/")) != NULL)
|
|
467
|
+
{
|
|
468
|
+
if((attr = ippFindAttribute(response, "device-uri", IPP_TAG_URI)) != NULL)
|
|
469
|
+
{
|
|
466
470
|
//int c = 0;
|
|
467
471
|
// sprintf(location, "%s", attr->values[0].string.text);
|
|
468
472
|
}
|
|
469
473
|
ippDelete(response);
|
|
470
474
|
}
|
|
471
|
-
|
|
475
|
+
|
|
476
|
+
return Qtrue;
|
|
477
|
+
}
|
|
472
478
|
|
|
473
479
|
/*
|
|
474
480
|
* call-seq:
|