Jitsi: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.impl.protocol.irc
Class IrcStack

java.lang.Object
  extended by org.jibble.pircbot.PircBot
      extended by net.java.sip.communicator.impl.protocol.irc.IrcStack
All Implemented Interfaces:
org.jibble.pircbot.ReplyConstants

public class IrcStack
extends org.jibble.pircbot.PircBot

An implementation of the PircBot IRC stack.

Author:
Stephane Remy, Loic Kempf, Yana Stamcheva

Field Summary
 
Fields inherited from class org.jibble.pircbot.PircBot
VERSION
 
Fields inherited from interface org.jibble.pircbot.ReplyConstants
ERR_ALREADYREGISTRED, ERR_BADCHANMASK, ERR_BADCHANNELKEY, ERR_BANNEDFROMCHAN, ERR_CANNOTSENDTOCHAN, ERR_CANTKILLSERVER, ERR_CHANNELISFULL, ERR_CHANOPRIVSNEEDED, ERR_ERRONEUSNICKNAME, ERR_FILEERROR, ERR_INVITEONLYCHAN, ERR_KEYSET, ERR_NEEDMOREPARAMS, ERR_NICKCOLLISION, ERR_NICKNAMEINUSE, ERR_NOADMININFO, ERR_NOLOGIN, ERR_NOMOTD, ERR_NONICKNAMEGIVEN, ERR_NOOPERHOST, ERR_NOORIGIN, ERR_NOPERMFORHOST, ERR_NOPRIVILEGES, ERR_NORECIPIENT, ERR_NOSERVICEHOST, ERR_NOSUCHCHANNEL, ERR_NOSUCHNICK, ERR_NOSUCHSERVER, ERR_NOTEXTTOSEND, ERR_NOTONCHANNEL, ERR_NOTOPLEVEL, ERR_NOTREGISTERED, ERR_PASSWDMISMATCH, ERR_SUMMONDISABLED, ERR_TOOMANYCHANNELS, ERR_TOOMANYTARGETS, ERR_UMODEUNKNOWNFLAG, ERR_UNKNOWNCOMMAND, ERR_UNKNOWNMODE, ERR_USERNOTINCHANNEL, ERR_USERONCHANNEL, ERR_USERSDISABLED, ERR_USERSDONTMATCH, ERR_WASNOSUCHNICK, ERR_WILDTOPLEVEL, ERR_YOUREBANNEDCREEP, ERR_YOUWILLBEBANNED, RPL_ADMINEMAIL, RPL_ADMINLOC1, RPL_ADMINLOC2, RPL_ADMINME, RPL_AWAY, RPL_BANLIST, RPL_CHANNELMODEIS, RPL_CLOSEEND, RPL_CLOSING, RPL_ENDOFBANLIST, RPL_ENDOFINFO, RPL_ENDOFLINKS, RPL_ENDOFMOTD, RPL_ENDOFNAMES, RPL_ENDOFSERVICES, RPL_ENDOFSTATS, RPL_ENDOFUSERS, RPL_ENDOFWHO, RPL_ENDOFWHOIS, RPL_ENDOFWHOWAS, RPL_INFO, RPL_INFOSTART, RPL_INVITING, RPL_ISON, RPL_KILLDONE, RPL_LINKS, RPL_LIST, RPL_LISTEND, RPL_LISTSTART, RPL_LUSERCHANNELS, RPL_LUSERCLIENT, RPL_LUSERME, RPL_LUSEROP, RPL_LUSERUNKNOWN, RPL_MOTD, RPL_MOTDSTART, RPL_MYPORTIS, RPL_NAMREPLY, RPL_NONE, RPL_NOTOPIC, RPL_NOUSERS, RPL_NOWAWAY, RPL_REHASHING, RPL_SERVICE, RPL_SERVICEINFO, RPL_SERVLIST, RPL_SERVLISTEND, RPL_STATSCLINE, RPL_STATSCOMMANDS, RPL_STATSHLINE, RPL_STATSILINE, RPL_STATSKLINE, RPL_STATSLINKINFO, RPL_STATSLLINE, RPL_STATSNLINE, RPL_STATSOLINE, RPL_STATSQLINE, RPL_STATSUPTIME, RPL_STATSYLINE, RPL_SUMMONING, RPL_TIME, RPL_TOPIC, RPL_TOPICINFO, RPL_TRACECLASS, RPL_TRACECONNECTING, RPL_TRACEHANDSHAKE, RPL_TRACELINK, RPL_TRACELOG, RPL_TRACENEWTYPE, RPL_TRACEOPERATOR, RPL_TRACESERVER, RPL_TRACEUNKNOWN, RPL_TRACEUSER, RPL_UMODEIS, RPL_UNAWAY, RPL_USERHOST, RPL_USERS, RPL_USERSSTART, RPL_VERSION, RPL_WHOISCHANNELS, RPL_WHOISCHANOP, RPL_WHOISIDLE, RPL_WHOISOPERATOR, RPL_WHOISSERVER, RPL_WHOISUSER, RPL_WHOREPLY, RPL_WHOWASUSER, RPL_YOUREOPER
 
