Add lpoptions support and destination/job improvements - #22
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1.
fix(destination): free the options cupsCopyDestInfo actually allocatedget_detailed_infoandis_option_supportedfreed the options pointer theybuilt before calling
cupsCopyDestInfo, but that call can reallocate theoptions array internally. Free what the struct points to afterward instead.
2.
feat(destination): read and write default and per-destination lpoptionsAdds
Destinations::named_destination,default_destination_name,set_destination_option, andclear_default_destination. The default-namelookup follows libcups' own precedence (
$LPDEST/$PRINTER, user lpoptions,system lpoptions, scheduler default) via
cupsGetNamedDestrather thanreading files directly, so it stays correct on a machine with different CUPS
directories.
3.
refactor(job): keep a job's own destination instead of re-resolving it by nameJobnow owns theDestinationit was created from instead of storing itsname and re-resolving it on every operation. This also removes a separate
is_accepting_jobs()pre-check that raced against the real state — CUPS'sown
server-error-not-accepting-jobsresponse is now mapped toError::PrinterNotAcceptingdirectly.