[cups.development] notifiers and subscriptions

Michael Sweet mike at easysw.com
Wed Jun 21 06:38:05 PDT 2006


Jerome Alet wrote:
> Hello,
> 
> I'd like to play a bit with notifications and subscriptions.
> 
> However, from reading CUPS (1.2) source code, it's not clear to me
> if CUPS automatically detects new notifiers, and if one can
> be added dynamically (if possible) besides the 'mailto' notifier,
> or if restarting and/or recompiling CUPS is the only way. 

Right now the subscription code allows you to create a subscription
with any notify-recipient; it uses the scheme portion of the URI
to determine which notifier to run in the /usr/lib/cups/notifier
directory.

> Also with regard to subscriptions, the documentation is not very 
> clear about what can be done and if the actual behavior can  
> be extended in some way without recompiling CUPS or not.

We implement the IPP notification spec with additional event
names, which are documented in the IPP implementation help file:

     http://www.cups.org/documentation.php/spec-ipp.html

> For example I'd like to have notifications be sent in a machine 
> readable format, as opposed to plain text which probably vary 
> depending on the user's locale settings. 
> 
> In particular I'm interested in having a program of mine receive 
> notifications whenever a printer is deleted or added. 
> 
> I can do this easily using the mailto notifier and a script of mine 
> launched from /etc/aliases. However the input format and the 
> messages' contents is not clearly defined. 

Um, actually, it *is* defined in the PWG mailto spec, which you'll
find in the CUPS subversion repo as well as on the PWG FTP server.
(search the PWG mailing list archives for the non-technical reason
  why mailto was not ratified...)

That said...

> Having a way for CUPS to send notifications like :
> 
> --- CUT ---
> DELPRINTER printername
> --- CUT ---
> 
> or 
> 
> --- CUT ---
> ADDPRINTER printername
> --- CUT ---
> 
> or even 
> 
> --- CUT ---
> <?xml version="1.0" encoding="UTF-8"?>
> <notification>
>   <action type="delete">
>     <printer>HP2100</printer>
>     ...
>   </action>
> </notification>
> --- CUT ---
> 
> would greatly simplify things (from end users' point of view), IMHO.
> 
> The current CUPS notification system seems to be directed
> exclusively towards human beings. Am I right ?

No.

> Could such things be done now ? In the future ? 

Such things can be done now.  Look in the notifier directory of the
CUPS sources - the "testnotifier.c" program can be used as the basis
for your own notifier.

I would also recommend reading the links I provided as well as
chapter 19 of the current CUPS book, which explains how notifiers
work and breaks down the current mailto notifier...

-- 
______________________________________________________________________
Michael Sweet, Easy Software Products           mike at easysw dot com
Internet Printing and Document Software          http://www.easysw.com




More information about the cups mailing list