C# Class Squishy.Irc.IrcClient

Representing a fully working Irc connection class. Extend and override the sufficient OnEvent methods in order to customize it. The Dcc class offers sufficient events and commands for dealing with all Dcc matters.
Afficher le fichier Open project: jaddie/WCell-Utility-Bot Class Usage Examples

Méthodes publiques

Свойство Type Description
Info string
Network IrcNetworkInfo
Privileges Privilege[]
ServerPassword string
WhiteSpace System.Text.RegularExpressions.Regex

Protected Properties

Свойство Type Description
m_CommandHandler Squishy.Irc.Commands.IrcCommandHandler
m_MaxNickLen int
protHandler Squishy.Irc.Protocol.IrcProtocolHandler

Méthodes publiques

Méthode Description
BeginConnect ( string addr ) : void
BeginConnect ( string addr, int port ) : void

Saves the sufficient information and lets the Client instance start to connect to a Server. It will not connect if it is already connected or currently connecting. (Use Disconnect first in that case) When the Client connected successfully it dumps its ThrottledSendQueue.

GetChannel ( string name ) : IrcChannel
GetOrCreateChannel ( string name ) : IrcChannel

Gets the channel with the current name or creates a new Channel object, if it doesn't exist yet

GetOrCreateUser ( string mask ) : IrcUser
GetPrivForFlag ( char flag ) : Privilege
GetSymbolForFlag ( char flag ) : char

Returns the symbol for the specified flag ("@" would usually be the symbol for "o" e.g.).

GetUser ( string nick ) : IrcUser
GetUsers ( string mask ) : Squishy.Irc.IrcUser[]

Loops through all Users to find those who match the given mask.

HasChanMode ( string modes ) : bool

Indicates wether or not the current Irc Network offers the specified Channel modes - Independent on the sequence.

IrcClient ( ) : System
IrcClient ( Encoding encoding ) : System
IsOn ( string channame ) : bool

Indicates wether or not this IrcClient is on the Channel with the specified name.

MayTriggerCommand ( CmdTrigger cmdTrigger ) : bool

Return wether or not a command may be triggered. Is called everytime, a command is triggered.

MayTriggerCommand ( CmdTrigger trigger, Command cmd ) : bool

Return wether or not a command may be triggered. Is called everytime, a command is triggered.

Send ( string text ) : void

Uses the Client.Send(string) to enqueue the corresponding text into the ThrottledSendQueue.

SendNow ( string text ) : void

Uses the Client.SendNow(text) to send a line of text immediately to the server.

SupportsSymbols ( string symbols ) : bool

Indicates wether or not the current Irc 4rk supports the specified Channel symbols (such as @,+ etc) - Independent on the sequence.

TriggersCommand ( IrcUser user, IrcChannel chan, Squishy.Network.StringStream input ) : bool

Méthodes protégées

Méthode Description
OnBanListComplete ( IrcChannel chan ) : void

Fires when the BanList for a Channel has been sent completely.

OnBanListEntry ( IrcChannel chan, BanEntry entry ) : void

Fires when an already established BanEntry has been sent (raw 367).

OnBeforeSend ( string text ) : void

Fires when something is sent by the Client. (When Client.SendNow(string) is called.)

OnCannotJoin ( IrcChannel chan, string reason ) : void
OnChanCreationTime ( IrcChannel chan, System.DateTime creationTime ) : void

Fires when the CreationTime of a Channel has been sent (raw 329)

OnChannelMsg ( IrcUser user, IrcChannel chan, Squishy.Network.StringStream text ) : void

Fires when the Client receives a PRIVMSG which was directed to a Channel.

OnCommandFail ( CmdTrigger trigger, Exception ex ) : void

Fires when a Command raises an Exception while being executed.

OnConnectFail ( Exception ex ) : void

Fires when the Client raises the specified Exception during the Connect process.

OnConnected ( ) : void

Fires when the Client instance of this IrcClient established a connection with a server.

OnConnecting ( ) : void

Is called when the Client instance connects to a new server.

OnConnectionInfo ( IrcPacket packet, string>.Dictionary pairs ) : void

Fires when network-specific Informations are sent (raw 005).

OnCtcpReply ( IrcUser user, IrcChannel chan, string reply, string args ) : void

