| 5752 | */ |
| 5753 | |
| 5754 | static void |
| 5755 | process_attr_message( |
| 5756 | ippeve_job_t *job, /* I - Job */ |
| 5757 | char *message) /* I - Message */ |
| 5758 | { |
| 5759 | int i, /* Looping var */ |
| 5760 | num_options = 0; /* Number of name=value pairs */ |
| 5761 | cups_option_t *options = NULL, /* name=value pairs from message */ |
| 5762 | *option; /* Current option */ |
| 5763 | ipp_attribute_t *attr; /* Current attribute */ |
| 5764 | |
| 5765 | |
| 5766 | /* |
| 5767 | * Grab attributes from the message line... |
| 5768 | */ |
| 5769 | |
| 5770 | num_options = cupsParseOptions(message + 5, num_options, &options); |
| 5771 | |
| 5772 | /* |
| 5773 | * Loop through the options and record them in the printer or job objects... |
| 5774 | */ |
| 5775 | |
| 5776 | for (i = num_options, option = options; i > 0; i --, option ++) |
| 5777 | { |
| 5778 | if (!strcmp(option->name, "job-impressions")) |
| 5779 | { |
| 5780 | /* |
| 5781 | * Update job-impressions attribute... |
| 5782 | */ |
| 5783 | |
| 5784 | job->impressions = atoi(option->value); |
| 5785 | } |
| 5786 | else if (!strcmp(option->name, "job-impressions-completed")) |
| 5787 | { |
| 5788 | /* |
| 5789 | * Update job-impressions-completed attribute... |
| 5790 | */ |
| 5791 | |
| 5792 | job->impcompleted = atoi(option->value); |
| 5793 | } |
| 5794 | else if (!strncmp(option->name, "marker-", 7) || !strcmp(option->name, "printer-alert") || !strcmp(option->name, "printer-alert-description") || !strcmp(option->name, "printer-supply") || !strcmp(option->name, "printer-supply-description")) |
| 5795 | { |
| 5796 | /* |
| 5797 | * Update Printer Status attribute... |
| 5798 | */ |
| 5799 | |
| 5800 | _cupsRWLockWrite(&job->printer->rwlock); |
| 5801 | |
| 5802 | if ((attr = ippFindAttribute(job->printer->attrs, option->name, IPP_TAG_ZERO)) != NULL) |
| 5803 | ippDeleteAttribute(job->printer->attrs, attr); |
| 5804 | |
| 5805 | cupsEncodeOption(job->printer->attrs, IPP_TAG_PRINTER, option->name, option->value); |
| 5806 | |
| 5807 | _cupsRWUnlock(&job->printer->rwlock); |
| 5808 | } |
| 5809 | else |
| 5810 | { |
| 5811 | /* |
no test coverage detected