1 The "growl.ss" Module
growl%
notify
subscribe-notify
unsubscribe-notify
close
2 License
Version: 4.1.1

Growl

1 The "growl.ss" Module

 (require (planet "growl.ss" ("murphy" "growl.plt" 1 2)))

This library provides a simple interface to the UDP protocol for Growl notifications.

growl% : class?

  superclass: object%

A notification center class. When the class is instantiated, it registers the application with the Growl server.

(new growl%

 

[name name]

 

 

 

[notifications notifications]

 

 

 [

[hostname hostname]

 

 

 

[port-no port-no]

 

 

 

[log-sync-timeout log-sync-timeout]])

 

  (is-a?/c growl%)

  name : string?

  

notifications

 

:

 

(listof (or/c (list/c symbol? string? any/c)

              (list/c symbol? string?)))

  hostname : string? = "localhost"

  port-no : (integer-in 1 65535) = 9887

  log-sync-timeout : positive-number? = 30

Creates a notification center for the application called name and connects to the Growl server running on hostname:port-no.

If necessary, the notification center will check at least every log-sync-timeout seconds whether its subscriptions to loggers have changed.

The possible notifications that can be posted by the application are specified as an association list. Each element of the list has the form (id type [default? #t]). The id is used in calls to notify to reference the notification while the type is the string that will appear in the configuration interface of Growl to describe this notification type. default? indicates whether the notification type should be enabled by default.

name and notifications are accessible as fields of the new object.

(send a-growl notify

 

id

 

 

 

 

 

 [

#:title title]

 

 

 

 

 

 

#:description description

 

 

 

 

 

 [

#:priority priority

 

 

 

 

 

 

#:sticky sticky?])

 

 

void?

  id : symbol?

  title : string? = name

  description : string?

  priority : (integer-in -2 2) = 0

  sticky? : any/c = #f

Sends a notification to the Growl server. The type of notification to send is specified by the given id.

The title of the notification defaults to the name of the application. The description message has to be specified.

Optionally you can specify a priority hint for the message and a sticky? flag hinting that the message should be displayed until dismissed by the user. The effect of these options depends on the display style used by the Growl server.

(send a-growl subscribe-notify

 

logger

 

 

 

 

 

 

level

 

 

 

 

 

 

id

 

 

 

 

 

 [

#:title title

 

 

 

 

 

 

#:sticky sticky?])

 

 

void?

  logger : logger?

  level : (one-of/c 'fatal 'error 'warning 'info 'debug)

  id : symbol?

  title : string? = name

  sticky? : any/c = #f

Subscribes to log messages from logger with a level equal to level and above. Whenever such a log message comes in, a notification with the given id, title and sticky? flag is sent to the Growl server. These arguments have the same meaning as for notify.

The description message of the notification is taken from the log event. The priority hint is determined by the log level: debug level maps to priority -1, warning level to 1, error and fatal level to 2. Any other log level maps to priority 0.

Before the first log message from the newly registered logger is processed, up to log-sync-timeout seconds may pass.

(send a-growl unsubscribe-notify logger)  void?

  logger : logger?

Unsubscribes from log messages from logger.

Within up to log-sync-timeout seconds after this method call, messages from the unregistered logger may still be processed.

(send a-growl close)  void?

Closes the UDP socket associated with this object and stops watching any loggers it has subscribed to. No further notifications can be sent using this object.

2 License

Copyright (c) 2008 by Thomas Chust <chust@web.de>.

This package is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You can find a copy of the GNU Lesser General Public License at http://www.gnu.org/licenses/lgpl-3.0.html.