Fires when the Client receives any kind of CTCP reply.

OnCtcpRequest ( IrcUser user, IrcChannel chan, string request, string args ) : void

Fires when the Client receives any kind of CTCP request. Automatically replies to the VERSION request with the content of the Version variable if not overridden.

OnDisconnected ( bool conLost ) : void

Fires when the Client disconnected.

OnError ( IrcPacket packet ) : void

Fires when an Error reply has been sent by the network (raw is greater than 399).

OnExceptionRaised ( Exception e ) : void

Fires when an exception is raised during the protocol handling.

OnFlagAdded ( IrcUser user, IrcChannel chan, Privilege priv, IrcUser target ) : void

Fires when a User adds a Channel flag to another User.

OnFlagDeleted ( IrcUser user, IrcChannel chan, Privilege priv, IrcUser target ) : void

Fires when a User deletes a Channel flag from another User.

OnInvalidNick ( string err, string nick, string args ) : void

Fires when a chosen nick is already in use.

OnInvite ( IrcUser user, string chan ) : void

Fires when the specified User sends an invitation for the specified Channel.

OnJoin ( IrcUser user, IrcChannel chan ) : void

Fires when the specified User joins the specified Channel.

OnKick ( IrcUser from, IrcChannel chan, IrcUser target, string reason ) : void

Fires when a User is kicked from a Channel.

OnModeAdded ( IrcUser user, IrcChannel chan, string mode, string param ) : void

Fires when a User adds a Channel mode.

OnModeDeleted ( IrcUser user, IrcChannel chan, string mode, string param ) : void

Fures when a User deletes a Channel mode.

OnNick ( IrcUser user, string oldNick, string newNick ) : void

Fires when a User has changed the nick.

OnNotice ( IrcUser user, IrcChannel chan, Squishy.Network.StringStream text ) : void

Fires when the Client receives any kind of NOTICE.

OnPart ( IrcUser user, IrcChannel chan, string reason ) : void

Fires when a User parts from a Channel.

OnQueryMsg ( IrcUser user, Squishy.Network.StringStream text ) : void

Fires when the Client receives a PRIVMSG, directed to this Client itself.

OnQuit ( IrcUser user, string reason ) : void

Fires when a User quits.

OnText ( IrcUser user, IrcChannel chan, Squishy.Network.StringStream text ) : void

Fires when the Client receives any kind of PRIVMSG or NOTICE.

OnTopic ( IrcUser user, IrcChannel chan, string text, bool initial ) : void

Fires when the Topic for a Channel has been sent. Either when joining a Channel or when modified by a User.

OnUnknownCommandUsed ( CmdTrigger trigger ) : void

Fires when the aliasing engine cannot find a command. Sends the command to the Server when not overridden.

OnUnspecifiedInfo ( IrcPacket packet ) : void

Fires when an information is sent that is not captured by the intern protocol handler.

OnUserDisappeared ( IrcUser user ) : void

Called whenever a User quits or parts all common Channels

OnUserEncountered ( IrcUser user ) : void
OnUserLeftChannel ( IrcChannel chan, IrcUser user, string reason ) : void

Fires when a user is kicked from or parts from a channel or quits.

OnUserModeChanged ( ) : void

Fires when own Usermodes have been changed.

OnUsersAdded ( IrcChannel chan, IrcUser users ) : void

Fires when the Client receives the Names list for the specified Channel.

OnWhoReply ( string channame, string username, string host, string server, string nick, string flags, string hops, string info ) : void

Fires when the Client receives a Who-reply (raw 352).

Perform ( ) : void

Fires when the Client is fully logged on the network and the End of Motd is sent (raw 376).

Private Methods