Constructor Summary
IrcStack(ProtocolProviderServiceIrcImpl parentProvider, String nickname, String login, String version, String finger)
          Creates an instance of IrcStack.
 
Method Summary
protected  void banParticipant(String chatRoom, String hostmask, String reason)
          Called to ban the given user from the given channel.
 void connect(String serverAddress, int serverPort, String serverPassword, boolean autoNickChange)
          Connects to the server.
protected  void createPrivateChatRoom(String target)
          Creates the chat room given by target.
 List<String> getServerChatRoomList()
          Returns the list of chat rooms on this server.
protected  boolean isJoined(ChatRoomIrcImpl chatRoom)
          Tests if this chat room is joined
 void join(ChatRoom chatRoom)
          Join a chat room on this server.
 void join(ChatRoom chatRoom, byte[] password)
          Join a chat room on this server.
 void kickParticipant(String chatRoomName, String contactAddress, String reason)
          Kicks the participant with the given contact address from the given channel.
protected  void leave(ChatRoom chatRoom)
          Leaves the given chat room.
protected  void onAction(String sender, String login, String hostname, String target, String action)
          This method is called whenever an ACTION is sent from a user.
protected  void onChannelInfo(String channel, int userCount, String topic)
          After calling the listChannels() method in PircBot, the server will start to send us information about each channel on the server.
protected  void onConnect()
          Called when we're connected to the IRC server.
protected  void onDeop(String channel, String sourceNick, String sourceLogin, String sourceHostname, String recipient)
          Called when a user (possibly us) gets operator status taken away.
protected  void onDeVoice(String channel, String sourceNick, String sourceLogin, String sourceHostname, String recipient)
          Called when a user (possibly us) gets voice status removed.
protected  void onDisconnect()
          Called when we're disconnected from the IRC server.
protected  void onInvite(String targetNick, String sourceNick, String sourceLogin, String sourceHostname, String channel)
          Called when we are invited to a channel by a user.
protected  void onJoin(String channel, String sender, String login, String hostname)
          This method is called whenever someone (possibly us) joins a channel which we are on.
protected  void onKick(String channel, String kickerNick, String kickerLogin, String kickerHostname, String recipientNick, String reason)
          This method is called whenever someone (possibly us) is kicked from any of the channels that we are in.
protected  void onMessage(String channel, String sender, String login, String hostname, String messageContent)
          Indicates that a message has arrived from the IRC stack.
protected  void onNickChange(String oldNick, String login, String hostname, String newNick)
          This method is called whenever someone (possibly us) changes nick on any of the channels that we are on.
protected  void onNotice(String sourceNick, String sourceLogin, String sourceHostname, String target, String notice)
          This method is called whenever we receive a notice.
protected  void onOp(String channel, String sourceNick, String sourceLogin, String sourceHostname, String recipient)
          Called when a user (possibly us) gets granted operator status for a channel.
protected  void onPart(String channel, String sender, String login, String hostname)
          This method is called whenever someone (possibly us) leaves a channel which we are on.
protected  void onPrivateMessage(String sender, String login, String hostname, String messageContent)
          Indicates that a private message has been received.
protected  void onQuit(String sourceNick, String sourceLogin, String sourceHostname, String reason)
          This method is called whenever someone (possibly us) quits from the server.
protected  void onRemoveChannelBan(String channel, String sourceNick, String sourceLogin, String sourceHostname, String hostmask)
          Called when a host mask ban is removed from a channel.
