public class MessageManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
IRC_PROTOCOL_MAX_MESSAGE_SIZE
Maximum message size for IRC messages given the spec specifies a buffer
of 512 bytes.
|
static int |
SAFETY_NET
Safety net of 5 bytes to use as extra slack to prevent off-by-one
failures.
|
Constructor and Description |
---|
MessageManager(IrcConnection connection,
com.ircclouds.irc.api.IRCApi irc,
com.ircclouds.irc.api.state.IIRCState connectionState,
ProtocolProviderServiceIrcImpl provider,
IdentityManager identity)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
calculateMaximumMessageSize(ChatRoomIrcImpl room)
Calculate maximum message size that can be transmitted.
|
int |
calculateMaximumMessageSize(Contact contact)
Calculate maximum message size that can be transmitted.
|
void |
command(ChatRoomIrcImpl chatroom,
java.lang.String message)
Send a command to the IRC server.
|
void |
command(Contact contact,
MessageIrcImpl message)
Send a command to the IRC server.
|
void |
message(ChatRoomIrcImpl chatroom,
java.lang.String message)
Send an IRC message.
|
void |
message(Contact contact,
Message message)
Send an IRC message.
|
public static final int SAFETY_NET
public static final int IRC_PROTOCOL_MAX_MESSAGE_SIZE
public MessageManager(IrcConnection connection, com.ircclouds.irc.api.IRCApi irc, com.ircclouds.irc.api.state.IIRCState connectionState, ProtocolProviderServiceIrcImpl provider, IdentityManager identity)
connection
- IrcConnection instanceirc
- thread-safe IRCApi instanceconnectionState
- the connection stateprovider
- the provider instanceidentity
- the identity managerpublic void command(ChatRoomIrcImpl chatroom, java.lang.String message) throws UnsupportedCommandException, BadCommandException, BadCommandInvocationException
chatroom
- the chat roommessage
- the command messageUnsupportedCommandException
- for unknown or unsupported commandsBadCommandException
- in case of incompatible command or bad
implementationBadCommandInvocationException
- in case of bad usage of the
command. An exception will be thrown that contains the root
cause and optionally a help text containing usage information
for that particular command.public void command(Contact contact, MessageIrcImpl message) throws UnsupportedCommandException, BadCommandException, BadCommandInvocationException
contact
- the chat roommessage
- the command messageUnsupportedCommandException
- for unknown or unsupported commandsBadCommandException
- in case of a bad command implementationBadCommandInvocationException
- in case of bad usage of the
command. An exception will be thrown that contains the root
cause and optionally a help text containing usage information
for that particular command.public void message(ChatRoomIrcImpl chatroom, java.lang.String message) throws OperationFailedException
chatroom
- The chat room to send the message to.message
- The message to send.OperationFailedException
- OperationFailedException is thrown when
message is too large to be processed by IRC server.public void message(Contact contact, Message message) throws OperationFailedException
contact
- The contact to send the message to.message
- The message to send.OperationFailedException
- OperationFailedException is thrown when
message is too large to be processed by IRC server.public int calculateMaximumMessageSize(Contact contact)
contact
- receiving contactpublic int calculateMaximumMessageSize(ChatRoomIrcImpl room)
room
- receiving chat room
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.