Description

The Jabber plugin enables the usage of the XMPP protocol to communicate with Jabber servers. Relies on the Xmlrpc Plugin and the Smack/Smackx libraries.

Installation

The current version of griffon-jabber-plugin is 0.5
To install just issue the following command

griffon install-plugin jabber

Usage

The plugin will inject the following dynamic methods:

Where params may contain

Property

Type

Required

Notes

serviceName

String

(tick)

 

host

String

(tick)

 

port

int

(tick)

 

username

String

(tick)

 

password

String

(tick)

 

proxy

Map

(error)

the following properties may be specified
type: String. Any of HTTP, SOCKS4, SOCKS5 or NONE. Defaults to HTTP
host: String.
port: int. Defaults to 80
username: String. Default is empty.
password: String. Default is empty.

Any additional params will be set on org.jivesoftware.smack.ConnectionConfiguration directly.

A new method is added to XMPPConnection in order to establish a chat session and send messages

If you wish to listen for incoming messages then you'll need to add a closure property (or a method) with the following signature on the instance that established the Jabber connection

def onJabberMessage = { msg -> ... }
// or as a method
void onJabberMessage(msg) { ... }

The type of the msg argument is org.jivesoftware.smack.packet.Message

Examples

Connecting to Gtalk

class GtalkController {
   def model
   private conn

   def connect = { evt = null ->
      conn = jabberConnect(host: "talk.google.com", port: 5222i,
                           serviceName: "gmail.com",
                           username: model.username,
                           password: model.password)
   }

   def sendMessage = { evt = null ->
      conn.chatWith(model.participant, model.message)
   }

   def onJabberMessage = { msg ->
       model.chatText = "${msg.from} said: '${msg.body}'"
   }
}

Configuration

Dynamic method injection

Dynamic methods will be added to controllers by default. You can change this setting by adding a configuration flag in Config.groovy

griffon.jabber.injectInto = ["controller", "service"]

History

Version

Date

Notes

0.5

12-21-10

Release sync with Griffon 0.9.2

0.4.1

11-08-10

Fix a metaclass problem when injecting dynamic methods

0.4

10-27-10

Release sync with Griffon 0.9.1

0.3

07-22-10

Release sync with Griffon 0.9

0.2

03-01-10

Upgraded to Griffon 0.3

0.1

10-26-09

Initial release