Méthode Description
AuthNotify ( IrcUser user ) : void
BanListCompleteNotify ( IrcChannel chan ) : void
BanListEntryNotify ( IrcChannel chan, BanEntry entry ) : void
BeforeSendNotify ( string text ) : void
CannotJoinNotify ( IrcChannel channel, string reason ) : void
ChanCreationTimeNotify ( IrcChannel chan, System.DateTime creationTime ) : void
ChannelMsgNotify ( IrcUser user, IrcChannel chan, Squishy.Network.StringStream text ) : void
CheckUserKnown ( IrcUser user ) : void
CommandFailNotify ( CmdTrigger trigger, Exception ex ) : void
ConnectFailNotify ( Exception ex ) : void
ConnectNotify ( ) : void
ConnectingNotify ( ) : void
ConnectionInfoNotify ( IrcPacket packet ) : void
CtcpReplyNotify ( IrcUser user, IrcChannel chan, string reply, string args ) : void
CtcpRequestNotify ( IrcUser user, IrcChannel chan, string request, string text ) : void
DisconnectNotify ( bool conLost ) : void
ErrorNotify ( IrcPacket packet ) : void
ExceptionNotify ( Exception e ) : void
FlagAddedNotify ( IrcUser user, IrcChannel chan, Privilege priv, IrcUser target ) : void
FlagDeletedNotify ( IrcUser user, IrcChannel chan, Privilege priv, IrcUser target ) : void
InvalidNickNotify ( string err, string nick, string args ) : void
InviteNotify ( IrcUser user, string chan ) : void
JoinNotify ( IrcUser user, string name ) : void
KickNotify ( IrcUser user, IrcChannel chan, IrcUser target, string reason ) : void
ModeAddedNotify ( IrcUser user, IrcChannel chan, string mode, string param ) : void
ModeDeletedNotify ( IrcUser user, IrcChannel chan, string mode, string param ) : void
NickNotify ( IrcUser user, string newNick ) : void
NoticeNotify ( IrcUser user, IrcChannel chan, Squishy.Network.StringStream text ) : void
OnUserParsed ( IrcUser user ) : void
PartNotify ( IrcUser user, IrcChannel chan, string reason ) : void
PerformNotify ( ) : void
QueryMsgNotify ( IrcUser user, Squishy.Network.StringStream text ) : void
QuitNotify ( IrcUser user, string reason ) : void
Reset ( ) : void
TextNotify ( IrcUser user, IrcChannel chan, Squishy.Network.StringStream text ) : void
TopicNotify ( IrcUser user, IrcChannel chan, string text, bool initial ) : void
UnkownCommandUsedNotify ( CmdTrigger trigger ) : void
UnspecifiedInfoNotify ( IrcPacket packet ) : void
UserLeftChannelNotify ( IrcChannel chan, IrcUser user, string reason ) : void
UserModeChangedNotify ( ) : void
UsersAddedNotify ( IrcChannel chan, IrcUser users ) : void
WhoReplyNotify ( string channame, string username, string host, string server, string nick, string flags, string hops, string info ) : void

Method Details

BeginConnect() public méthode

public BeginConnect ( string addr ) : void
addr string
Résultat void

BeginConnect() public méthode

Saves the sufficient information and lets the Client instance start to connect to a Server. It will not connect if it is already connected or currently connecting. (Use Disconnect first in that case) When the Client connected successfully it dumps its ThrottledSendQueue.
public BeginConnect ( string addr, int port ) : void
addr string The address where the Client should connect to
port int The port on the Server where the Client should connect to
Résultat void

GetChannel() public méthode

public GetChannel ( string name ) : IrcChannel
name string The case-insensitive Channel name.
Résultat IrcChannel

GetOrCreateChannel() public méthode

Gets the channel with the current name or creates a new Channel object, if it doesn't exist yet
public GetOrCreateChannel ( string name ) : IrcChannel
name string The case-insensitive Channel name.
Résultat IrcChannel

GetOrCreateUser() public méthode

public GetOrCreateUser ( string mask ) : IrcUser
mask string
Résultat IrcUser

GetPrivForFlag() public méthode

public GetPrivForFlag ( char flag ) : Privilege
flag char
Résultat Privilege

GetSymbolForFlag() public méthode

Returns the symbol for the specified flag ("@" would usually be the symbol for "o" e.g.).
public GetSymbolForFlag ( char flag ) : char
flag char
Résultat char

GetUser() public méthode

public GetUser ( string nick ) : IrcUser
nick string The case-insensitive User'str nick.
Résultat IrcUser

GetUsers() public méthode

Loops through all Users to find those who match the given mask.
public GetUsers ( string mask ) : Squishy.Irc.IrcUser[]
mask string The mask of the users that are to be found.
Résultat Squishy.Irc.IrcUser[]

HasChanMode() public méthode