protected  void onRemoveChannelKey(String channel, String sourceNick, String sourceLogin, String sourceHostname, String key)
          Called when a channel key is removed.
protected  void onRemoveChannelLimit(String channel, String sourceNick, String sourceLogin, String sourceHostname)
          Called when the user limit is removed for a channel.
protected  void onRemoveInviteOnly(String channel, String sourceNick, String sourceLogin, String sourceHostname)
          Called when a channel has 'invite only' removed.
protected  void onRemoveModerated(String channel, String sourceNick, String sourceLogin, String sourceHostname)
          Called when a channel has moderated mode removed.
protected  void onRemoveNoExternalMessages(String channel, String sourceNick, String sourceLogin, String sourceHostname)
          Called when a channel is set to allow messages from any user, even if they are not actually in the channel.
protected  void onRemovePrivate(String channel, String sourceNick, String sourceLogin, String sourceHostname)
          Called when a channel is marked as not being in private mode.
protected  void onRemoveSecret(String channel, String sourceNick, String sourceLogin, String sourceHostname)
          Called when a channel has 'secret' mode removed.
protected  void onRemoveTopicProtection(String channel, String sourceNick, String sourceLogin, String sourceHostname)
          Called when topic protection is removed for a channel.
protected  void onServerResponse(int code, String response)
           
protected  void onSetChannelBan(String channel, String sourceNick, String sourceLogin, String sourceHostname, String hostmask)
          Called when a user (possibly us) gets banned from a channel.
protected  void onSetChannelKey(String channel, String sourceNick, String sourceLogin, String sourceHostname, String key)
          Called when a channel key is set.
protected  void onSetChannelLimit(String channel, String sourceNick, String sourceLogin, String sourceHostname, int limit)
          Called when a user limit is set for a channel.
protected  void onSetInviteOnly(String channel, String sourceNick, String sourceLogin, String sourceHostname)
          Called when a channel is set to 'invite only' mode.
protected  void onSetModerated(String channel, String sourceNick, String sourceLogin, String sourceHostname)
          Called when a channel is set to 'moderated' mode.
protected  void onSetNoExternalMessages(String channel, String sourceNick, String sourceLogin, String sourceHostname)
          Called when a channel is set to only allow messages from users that are in the channel.
protected  void onSetPrivate(String channel, String sourceNick, String sourceLogin, String sourceHostname)
          Called when a channel is marked as being in private mode.
protected  void onSetSecret(String channel, String sourceNick, String sourceLogin, String sourceHostname)
          Called when a channel is set to be in 'secret' mode.
protected  void onSetTopicProtection(String channel, String sourceNick, String sourceLogin, String sourceHostname)
          Called when topic protection is enabled for a channel.
protected  void onTopic(String channel, String topic, String setBy, long date, boolean changed)
          This method is called whenever a user sets the topic, or when PircBot joins a new channel and discovers its topic.
protected  void onUnknown(String line)
          This method is called whenever we receive a line from the server that the PircBot has not been programmed to recognize.
protected  void onUserList(String channel, org.jibble.pircbot.User[] users)
          This method is called when we receive a user list from the server after joining a channel.
protected  void onVoice(String channel, String sourceNick, String sourceLogin, String sourceHostname, String recipient)
          Called when a user (possibly us) gets voice status granted in a channel.
protected  void sendCommand(ChatRoomIrcImpl chatRoom, String command)
          This method sends a command to the server which can also be an action or a notice.
 void setSubject(String channel, String topic)
          Changes the topic of the given channel.
 void setUserNickname(String nickname)
          Changes the user nick name on the IRC server.
 
Methods inherited from class org.jibble.pircbot.PircBot
ban, changeNick, connect, connect, connect, dccAcceptChatRequest, dccReceiveFile, dccSendChatRequest, dccSendFile, deOp, deVoice, disconnect, dispose, equals, getChannels, getDccInetAddress, getDccPorts, getEncoding, getFinger, getInetAddress, getLogin, getMaxLineLength, getMessageDelay, getName, getNick, getOutgoingQueueSize, getPassword, getPort, getServer, getUsers, getVersion, handleLine, hashCode, ipToLong, isConnected, joinChannel, joinChannel, kick, kick, listChannels, listChannels, log, longToIp, onDccChatRequest, onDccSendRequest, onFileTransferFinished, onFinger, onIncomingChatRequest, onIncomingFileTransfer, onMode, onPing, onServerPing, onTime, onTopic, onUserMode, onVersion, op, partChannel, partChannel, quitServer, quitServer, reconnect, sendAction, sendCTCPCommand, sendInvite, sendMessage, sendNotice, sendRawLine, sendRawLineViaQueue, setAutoNickChange, setDccInetAddress, setDccPorts, setEncoding, setFinger, setLogin, setMessageDelay, setMode, setName, setTopic, setVerbose, setVersion, startIdentServer, toString, unBan, voice
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IrcStack

