Ambrosio: notifications

The Ambrosio::Plugins::NotificationGateway plugin allows local scripts or applications to sent small notes to one or more JIDs.

To send a notification, the script or application writes a small file in a specific directory. The file has a format very similar to mail messages. You need to write some headers (only one is mandatory), a blank line and then the message to be sent.

The directory is configured with the queue parameter to the new() method. The default is /tmp/ambrosio_notifications. You must write in the incoming subdirectory of the queue.

Here is an example of a message, with all the headers present.

To: jid1@domain.org
To: jid2@domain.org
Subject: Disk free
Charset: iso-8859-9

The disk /home is almost full (98%, 212.12Mb free)

The To header can appear several times. The message will be sent to all the JIDs. The Subject header is optional. If missing, the message type will be chat. The Charset is also optional, and specifies the charset of the message body. By default assumes iso-8859-1.

After the message is sent, it's stored into QUEUE/archive.

Future version of the plugin will cleanup that directory from time to time. Also, there will be a small module (probable Ambrosio::Notification) that will hide all this details from you.