From 24955e736bf151e858760bc3fe1225d115933204 Mon Sep 17 00:00:00 2001 From: Gerhard Muth Date: Thu, 12 Oct 2023 00:28:16 +0200 Subject: [PATCH] IppRequest extension printerGroup --- src/main/kotlin/de/gmuth/ipp/client/CupsClient.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/de/gmuth/ipp/client/CupsClient.kt b/src/main/kotlin/de/gmuth/ipp/client/CupsClient.kt index abae54b1..68f0245c 100644 --- a/src/main/kotlin/de/gmuth/ipp/client/CupsClient.kt +++ b/src/main/kotlin/de/gmuth/ipp/client/CupsClient.kt @@ -6,6 +6,7 @@ package de.gmuth.ipp.client import de.gmuth.ipp.client.IppExchangeException.ClientErrorNotFoundException import de.gmuth.ipp.client.WhichJobs.All +import de.gmuth.ipp.core.IppAttributesGroup import de.gmuth.ipp.core.IppOperation import de.gmuth.ipp.core.IppOperation.* import de.gmuth.ipp.core.IppRequest @@ -221,7 +222,6 @@ class CupsClient( ).apply { updateAttributes("printer-name") log.info(toString()) - require(deviceUri.scheme.startsWith("ipp")) { "uri scheme unsupported: $deviceUri" } log.info { "CUPS now generates IPP Everywhere PPD." } do { // https://github.com/apple/cups/issues/5919 updateAttributes("printer-make-and-model") @@ -229,9 +229,7 @@ class CupsClient( log.info { "Make printer permanent." } exchange( cupsPrinterRequest(CupsAddModifyPrinter, printerName).apply { - getSingleAttributesGroup(Printer).run { - attribute("printer-is-temporary", IppTag.Boolean, false) - } + printerGroup.attribute("printer-is-temporary", IppTag.Boolean, false) } ) log.info { "Make printer operational." } @@ -240,6 +238,9 @@ class CupsClient( updateAttributes() } + private val IppRequest.printerGroup: IppAttributesGroup + get() = getSingleAttributesGroup(Printer) + // --------------------------- // Get jobs and save documents // ---------------------------