public IrcStack(ProtocolProviderServiceIrcImpl parentProvider,
                String nickname,
                String login,
                String version,
                String finger)
Creates an instance of IrcStack.

Parameters:
parentProvider - the IRC protocol provider service
nickname - our nickname
login - our login
version - the version
finger - the finger
Method Detail

connect

public void connect(String serverAddress,
                    int serverPort,
                    String serverPassword,
                    boolean autoNickChange)
             throws OperationFailedException
Connects to the server.

Parameters:
serverAddress - the address of the server
serverPort - the port to connect to
serverPassword - the password to use for connect
autoNickChange - indicates if the nick name should be changed in case there exist already a participant with the same nick name
Throws:
OperationFailedException

onConnect

protected void onConnect()
Called when we're connected to the IRC server.

Overrides:
onConnect in class org.jibble.pircbot.PircBot

onDisconnect

protected void onDisconnect()
Called when we're disconnected from the IRC server.

Overrides:
onDisconnect in class org.jibble.pircbot.PircBot

onMessage

protected void onMessage(String channel,
                         String sender,
                         String login,
                         String hostname,
                         String messageContent)
Indicates that a message has arrived from the IRC stack.

Overrides:
onMessage in class org.jibble.pircbot.PircBot
Parameters:
channel - the channel where the message is received
sender - the sender of the message
login - the login
hostname - the host name
messageContent - the content of the message

onPrivateMessage

protected void onPrivateMessage(String sender,
                                String login,
                                String hostname,
                                String messageContent)
Indicates that a private message has been received. Note that for now this method only logs the message.

Overrides:
onPrivateMessage in class org.jibble.pircbot.PircBot
Parameters:
sender - the sender of the message
login - the login
hostname - the host name
messageContent - the content of the message

onAction

protected void onAction(String sender,
                        String login,
                        String hostname,
                        String target,
                        String action)
This method is called whenever an ACTION is sent from a user. E.g. such events generated by typing "/me goes shopping" in most IRC clients.

Overrides:
onAction in class org.jibble.pircbot.PircBot
Parameters:
sender - The nick of the user that sent the action.
login - The login of the user that sent the action.
hostname - The host name of the user that sent the action.
target - The target of the action, be it a channel or our nick.
action - The action carried out by the user.

onChannelInfo

protected void onChannelInfo(String channel,
                             int userCount,
                             String topic)
After calling the listChannels() method in PircBot, the server will start to send us information about each channel on the server.

Overrides:
onChannelInfo in class org.jibble.pircbot.PircBot
Parameters:
channel - The name of the channel.
userCount - The number of users visible in this channel.
topic - The topic for this channel.

onDeop

protected void onDeop(String channel,
                      String sourceNick,
                      String sourceLogin,
                      String sourceHostname,
                      String recipient)
Called when a user (possibly us) gets operator status taken away.

This is a type of mode change and is also passed to the onMode method in the PircBot class.

Overrides:
onDeop in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.
recipient - The nick of the user that got 'de-opp-ed'.

onDeVoice

protected void onDeVoice(String channel,
                         String sourceNick,
                         String sourceLogin,
                         String sourceHostname,
                         String recipient)
Called when a user (possibly us) gets voice status removed.

This is a type of mode change and is also passed to the onMode method in the PircBot class.

Overrides:
onDeVoice in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.
recipient - The nick of the user that got 'de-voiced'.

onInvite

protected void onInvite(String targetNick,
                        String sourceNick,
                        String sourceLogin,
                        String sourceHostname,
                        String channel)
Called when we are invited to a channel by a user.

Overrides:
onInvite in class org.jibble.pircbot.PircBot
Parameters:
targetNick - The nick of the user being invited - should be us!
sourceNick - The nick of the user that sent the invitation.
sourceLogin - The login of the user that sent the invitation.
sourceHostname - The host name of the user that sent the invitation.
channel - The channel that we're being invited to.