Indicates wether or not the current Irc Network offers the specified Channel modes - Independent on the sequence.
public HasChanMode ( string modes ) : bool
modes string A sequence of chars, representing Channel modes
Résultat bool

IrcClient() public méthode

public IrcClient ( ) : System
Résultat System

IrcClient() public méthode

public IrcClient ( Encoding encoding ) : System
encoding System.Text.Encoding
Résultat System

IsOn() public méthode

Indicates wether or not this IrcClient is on the Channel with the specified name.
public IsOn ( string channame ) : bool
channame string
Résultat bool

MayTriggerCommand() public méthode

Return wether or not a command may be triggered. Is called everytime, a command is triggered.
public MayTriggerCommand ( CmdTrigger cmdTrigger ) : bool
cmdTrigger Squishy.Irc.Commands.CmdTrigger
Résultat bool

MayTriggerCommand() public méthode

Return wether or not a command may be triggered. Is called everytime, a command is triggered.
public MayTriggerCommand ( CmdTrigger trigger, Command cmd ) : bool
trigger Squishy.Irc.Commands.CmdTrigger
cmd Squishy.Irc.Commands.Command A command.
Résultat bool

OnBanListComplete() protected méthode

Fires when the BanList for a Channel has been sent completely.
protected OnBanListComplete ( IrcChannel chan ) : void
chan IrcChannel
Résultat void

OnBanListEntry() protected méthode

Fires when an already established BanEntry has been sent (raw 367).
protected OnBanListEntry ( IrcChannel chan, BanEntry entry ) : void
chan IrcChannel
entry BanEntry
Résultat void

OnBeforeSend() protected méthode

Fires when something is sent by the Client. (When Client.SendNow(string) is called.)
protected OnBeforeSend ( string text ) : void
text string The line of text which is supposed to be sent.
Résultat void

OnCannotJoin() protected méthode

protected OnCannotJoin ( IrcChannel chan, string reason ) : void
chan IrcChannel
reason string
Résultat void

OnChanCreationTime() protected méthode

Fires when the CreationTime of a Channel has been sent (raw 329)
protected OnChanCreationTime ( IrcChannel chan, System.DateTime creationTime ) : void
chan IrcChannel
creationTime System.DateTime
Résultat void

OnChannelMsg() protected méthode

Fires when the Client receives a PRIVMSG which was directed to a Channel.
protected OnChannelMsg ( IrcUser user, IrcChannel chan, Squishy.Network.StringStream text ) : void
user IrcUser
chan IrcChannel
text Squishy.Network.StringStream
Résultat void

OnCommandFail() protected méthode

Fires when a Command raises an Exception while being executed.
protected OnCommandFail ( CmdTrigger trigger, Exception ex ) : void
trigger Squishy.Irc.Commands.CmdTrigger
ex System.Exception
Résultat void

OnConnectFail() protected méthode

Fires when the Client raises the specified Exception during the Connect process.
protected OnConnectFail ( Exception ex ) : void
ex System.Exception
Résultat void

OnConnected() protected méthode

Fires when the Client instance of this IrcClient established a connection with a server.
protected OnConnected ( ) : void
Résultat void

OnConnecting() protected méthode

Is called when the Client instance connects to a new server.
protected OnConnecting ( ) : void
Résultat void

OnConnectionInfo() protected méthode

Fires when network-specific Informations are sent (raw 005).
protected OnConnectionInfo ( IrcPacket packet, string>.Dictionary pairs ) : void
packet Squishy.Irc.Protocol.IrcPacket
pairs string>.Dictionary A Dictionary, containing all information, indexed case-insensitively. Value is "" if the information isnt a pair.
Résultat void

OnCtcpReply() protected méthode

Fires when the Client receives any kind of CTCP reply.
protected OnCtcpReply ( IrcUser user, IrcChannel chan, string reply, string args ) : void
user IrcUser The User who sent the text
chan IrcChannel
reply string The reply type (such as VERSION)
args string The text which was sent in addition to the reply
Résultat void

OnCtcpRequest() protected méthode

Fires when the Client receives any kind of CTCP request. Automatically replies to the VERSION request with the content of the Version variable if not overridden.
protected OnCtcpRequest ( IrcUser user, IrcChannel chan, string request, string args ) : void
user IrcUser The User who sent the text
chan IrcChannel The Channel where it was sent (can be null)
request string The request type (such as VERSION)
args string The text which was sent in addition to the request
Résultat void

