Package VASSAL.chat.jabber
Class JabberClient
java.lang.Object
VASSAL.chat.jabber.JabberClient
- All Implemented Interfaces:
org.jivesoftware.smack.PacketListener
,ServerConnection
,ChatServerConnection
,LockableChatServerConnection
,PlayerEncoder
,ServerStatus
,ChatControlsInitializer
public class JabberClient extends Object implements LockableChatServerConnection, org.jivesoftware.smack.PacketListener, ServerStatus, ChatControlsInitializer, PlayerEncoder
-
Nested Class Summary
Nested classes/interfaces inherited from interface VASSAL.chat.ServerStatus
ServerStatus.ModuleSummary
-
Field Summary
Fields Modifier and Type Field Description protected PropertyChangeListener
idChangeListener
protected org.jivesoftware.smackx.muc.InvitationListener
inviteListener
static String
JID_RESOURCE
protected org.jivesoftware.smackx.muc.UserStatusListener
kickListener
static String
OWNER
protected JabberPlayer.Manager
playerMgr
protected SimpleStatusControlsInitializer
playerStatusControls
protected PrivateChatEncoder
privateChatEncoder
static String
ROOM_CONFIG
static String
ROOM_JID
static String
ROOM_NAME
protected RoomInteractionControlsInitializer
roomControls
protected JabberRoom.Manager
roomMgr
protected SoundEncoder
soundEncoder
protected org.jivesoftware.smackx.muc.ParticipantStatusListener
userListener
Fields inherited from interface VASSAL.chat.ChatServerConnection
AVAILABLE_ROOMS, DEFAULT_ROOM_NAME, INCOMING_MSG, PLAYER_INFO, ROOM, STATUS, STATUS_SERVER
Fields inherited from interface VASSAL.build.module.ServerConnection
CONNECTED
-
Constructor Summary
Constructors Constructor Description JabberClient(CommandEncoder encoder, String host, int port, AccountInfo account)
-
Method Summary
Modifier and Type Method Description void
addPropertyChangeListener(PropertyChangeListener l)
void
addPropertyChangeListener(String propertyName, PropertyChangeListener l)
Register a PropertyChangeListener.protected String
decodeMessage(String encodedMessage)
Encode text encoded by encodeMessagevoid
doInvite(String playerId, String roomName)
Process an invitationvoid
doKick(Player kickee)
Kick a player from this roomprotected String
encodeMessage(String clearText)
Messages must be encoded to pass through Jabber: 1.protected void
fireRoomsUpdated()
protected void
fireStatus(String msg)
Room[]
getAvailableRooms()
Return an array of all rooms on the serverString
getConferenceService()
org.jivesoftware.smack.XMPPConnection
getConnection()
LockableRoom
getCurrentRoom()
String
getCurrentRoomJID()
String
getDefaultRoomName()
Return the name of the default roomCommandEncoder
getEncoder()
ServerStatus.ModuleSummary[]
getHistory(String timeRange)
String
getHost()
MessageBoard
getMessageServer()
String
getModule()
Room
getRoom()
Return the room currently occupied by the playerJabberRoom
getRoomByName(String name)
ServerStatus.ModuleSummary[]
getStatus()
Return the current connections to the serverServerStatus
getStatusServer()
String[]
getSupportedTimeRanges()
Player
getUserInfo()
Return a Player instance representing the current playervoid
initializeControls(ChatServerControls controls)
Register all event listenersboolean
isConnected()
boolean
isDefaultRoom(Room r)
Is specified room the default room?boolean
isInvitable(Player invitee)
Can a player be invited to this room?boolean
isKickable(Player kickee)
Is a player kickable from this room?void
lockRoom(LockableRoom r)
Toggle the lock state on the room.static void
main(String[] args)
String
playerToString(Player p)
void
processPacket(org.jivesoftware.smack.packet.Packet packet)
void
processServerMessage(String subject, String message)
void
sendInvite(Player invitee)
Send invitation to playervoid
sendTo(Player recipient, Command c)
Send a Command to a particular playervoid
sendToOthers(Command c)
Send a command to other players on the servervoid
setConnected(boolean connect)
void
setEncoder(CommandEncoder encoder)
void
setRoom(String roomName)
void
setRoom(Room r)
Join the given roomvoid
setUserInfo(Player p)
Set the Player instance representing this playerPlayer
stringToPlayer(String s)
static String
testConnection(String host, String port, String login, String passwd)
static String
unescapeNode(String node)
void
uninitializeControls(ChatServerControls controls)
Remove all previously-registered event listeners
-
Field Details
-
JID_RESOURCE
- See Also:
- Constant Field Values
-
ROOM_CONFIG
- See Also:
- Constant Field Values
-
ROOM_JID
- See Also:
- Constant Field Values
-
ROOM_NAME
- See Also:
- Constant Field Values
-
OWNER
- See Also:
- Constant Field Values
-
soundEncoder
-
privateChatEncoder
-
roomControls
-
playerStatusControls
-
playerMgr
-
roomMgr
-
idChangeListener
-
kickListener
protected org.jivesoftware.smackx.muc.UserStatusListener kickListener -
inviteListener
protected org.jivesoftware.smackx.muc.InvitationListener inviteListener -
userListener
protected org.jivesoftware.smackx.muc.ParticipantStatusListener userListener
-
-
Constructor Details
-
JabberClient
-
-
Method Details
-
addPropertyChangeListener
Description copied from interface:ServerConnection
Register a PropertyChangeListener. Changes to connection status triggers a PropertyChangeEvent, and concrete implementations may define other properties- Specified by:
addPropertyChangeListener
in interfaceServerConnection
-
addPropertyChangeListener
-
isConnected
public boolean isConnected()- Specified by:
isConnected
in interfaceServerConnection
-
sendToOthers
Description copied from interface:ServerConnection
Send a command to other players on the server- Specified by:
sendToOthers
in interfaceServerConnection
-
setConnected
public void setConnected(boolean connect)- Specified by:
setConnected
in interfaceServerConnection
-
initializeControls
Description copied from interface:ChatControlsInitializer
Register all event listeners- Specified by:
initializeControls
in interfaceChatControlsInitializer
-
uninitializeControls
Description copied from interface:ChatControlsInitializer
Remove all previously-registered event listeners- Specified by:
uninitializeControls
in interfaceChatControlsInitializer
-
processPacket
public void processPacket(org.jivesoftware.smack.packet.Packet packet)- Specified by:
processPacket
in interfaceorg.jivesoftware.smack.PacketListener
-
processServerMessage
-
getRoom
Description copied from interface:ChatServerConnection
Return the room currently occupied by the player- Specified by:
getRoom
in interfaceChatServerConnection
-
getRoomByName
-
getCurrentRoomJID
-
getCurrentRoom
-
setRoom
-
setRoom
Description copied from interface:ChatServerConnection
Join the given room- Specified by:
setRoom
in interfaceChatServerConnection
-
getAvailableRooms
Description copied from interface:ChatServerConnection
Return an array of all rooms on the server- Specified by:
getAvailableRooms
in interfaceChatServerConnection
-
fireRoomsUpdated
protected void fireRoomsUpdated() -
fireStatus
-
getUserInfo
Description copied from interface:ChatServerConnection
Return a Player instance representing the current player- Specified by:
getUserInfo
in interfaceChatServerConnection
-
setUserInfo
Description copied from interface:ChatServerConnection
Set the Player instance representing this player- Specified by:
setUserInfo
in interfaceChatServerConnection
-
getDefaultRoomName
Description copied from interface:LockableChatServerConnection
Return the name of the default room- Specified by:
getDefaultRoomName
in interfaceLockableChatServerConnection
-
isDefaultRoom
Description copied from interface:LockableChatServerConnection
Is specified room the default room?- Specified by:
isDefaultRoom
in interfaceLockableChatServerConnection
-
sendTo
Description copied from interface:ChatServerConnection
Send a Command to a particular player- Specified by:
sendTo
in interfaceChatServerConnection
-
isInvitable
Can a player be invited to this room?- Specified by:
isInvitable
in interfaceLockableChatServerConnection
-
sendInvite
Send invitation to player- Specified by:
sendInvite
in interfaceLockableChatServerConnection
-
doInvite
Process an invitation- Specified by:
doInvite
in interfaceLockableChatServerConnection
-
isKickable
Is a player kickable from this room?- Specified by:
isKickable
in interfaceLockableChatServerConnection
-
doKick
Kick a player from this room- Specified by:
doKick
in interfaceLockableChatServerConnection
-
getMessageServer
-
getStatusServer
-
getConnection
public org.jivesoftware.smack.XMPPConnection getConnection() -
getModule
-
getConferenceService
-
unescapeNode
-
encodeMessage
Messages must be encoded to pass through Jabber: 1. To remove Escape characters (Vassal sub-command separator) 2. To hide the raw Vassal commands from observers on the chat room using a Jabber Client.- Parameters:
clearText
-- Returns:
- encoded text
-
decodeMessage
Encode text encoded by encodeMessage- Parameters:
encodedMessage
-- Returns:
- decoded text
-
lockRoom
Toggle the lock state on the room.- Specified by:
lockRoom
in interfaceLockableChatServerConnection
-
getEncoder
-
setEncoder
-
getHistory
- Specified by:
getHistory
in interfaceServerStatus
- Returns:
- the connections to the server within
time
milliseconds of the current time
-
getStatus
Description copied from interface:ServerStatus
Return the current connections to the server- Specified by:
getStatus
in interfaceServerStatus
-
getSupportedTimeRanges
- Specified by:
getSupportedTimeRanges
in interfaceServerStatus
-
main
-
getHost
-
playerToString
- Specified by:
playerToString
in interfacePlayerEncoder
-
stringToPlayer
- Specified by:
stringToPlayer
in interfacePlayerEncoder
-
testConnection
-