onJoin

protected void onJoin(String channel,
                      String sender,
                      String login,
                      String hostname)
This method is called whenever someone (possibly us) joins a channel which we are on.

Overrides:
onJoin in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel which somebody joined.
sender - The nick of the user who joined the channel.
login - The login of the user who joined the channel.
hostname - The host name of the user who joined the channel.

onKick

protected void onKick(String channel,
                      String kickerNick,
                      String kickerLogin,
                      String kickerHostname,
                      String recipientNick,
                      String reason)
This method is called whenever someone (possibly us) is kicked from any of the channels that we are in.

Overrides:
onKick in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel from which the recipient was kicked.
kickerNick - The nick of the user who performed the kick.
kickerLogin - The login of the user who performed the kick.
kickerHostname - The host name of the user who performed the kick.
recipientNick - The unfortunate recipient of the kick.
reason - The reason given by the user who performed the kick.

onNickChange

protected void onNickChange(String oldNick,
                            String login,
                            String hostname,
                            String newNick)
This method is called whenever someone (possibly us) changes nick on any of the channels that we are on.

Overrides:
onNickChange in class org.jibble.pircbot.PircBot
Parameters:
oldNick - The old nick.
login - The login of the user.
hostname - The host name of the user.
newNick - The new nick.

onNotice

protected void onNotice(String sourceNick,
                        String sourceLogin,
                        String sourceHostname,
                        String target,
                        String notice)
This method is called whenever we receive a notice.

Overrides:
onNotice in class org.jibble.pircbot.PircBot
Parameters:
sourceNick - The nick of the user that sent the notice.
sourceLogin - The login of the user that sent the notice.
sourceHostname - The host name of the user that sent the notice.
target - The target of the notice, be it our nick or a channel name.
notice - The notice message.

onOp

protected void onOp(String channel,
                    String sourceNick,
                    String sourceLogin,
                    String sourceHostname,
                    String recipient)
Called when a user (possibly us) gets granted operator status for a channel.

This is a type of mode change and is also passed to the onMode method in the PircBot class.

Overrides:
onOp in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.
recipient - The nick of the user that got 'opp-ed'.

onPart

protected void onPart(String channel,
                      String sender,
                      String login,
                      String hostname)
This method is called whenever someone (possibly us) leaves a channel which we are on.

Overrides:
onPart in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel which somebody parted from.
sender - The nick of the user who parted from the channel.
login - The login of the user who parted from the channel.
hostname - The host name of the user who parted from the channel.

onQuit

protected void onQuit(String sourceNick,
                      String sourceLogin,
                      String sourceHostname,
                      String reason)
This method is called whenever someone (possibly us) quits from the server. We will only observe this if the user was in one of the channels to which we are connected.

Overrides:
onQuit in class org.jibble.pircbot.PircBot
Parameters:
sourceNick - The nick of the user that quit from the server.
sourceLogin - The login of the user that quit from the server.
sourceHostname - The host name of the user that quit from the server.
reason - The reason given for quitting the server.

onRemoveChannelBan

protected void onRemoveChannelBan(String channel,
                                  String sourceNick,
                                  String sourceLogin,
                                  String sourceHostname,
                                  String hostmask)
Called when a host mask ban is removed from a channel.

This is a type of mode change and is also passed to the onMode method in the PircBot class.

Overrides:
onRemoveChannelBan in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.
hostmask -

onRemoveChannelKey

protected void onRemoveChannelKey(String channel,
                                  String sourceNick,
                                  String sourceLogin,
                                  String sourceHostname,
                                  String key)
Called when a channel key is removed.

Overrides:
onRemoveChannelKey in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.
key - The key that was in use before the channel key was removed.

onRemoveChannelLimit

protected void onRemoveChannelLimit(String channel,
                                    String sourceNick,
                                    String sourceLogin,
                                    String sourceHostname)
Called when the user limit is removed for a channel.

Overrides:
onRemoveChannelLimit in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.

onRemoveInviteOnly

protected void onRemoveInviteOnly(String channel,
                                  String sourceNick,
                                  String sourceLogin,
                                  String sourceHostname)
Called when a channel has 'invite only' removed.

Overrides:
onRemoveInviteOnly in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.