OnDisconnected() protected méthode

Fires when the Client disconnected.
protected OnDisconnected ( bool conLost ) : void
conLost bool
Résultat void

OnError() protected méthode

Fires when an Error reply has been sent by the network (raw is greater than 399).
protected OnError ( IrcPacket packet ) : void
packet Squishy.Irc.Protocol.IrcPacket
Résultat void

OnExceptionRaised() protected méthode

Fires when an exception is raised during the protocol handling.
protected OnExceptionRaised ( Exception e ) : void
e System.Exception The Exception thrown during the handling.
Résultat void

OnFlagAdded() protected méthode

Fires when a User adds a Channel flag to another User.
protected OnFlagAdded ( IrcUser user, IrcChannel chan, Privilege priv, IrcUser target ) : void
user IrcUser
chan IrcChannel
priv Privilege
target IrcUser
Résultat void

OnFlagDeleted() protected méthode

Fires when a User deletes a Channel flag from another User.
protected OnFlagDeleted ( IrcUser user, IrcChannel chan, Privilege priv, IrcUser target ) : void
user IrcUser
chan IrcChannel
priv Privilege
target IrcUser
Résultat void

OnInvalidNick() protected méthode

Fires when a chosen nick is already in use.
protected OnInvalidNick ( string err, string nick, string args ) : void
err string
nick string
args string
Résultat void

OnInvite() protected méthode

Fires when the specified User sends an invitation for the specified Channel.
protected OnInvite ( IrcUser user, string chan ) : void
user IrcUser
chan string
Résultat void

OnJoin() protected méthode

Fires when the specified User joins the specified Channel.
protected OnJoin ( IrcUser user, IrcChannel chan ) : void
user IrcUser
chan IrcChannel
Résultat void

OnKick() protected méthode

Fires when a User is kicked from a Channel.
protected OnKick ( IrcUser from, IrcChannel chan, IrcUser target, string reason ) : void
from IrcUser
chan IrcChannel
target IrcUser
reason string
Résultat void

OnModeAdded() protected méthode

Fires when a User adds a Channel mode.
protected OnModeAdded ( IrcUser user, IrcChannel chan, string mode, string param ) : void
user IrcUser The User who has added the mode
chan IrcChannel
mode string The mode which has been changed
param string "" if the mode does not have any parameter
Résultat void

OnModeDeleted() protected méthode

Fures when a User deletes a Channel mode.
protected OnModeDeleted ( IrcUser user, IrcChannel chan, string mode, string param ) : void
user IrcUser The User who has added the mode
chan IrcChannel
mode string The mode which has been changed
param string "" if the mode does not have any parameter
Résultat void

OnNick() protected méthode

Fires when a User has changed the nick.
protected OnNick ( IrcUser user, string oldNick, string newNick ) : void
user IrcUser
oldNick string
newNick string
Résultat void

OnNotice() protected méthode

Fires when the Client receives any kind of NOTICE.
protected OnNotice ( IrcUser user, IrcChannel chan, Squishy.Network.StringStream text ) : void
user IrcUser The User who sent the text
chan IrcChannel The Channel where it was sent (is null if its a private notice)
text Squishy.Network.StringStream The text which was sent
Résultat void

OnPart() protected méthode

Fires when a User parts from a Channel.
protected OnPart ( IrcUser user, IrcChannel chan, string reason ) : void
user IrcUser
chan IrcChannel
reason string
Résultat void

OnQueryMsg() protected méthode

Fires when the Client receives a PRIVMSG, directed to this Client itself.
protected OnQueryMsg ( IrcUser user, Squishy.Network.StringStream text ) : void
user IrcUser
text Squishy.Network.StringStream
Résultat void

OnQuit() protected méthode

Fires when a User quits.
protected OnQuit ( IrcUser user, string reason ) : void
user IrcUser
reason string
Résultat void

OnText() protected méthode

Fires when the Client receives any kind of PRIVMSG or NOTICE.
protected OnText ( IrcUser user, IrcChannel chan, Squishy.Network.StringStream text ) : void
user IrcUser The User who sent the text
chan IrcChannel
text Squishy.Network.StringStream The text which was sent
Résultat void

