From 5f71f2dd645d647454e7a02ff281bb76866edb9a Mon Sep 17 00:00:00 2001 From: Anton Thomasson Date: Mon, 18 Jul 2022 22:27:39 +0200 Subject: [PATCH] Add optional job-id to prioritized/sorted operation attributes Some printers are really picky... --- src/ippmsg.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ippmsg.cpp b/src/ippmsg.cpp index 7bce38a..19a5320 100644 --- a/src/ippmsg.cpp +++ b/src/ippmsg.cpp @@ -319,11 +319,15 @@ Bytestream IppMsg::encode() QStringList InitialAttrs = {"attributes-charset", "attributes-natural-language", "printer-uri", + "job-id", "requesting-user-name"}; for(QString key : InitialAttrs) { - QJsonObject val = _opAttrs.take(key).toObject(); - encode_attr(ipp, val["tag"].toInt(), key, val["value"]); + if(_opAttrs.find(key) != _opAttrs.end()) + { + QJsonObject val = _opAttrs.take(key).toObject(); + encode_attr(ipp, val["tag"].toInt(), key, val["value"]); + } } for(QJsonObject::iterator it = _opAttrs.begin(); it != _opAttrs.end(); it++) { // encode any remaining op-attrs