onRemoveModerated

protected void onRemoveModerated(String channel,
                                 String sourceNick,
                                 String sourceLogin,
                                 String sourceHostname)
Called when a channel has moderated mode removed.

Overrides:
onRemoveModerated in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.

onRemoveNoExternalMessages

protected void onRemoveNoExternalMessages(String channel,
                                          String sourceNick,
                                          String sourceLogin,
                                          String sourceHostname)
Called when a channel is set to allow messages from any user, even if they are not actually in the channel.

Overrides:
onRemoveNoExternalMessages in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.

onRemovePrivate

protected void onRemovePrivate(String channel,
                               String sourceNick,
                               String sourceLogin,
                               String sourceHostname)
Called when a channel is marked as not being in private mode.

Overrides:
onRemovePrivate in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.

onRemoveSecret

protected void onRemoveSecret(String channel,
                              String sourceNick,
                              String sourceLogin,
                              String sourceHostname)
Called when a channel has 'secret' mode removed.

Overrides:
onRemoveSecret in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.

onRemoveTopicProtection

protected void onRemoveTopicProtection(String channel,
                                       String sourceNick,
                                       String sourceLogin,
                                       String sourceHostname)
Called when topic protection is removed for a channel.

Overrides:
onRemoveTopicProtection in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.

onServerResponse

protected void onServerResponse(int code,
                                String response)
Overrides:
onServerResponse in class org.jibble.pircbot.PircBot
Parameters:
code - The three-digit numerical code for the response.
response - The full response from the IRC server.
See Also:
ReplyConstants

onSetChannelBan

protected void onSetChannelBan(String channel,
                               String sourceNick,
                               String sourceLogin,
                               String sourceHostname,
                               String hostmask)
Called when a user (possibly us) gets banned from a channel. Being banned from a channel prevents any user with a matching host mask from joining the channel. For this reason, most bans are usually directly followed by the user being kicked .

Overrides:
onSetChannelBan in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.
hostmask - The host mask of the user that has been banned.

onSetChannelKey

protected void onSetChannelKey(String channel,
                               String sourceNick,
                               String sourceLogin,
                               String sourceHostname,
                               String key)
Called when a channel key is set. When the channel key has been set, other users may only join that channel if they know the key. Channel keys are sometimes referred to as passwords.

Overrides:
onSetChannelKey in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.
key - The new key for the channel.

onSetChannelLimit

protected void onSetChannelLimit(String channel,
                                 String sourceNick,
                                 String sourceLogin,
                                 String sourceHostname,
                                 int limit)
Called when a user limit is set for a channel. The number of users in the channel cannot exceed this limit.

Overrides:
onSetChannelLimit in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.
limit - The maximum number of users that may be in this channel at the same time.

onSetInviteOnly

protected void onSetInviteOnly(String channel,
                               String sourceNick,
                               String sourceLogin,
                               String sourceHostname)
Called when a channel is set to 'invite only' mode. A user may only join the channel if they are invited by someone who is already in the channel.

Overrides:
onSetInviteOnly in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.

onSetModerated

protected void onSetModerated(String channel,
                              String sourceNick,
                              String sourceLogin,
                              String sourceHostname)
Called when a channel is set to 'moderated' mode. If a channel is moderated, then only users who have been 'voiced' or 'opp-ed' may speak or change their nicks.

Overrides:
onSetModerated in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.

onSetNoExternalMessages

protected void onSetNoExternalMessages(String channel,
                                       String sourceNick,
                                       String sourceLogin,
                                       String sourceHostname)
Called when a channel is set to only allow messages from users that are in the channel.

Overrides:
onSetNoExternalMessages in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The hostname of the user that performed the mode change.

onSetPrivate

protected void onSetPrivate(String channel,
                            String sourceNick,
                            String sourceLogin,
                            String sourceHostname)
Called when a channel is marked as being in private mode.

Overrides:
onSetPrivate in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.

onSetSecret

protected void onSetSecret(String channel,
                           String sourceNick,
                           String sourceLogin,
                           String sourceHostname)
Called when a channel is set to be in 'secret' mode. Such channels typically do not appear on a server's channel listing.

Overrides:
onSetSecret in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.

onSetTopicProtection

protected void onSetTopicProtection(String channel,
                                    String sourceNick,
                                    String sourceLogin,
                                    String sourceHostname)
