public class PresenceSubscribeHandler extends BasicModule implements ChannelHandler<org.xmpp.packet.Presence>
The handler must properly detect the presence type, update the user's roster, and inform presence subscribers of the session's updated presence status. Presence serves many purposes in Jabber so this handler will likely be the most complex of all handlers in the server.
There are four basic types of presence updates:
Modifier and Type | Class and Description |
---|---|
static class |
PresenceSubscribeHandler.Change
Indicate a state change.
|
Constructor and Description |
---|
PresenceSubscribeHandler() |
Modifier and Type | Method and Description |
---|---|
static PresenceSubscribeHandler.Change |
getStateChange(RosterItem.SubType itemSubType,
org.xmpp.packet.Presence.Type action,
boolean isSending)
Determine the changes to apply to the item, according to its subscription state.
|
void |
initialize(XMPPServer server)
Initializes the basic module.
|
void |
process(org.xmpp.packet.Presence presence)
Process an XMPP packet.
|
destroy, getName, start, stop
public void process(org.xmpp.packet.Presence presence) throws PacketException
ChannelHandler
process
in interface ChannelHandler<org.xmpp.packet.Presence>
presence
- a packet to process.PacketException
- thrown if the packet is malformed (results in the sender's
session being shutdown).public static PresenceSubscribeHandler.Change getStateChange(RosterItem.SubType itemSubType, org.xmpp.packet.Presence.Type action, boolean isSending)
itemSubType
- The item to be updatedaction
- The new state change requestisSending
- True if the roster owner of the item is sending the new state change requestpublic void initialize(XMPPServer server)
BasicModule
Initializes the basic module.
Inheriting classes that choose to override this method MUST call this initialize() method before accessing BasicModule resources.
initialize
in interface Module
initialize
in class BasicModule
server
- the server hosting this module.Copyright © 2003-2008 Jive Software.