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 PropertyChangeListeneridChangeListenerprotected org.jivesoftware.smackx.muc.InvitationListenerinviteListenerstatic StringJID_RESOURCEprotected org.jivesoftware.smackx.muc.UserStatusListenerkickListenerstatic StringOWNERprotected JabberPlayer.ManagerplayerMgrprotected SimpleStatusControlsInitializerplayerStatusControlsprotected PrivateChatEncoderprivateChatEncoderstatic StringROOM_CONFIGstatic StringROOM_JIDstatic StringROOM_NAMEprotected RoomInteractionControlsInitializerroomControlsprotected JabberRoom.ManagerroomMgrprotected SoundEncodersoundEncoderprotected org.jivesoftware.smackx.muc.ParticipantStatusListeneruserListenerFields inherited from interface VASSAL.chat.ChatServerConnection
AVAILABLE_ROOMS, DEFAULT_ROOM_NAME, INCOMING_MSG, PLAYER_INFO, ROOM, STATUS, STATUS_SERVERFields 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 voidaddPropertyChangeListener(PropertyChangeListener l)voidaddPropertyChangeListener(String propertyName, PropertyChangeListener l)Register a PropertyChangeListener.protected StringdecodeMessage(String encodedMessage)Encode text encoded by encodeMessagevoiddoInvite(String playerId, String roomName)Process an invitationvoiddoKick(Player kickee)Kick a player from this roomprotected StringencodeMessage(String clearText)Messages must be encoded to pass through Jabber: 1.protected voidfireRoomsUpdated()protected voidfireStatus(String msg)Room[]getAvailableRooms()Return an array of all rooms on the serverStringgetConferenceService()org.jivesoftware.smack.XMPPConnectiongetConnection()LockableRoomgetCurrentRoom()StringgetCurrentRoomJID()StringgetDefaultRoomName()Return the name of the default roomCommandEncodergetEncoder()ServerStatus.ModuleSummary[]getHistory(String timeRange)StringgetHost()MessageBoardgetMessageServer()StringgetModule()RoomgetRoom()Return the room currently occupied by the playerJabberRoomgetRoomByName(String name)ServerStatus.ModuleSummary[]getStatus()Return the current connections to the serverServerStatusgetStatusServer()String[]getSupportedTimeRanges()PlayergetUserInfo()Return a Player instance representing the current playervoidinitializeControls(ChatServerControls controls)Register all event listenersbooleanisConnected()booleanisDefaultRoom(Room r)Is specified room the default room?booleanisInvitable(Player invitee)Can a player be invited to this room?booleanisKickable(Player kickee)Is a player kickable from this room?voidlockRoom(LockableRoom r)Toggle the lock state on the room.static voidmain(String[] args)StringplayerToString(Player p)voidprocessPacket(org.jivesoftware.smack.packet.Packet packet)voidprocessServerMessage(String subject, String message)voidsendInvite(Player invitee)Send invitation to playervoidsendTo(Player recipient, Command c)Send a Command to a particular playervoidsendToOthers(Command c)Send a command to other players on the servervoidsetConnected(boolean connect)voidsetEncoder(CommandEncoder encoder)voidsetRoom(String roomName)voidsetRoom(Room r)Join the given roomvoidsetUserInfo(Player p)Set the Player instance representing this playerPlayerstringToPlayer(String s)static StringtestConnection(String host, String port, String login, String passwd)static StringunescapeNode(String node)voiduninitializeControls(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:ServerConnectionRegister a PropertyChangeListener. Changes to connection status triggers a PropertyChangeEvent, and concrete implementations may define other properties- Specified by:
addPropertyChangeListenerin interfaceServerConnection
-
addPropertyChangeListener
-
isConnected
public boolean isConnected()- Specified by:
isConnectedin interfaceServerConnection
-
sendToOthers
Description copied from interface:ServerConnectionSend a command to other players on the server- Specified by:
sendToOthersin interfaceServerConnection
-
setConnected
public void setConnected(boolean connect)- Specified by:
setConnectedin interfaceServerConnection
-
initializeControls
Description copied from interface:ChatControlsInitializerRegister all event listeners- Specified by:
initializeControlsin interfaceChatControlsInitializer
-
uninitializeControls
Description copied from interface:ChatControlsInitializerRemove all previously-registered event listeners- Specified by:
uninitializeControlsin interfaceChatControlsInitializer
-
processPacket
public void processPacket(org.jivesoftware.smack.packet.Packet packet)- Specified by:
processPacketin interfaceorg.jivesoftware.smack.PacketListener
-
processServerMessage
-
getRoom
Description copied from interface:ChatServerConnectionReturn the room currently occupied by the player- Specified by:
getRoomin interfaceChatServerConnection
-
getRoomByName
-
getCurrentRoomJID
-
getCurrentRoom
-
setRoom
-
setRoom
Description copied from interface:ChatServerConnectionJoin the given room- Specified by:
setRoomin interfaceChatServerConnection
-
getAvailableRooms
Description copied from interface:ChatServerConnectionReturn an array of all rooms on the server- Specified by:
getAvailableRoomsin interfaceChatServerConnection
-
fireRoomsUpdated
protected void fireRoomsUpdated() -
fireStatus
-
getUserInfo
Description copied from interface:ChatServerConnectionReturn a Player instance representing the current player- Specified by:
getUserInfoin interfaceChatServerConnection
-
setUserInfo
Description copied from interface:ChatServerConnectionSet the Player instance representing this player- Specified by:
setUserInfoin interfaceChatServerConnection
-
getDefaultRoomName
Description copied from interface:LockableChatServerConnectionReturn the name of the default room- Specified by:
getDefaultRoomNamein interfaceLockableChatServerConnection
-
isDefaultRoom
Description copied from interface:LockableChatServerConnectionIs specified room the default room?- Specified by:
isDefaultRoomin interfaceLockableChatServerConnection
-
sendTo
Description copied from interface:ChatServerConnectionSend a Command to a particular player- Specified by:
sendToin interfaceChatServerConnection
-
isInvitable
Can a player be invited to this room?- Specified by:
isInvitablein interfaceLockableChatServerConnection
-
sendInvite
Send invitation to player- Specified by:
sendInvitein interfaceLockableChatServerConnection
-
doInvite
Process an invitation- Specified by:
doInvitein interfaceLockableChatServerConnection
-
isKickable
Is a player kickable from this room?- Specified by:
isKickablein interfaceLockableChatServerConnection
-
doKick
Kick a player from this room- Specified by:
doKickin 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:
lockRoomin interfaceLockableChatServerConnection
-
getEncoder
-
setEncoder
-
getHistory
- Specified by:
getHistoryin interfaceServerStatus- Returns:
- the connections to the server within
timemilliseconds of the current time
-
getStatus
Description copied from interface:ServerStatusReturn the current connections to the server- Specified by:
getStatusin interfaceServerStatus
-
getSupportedTimeRanges
- Specified by:
getSupportedTimeRangesin interfaceServerStatus
-
main
-
getHost
-
playerToString
- Specified by:
playerToStringin interfacePlayerEncoder
-
stringToPlayer
- Specified by:
stringToPlayerin interfacePlayerEncoder
-
testConnection
-