Called when topic protection is enabled for a channel. Topic protection means that only operators in a channel may change the topic.

Overrides:
onSetTopicProtection in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.

onTopic

protected void onTopic(String channel,
                       String topic,
                       String setBy,
                       long date,
                       boolean changed)
This method is called whenever a user sets the topic, or when PircBot joins a new channel and discovers its topic.

Overrides:
onTopic in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel that the topic belongs to.
topic - The topic for the channel.
setBy - The nick of the user that set the topic.
date - When the topic was set (milliseconds since the epoch).
changed - True if the topic has just been changed, false if the topic was already there.

onUnknown

protected void onUnknown(String line)
This method is called whenever we receive a line from the server that the PircBot has not been programmed to recognize.

Overrides:
onUnknown in class org.jibble.pircbot.PircBot
Parameters:
line - The raw line that was received from the server.

onUserList

protected void onUserList(String channel,
                          org.jibble.pircbot.User[] users)
This method is called when we receive a user list from the server after joining a channel.

Overrides:
onUserList in class org.jibble.pircbot.PircBot
Parameters:
channel - The name of the channel.
users - An array of User objects belonging to this channel.
See Also:
User

onVoice

protected void onVoice(String channel,
                       String sourceNick,
                       String sourceLogin,
                       String sourceHostname,
                       String recipient)
Called when a user (possibly us) gets voice status granted in a channel.

Overrides:
onVoice in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel in which the mode change took place.
sourceNick - The nick of the user that performed the mode change.
sourceLogin - The login of the user that performed the mode change.
sourceHostname - The host name of the user that performed the mode change.
recipient - The nick of the user that got 'voiced'.

getServerChatRoomList

public List<String> getServerChatRoomList()
Returns the list of chat rooms on this server.

Returns:
the list of chat rooms on this server

isJoined

protected boolean isJoined(ChatRoomIrcImpl chatRoom)
Tests if this chat room is joined

Parameters:
chatRoom - the chat room we want to test
Returns:
true if the chat room is joined, false otherwise

join

public void join(ChatRoom chatRoom)
Join a chat room on this server.

Parameters:
chatRoom - the chat room to join

join

public void join(ChatRoom chatRoom,
                 byte[] password)
Join a chat room on this server.

Parameters:
chatRoom - the chat room to join
password - the password of the chat room

leave

protected void leave(ChatRoom chatRoom)
Leaves the given chat room.

Parameters:
chatRoom - the chat room we want to leave

sendCommand

protected void sendCommand(ChatRoomIrcImpl chatRoom,
                           String command)
This method sends a command to the server which can also be an action or a notice.

Parameters:
chatRoom - the chat room corresponding to the command
command - the command we want to send

banParticipant

protected void banParticipant(String chatRoom,
                              String hostmask,
                              String reason)
                       throws OperationFailedException
Called to ban the given user from the given channel. The reason is not passed to the server, as it doesn't support this parameter.

Parameters:
chatRoom - the chat room for which the user should be banned
hostmask - the host mask of the user to ban
reason - the reason of the ban
Throws:
OperationFailedException - if something goes wrong

kickParticipant

public void kickParticipant(String chatRoomName,
                            String contactAddress,
                            String reason)
                     throws OperationFailedException
Kicks the participant with the given contact address from the given channel.

Parameters:
chatRoomName - the name of the chat room
contactAddress - the address of the contact to kick
reason - the reason of the kick
Throws:
OperationFailedException - if we are not joined or we don't have enough privileges to kick a participant.

setSubject

public void setSubject(String channel,
                       String topic)
                throws OperationFailedException
Changes the topic of the given channel.

Parameters:
channel - the channel to change
topic - the new topic to set
Throws:
OperationFailedException - thrown if the user is not joined to the channel or if he/she doesn't have enough privileges to change the topic or if the topic is null.

setUserNickname

public void setUserNickname(String nickname)
                     throws OperationFailedException
Changes the user nick name on the IRC server.

Parameters:
nickname - the new nickname
Throws:
OperationFailedException - if the nickname is already used by someone else

createPrivateChatRoom

protected void createPrivateChatRoom(String target)
Creates the chat room given by target.

Parameters:
target - the name of the chat room to create

Jitsi: the OpenSource Java VoIP and Instant Messaging client.

Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.