C# Class IrcShark.Chatting.Irc.IrcClient

Manages a simple irc connection on a low raw level.
With an instance of IrcClient, you can connect to an irc server and receive many events defined by the standard irc protocol. The messages received are automatically parsed to IrcLine objects to be easier accessible. After connection was established, you should call ReceiveLine to get the lines from the server.
Inheritance: IDisposable
Afficher le fichier Open project: hapm/IrcShark Class Usage Examples

Méthodes publiques

Méthode Description
Connect ( ) : void

Connects to the irc server addressed by ServerAddress.

Dispose ( ) : void

Disposes the object.

IrcClient ( ) : System

Initializes a new instance of the IrcClient class without any address to connect to.

Join ( string chanName ) : void

Joins a given channel on the irc server.

The given chanName should follow the given Standard of the IrcClient. The IrcClient will wait for the acknowledge of the server.

Part ( string chanName ) : void

Parts a given channel on the irc server.

The chanName should follow the given Standard of the IrcClient. The IrcClient will wait for the acknowledge of the server.

Quit ( ) : void

Quits the IRC Connection without a Message.

Quit ( string quitMsg ) : void

Quits the IRC connection with a Message.

ReadLine ( ) : IrcLine

Reads a new line from the server.

This method blocks the calling thread until a new line was received from server. Only use this method, if you want to bypass the automatically raised events and kine handling. If you want to have this features use IrcClient.ReceiveLine instead.

ReceiveLine ( ) : void

Reads the next line, raise all events and handle it if needed.

This method does the same as IrcClient.ReadLine does but additionally raise all events of the line. If the line is a PING line, it is handled and automatically answered by an according PONG.

SendLine ( string line ) : void

Sends a raw irc line to the irc server.

You can send anything you want. The text is send as is. There is no checking or something.

SendMessage ( string message, string receiver ) : void

Sends a message to a channel or nick (in a query).

SendNotice ( string message, string receiver ) : void

Sends a message to a channel, nick (directly).

Méthodes protégées

Méthode Description
OnError ( string msg ) : void

Fires the Error event.

OnError ( string msg, Exception ex ) : void

Fires the Error event.

OnLineReceived ( IrcLine line ) : void

Fires the LineReceived event.

OnOnConnect ( ) : bool

Fires the OnConnect event.

OnOnLogin ( ) : void

Fires the OnLogin event.

Private Methods

Méthode Description
HandleLine ( LineReceivedEventArgs e ) : void

Handles a line received from server.

Method Details

Connect() public méthode

Connects to the irc server addressed by ServerAddress.
public Connect ( ) : void
Résultat void

Dispose() public méthode

Disposes the object.
public Dispose ( ) : void
Résultat void

IrcClient() public méthode

Initializes a new instance of the IrcClient class without any address to connect to.
public IrcClient ( ) : System
Résultat System

Join() public méthode

Joins a given channel on the irc server.
The given chanName should follow the given Standard of the IrcClient. The IrcClient will wait for the acknowledge of the server.
public Join ( string chanName ) : void
chanName string The channel name the client should join.
Résultat void

OnError() protected méthode

Fires the Error event.
protected OnError ( string msg ) : void
msg string The message for the error.
Résultat void

OnError() protected méthode

Fires the Error event.
protected OnError ( string msg, Exception ex ) : void
msg string The message for the error.
ex System.Exception The exception that occured.
Résultat void

OnLineReceived() protected méthode

Fires the LineReceived event.
protected OnLineReceived ( IrcLine line ) : void
line IrcLine The line that was received.
Résultat void

OnOnConnect() protected méthode

Fires the OnConnect event.
protected OnOnConnect ( ) : bool
Résultat bool

OnOnLogin() protected méthode

Fires the OnLogin event.
protected OnOnLogin ( ) : void
Résultat void

Part() public méthode

Parts a given channel on the irc server.
The chanName should follow the given Standard of the IrcClient. The IrcClient will wait for the acknowledge of the server.
public Part ( string chanName ) : void
chanName string The channel name the client should join.
Résultat void

Quit() public méthode

Quits the IRC Connection without a Message.
public Quit ( ) : void
Résultat void

Quit() public méthode

Quits the IRC connection with a Message.
public Quit ( string quitMsg ) : void
quitMsg string The message to use when quitting.
Résultat void

ReadLine() public méthode

Reads a new line from the server.
This method blocks the calling thread until a new line was received from server. Only use this method, if you want to bypass the automatically raised events and kine handling. If you want to have this features use IrcClient.ReceiveLine instead.
public ReadLine ( ) : IrcLine
Résultat IrcLine

ReceiveLine() public méthode

Reads the next line, raise all events and handle it if needed.
This method does the same as IrcClient.ReadLine does but additionally raise all events of the line. If the line is a PING line, it is handled and automatically answered by an according PONG.
public ReceiveLine ( ) : void
Résultat void

SendLine() public méthode

Sends a raw irc line to the irc server.
You can send anything you want. The text is send as is. There is no checking or something.
public SendLine ( string line ) : void
line string The raw line to send.
Résultat void

SendMessage() public méthode

Sends a message to a channel or nick (in a query).
public SendMessage ( string message, string receiver ) : void
message string The message to send.
receiver string The receiver (a channel or a nick).
Résultat void

SendNotice() public méthode

Sends a message to a channel, nick (directly).
public SendNotice ( string message, string receiver ) : void
message string The message to send.
receiver string The receiver (a channel or a nick).
Résultat void