OnTopic() protected méthode

Fires when the Topic for a Channel has been sent. Either when joining a Channel or when modified by a User.
protected OnTopic ( IrcUser user, IrcChannel chan, string text, bool initial ) : void
user IrcUser
chan IrcChannel
text string
initial bool
Résultat void

OnUnknownCommandUsed() protected méthode

Fires when the aliasing engine cannot find a command. Sends the command to the Server when not overridden.
protected OnUnknownCommandUsed ( CmdTrigger trigger ) : void
trigger Squishy.Irc.Commands.CmdTrigger
Résultat void

OnUnspecifiedInfo() protected méthode

Fires when an information is sent that is not captured by the intern protocol handler.
protected OnUnspecifiedInfo ( IrcPacket packet ) : void
packet Squishy.Irc.Protocol.IrcPacket
Résultat void

OnUserDisappeared() protected méthode

Called whenever a User quits or parts all common Channels
protected OnUserDisappeared ( IrcUser user ) : void
user IrcUser
Résultat void

OnUserEncountered() protected méthode

protected OnUserEncountered ( IrcUser user ) : void
user IrcUser
Résultat void

OnUserLeftChannel() protected méthode

Fires when a user is kicked from or parts from a channel or quits.
protected OnUserLeftChannel ( IrcChannel chan, IrcUser user, string reason ) : void
chan IrcChannel
user IrcUser
reason string
Résultat void

OnUserModeChanged() protected méthode

Fires when own Usermodes have been changed.
protected OnUserModeChanged ( ) : void
Résultat void

OnUsersAdded() protected méthode

Fires when the Client receives the Names list for the specified Channel.
protected OnUsersAdded ( IrcChannel chan, IrcUser users ) : void
chan IrcChannel
users IrcUser An Array of Users who are on the Channel
Résultat void

OnWhoReply() protected méthode

Fires when the Client receives a Who-reply (raw 352).
protected OnWhoReply ( string channame, string username, string host, string server, string nick, string flags, string hops, string info ) : void
channame string The name of the channel which the Who-reply was for or the User did something on last
username string The username of the User
host string The hostmask of the User
server string The server which the User is connected to
nick string The nick of the User
flags string The network flags of the User
hops string The hops of the User
info string Additional Info about the User
Résultat void

Perform() protected méthode

Fires when the Client is fully logged on the network and the End of Motd is sent (raw 376).
protected Perform ( ) : void
Résultat void

Send() public méthode

Uses the Client.Send(string) to enqueue the corresponding text into the ThrottledSendQueue.
public Send ( string text ) : void
text string
Résultat void

SendNow() public méthode

Uses the Client.SendNow(text) to send a line of text immediately to the server.
public SendNow ( string text ) : void
text string
Résultat void

SupportsSymbols() public méthode

Indicates wether or not the current Irc 4rk supports the specified Channel symbols (such as @,+ etc) - Independent on the sequence.
public SupportsSymbols ( string symbols ) : bool
symbols string A sequence of symbols, representing Channel flags (such as '@')
Résultat bool

TriggersCommand() public méthode

public TriggersCommand ( IrcUser user, IrcChannel chan, Squishy.Network.StringStream input ) : bool
user IrcUser
chan IrcChannel
input Squishy.Network.StringStream
Résultat bool

Property Details

Info public_oe property

public string Info
Résultat string

Network public_oe property

Contains information and tools to operate on this specific Network.
public IrcNetworkInfo,Squishy.Irc Network
Résultat IrcNetworkInfo

Privileges public_oe static_oe property

public static Privilege[] Privileges
Résultat Privilege[]

ServerPassword public_oe property

public string ServerPassword
Résultat string

WhiteSpace public_oe static_oe property

public static Regex,System.Text.RegularExpressions WhiteSpace
Résultat System.Text.RegularExpressions.Regex

m_CommandHandler protected_oe property

protected IrcCommandHandler,Squishy.Irc.Commands m_CommandHandler
Résultat Squishy.Irc.Commands.IrcCommandHandler

m_MaxNickLen protected_oe property

protected int m_MaxNickLen
Résultat int

protHandler protected_oe property

protected IrcProtocolHandler,Squishy.Irc.Protocol protHandler
Résultat Squishy.Irc.Protocol.IrcProtocolHandler