paolomind.multitalk.irc
Class SenderIrcClient

java.lang.Object
  extended by org.jibble.pircbot.PircBot
      extended by paolomind.multitalk.irc.SenderIrcClient
All Implemented Interfaces:
org.jibble.pircbot.ReplyConstants, Sender

public class SenderIrcClient
extends org.jibble.pircbot.PircBot
implements Sender

Prima classe che implementa il protocollo di comunicazione. si preoccupa di ricevere ed inviare i messaggi, e delegare gli eventi IRC

Author:
paolo

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
SenderIrcClient(IrcListener pirclistener)
           
 
Method Summary
protected  IrcListener getIrclistener()
          ritorna il listener.
protected  IMessageFactory getMessageFactory()
          ritorna il MessageFactory.
protected  Receiver getReceiver()
          ritorna il receiver.
protected  void onChannelInfo(java.lang.String channel, int userCount, java.lang.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()
          This method is called once the PircBot has successfully connected to the IRC server.
protected  void onMessage(java.lang.String channel, java.lang.String sender, java.lang.String login, java.lang.String hostname, java.lang.String message)
          This method is called whenever a message is sent to a channel.
protected  void onServerPing(java.lang.String response)
          The actions to perform when a PING request comes from the server.
protected  void onServerResponse(int code, java.lang.String response)
          This method is called when we receive a numeric response from the IRC server.
protected  void onUnknown(java.lang.String line)
          This method is called whenever we receive a line from the server that the PircBot has not been programmed to recognise.
 void send(IMessage m)
          metodo di invio messaggi.
 void setIrcframe(IrcListener pirclistener)
          setta il listener che riceverà ogni messaggio.
protected  void setIrclistener(IrcListener pirclistener)
          setta il listener.
 void setMessageFactory(IMessageFactory pfactory)
          setta il message factory per creare i messaggi dalle stringhe ricevute.
 void setMyName(java.lang.String name)
          Sets the name of the bot, which will be used as its nick when it tries to join an IRC server.
 void setReceiver(Receiver preceiver)
          setta il receiver che riceverà ogni messaggio.
 
Methods inherited from class org.jibble.pircbot.PircBot
ban, changeNick, connect, connect, connect, dccAcceptChatRequest, dccReceiveFile, dccSendChatRequest, dccSendFile, deOp, deVoice, disconnect, dispose, equals, getChannels, 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, onAction, onDccChatRequest, onDccSendRequest, onDeop, onDeVoice, onDisconnect, onFileTransferFinished, onFinger, onIncomingChatRequest, onIncomingFileTransfer, onInvite, onJoin, onKick, onMode, onNickChange, onNotice, onOp, onPart, onPing, onPrivateMessage, onQuit, onRemoveChannelBan, onRemoveChannelKey, onRemoveChannelLimit, onRemoveInviteOnly, onRemoveModerated, onRemoveNoExternalMessages, onRemovePrivate, onRemoveSecret, onRemoveTopicProtection, onSetChannelBan, onSetChannelKey, onSetChannelLimit, onSetInviteOnly, onSetModerated, onSetNoExternalMessages, onSetPrivate, onSetSecret, onSetTopicProtection, onTime, onTopic, onTopic, onUserList, onUserMode, onVersion, onVoice, op, partChannel, partChannel, quitServer, quitServer, reconnect, sendAction, sendCTCPCommand, sendInvite, sendMessage, sendNotice, sendRawLine, sendRawLineViaQueue, setAutoNickChange, 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

SenderIrcClient

public SenderIrcClient(IrcListener pirclistener)
Parameters:
pirclistener - il listener IRC che riceve gli eventi IRC
Method Detail

onMessage

protected final void onMessage(java.lang.String channel,
                               java.lang.String sender,
                               java.lang.String login,
                               java.lang.String hostname,
                               java.lang.String message)
This method is called whenever a message is sent to a channel. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.

Overrides:
onMessage in class org.jibble.pircbot.PircBot
Parameters:
channel - The channel to which the message was sent.
sender - The nick of the person who sent the message.
login - The login of the person who sent the message.
hostname - The hostname of the person who sent the message.
message - The actual message sent to the channel.

send

public final void send(IMessage m)
metodo di invio messaggi.

Specified by:
send in interface Sender
Parameters:
m - messaggio da inviare da questo oggetto

setReceiver

public final void setReceiver(Receiver preceiver)
setta il receiver che riceverà ogni messaggio.

Parameters:
preceiver - parametro receiver

setIrcframe

public final void setIrcframe(IrcListener pirclistener)
setta il listener che riceverà ogni messaggio.

Parameters:
pirclistener - parametro listener

onChannelInfo

protected final void onChannelInfo(java.lang.String channel,
                                   int userCount,
                                   java.lang.String topic)
After calling the listChannels() method in PircBot, the server will start to send us information about each channel on the server. You may override this method in order to receive the information about each channel as soon as it is received. Note that certain channels, such as those marked as hidden, may not appear in channel listings. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.

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.
See Also:
listChannels

setMyName

public final void setMyName(java.lang.String name)
Sets the name of the bot, which will be used as its nick when it tries to join an IRC server. This should be set before joining any servers, otherwise the default nick will be used. You would typically call this method from the constructor of the class that extends PircBot. The changeNick method should be used if you wish to change your nick when you are connected to a server.

Parameters:
name - The new name of the Bot.

onConnect

protected final void onConnect()
This method is called once the PircBot has successfully connected to the IRC server. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.

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

onServerPing

protected final void onServerPing(java.lang.String response)
The actions to perform when a PING request comes from the server. This sends back a correct response, so if you override this method, be sure to either mimic its functionality or to call super.onServerPing(response);

Overrides:
onServerPing in class org.jibble.pircbot.PircBot
Parameters:
response - The response that should be given back in your PONG.

onServerResponse

protected final void onServerResponse(int code,
                                      java.lang.String response)
This method is called when we receive a numeric response from the IRC server. Numerics in the range from 001 to 099 are used for client-server connections only and should never travel between servers. Replies generated in response to commands are found in the range from 200 to 399. Error replies are found in the range from 400 to 599. For example, we can use this method to discover the topic of a channel when we join it. If we join the channel #test which has a topic of "I am King of Test" then the response will be "PircBot #test :I Am King of Test" with a code of 332 to signify that this is a topic. (This is just an example - note that overriding the onTopic method is an easier way of finding the topic for a channel). Check the IRC RFC for the full list of other command response codes. PircBot implements the interface ReplyConstants, which contains contstants that you may find useful here. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.

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

onUnknown

protected final void onUnknown(java.lang.String line)
This method is called whenever we receive a line from the server that the PircBot has not been programmed to recognise. The implementation of this method in the PircBot abstract class performs no actions and may be overridden as required.

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

setMessageFactory

public final void setMessageFactory(IMessageFactory pfactory)
setta il message factory per creare i messaggi dalle stringhe ricevute.

Parameters:
pfactory - il MessageFactory

getIrclistener

protected final IrcListener getIrclistener()
ritorna il listener.

Returns:
ritorna il listener dell'oggetto

setIrclistener

protected final void setIrclistener(IrcListener pirclistener)
setta il listener.

Parameters:
pirclistener - il listener da associare

getReceiver

protected final Receiver getReceiver()
ritorna il receiver.

Returns:
ritorna il receiver dell'oggetto

getMessageFactory

protected final IMessageFactory getMessageFactory()
ritorna il MessageFactory.

Returns:
ritorna il MessageFactory dell'oggetto


Copyright © 2007. All Rights Reserved.