Skip to content

SimpleIRCLib Methods Wiki

Eldin Zenderink edited this page May 21, 2018 · 2 revisions

References

SimpleIRC

public class SimpleIRCLib.SimpleIRC

Properties

Type Name Summary
DCCClient DccClient DCCClient used by the IRCClient for starting a download on a separate thread using the DCC Protocol
IrcClient IrcClient Irc Client for sending and receiving messages to a irc server

Methods

Type Name Summary
Boolean CheckIfDownload() returns true or false upon calling this method, for telling you if the downlaod has been stopped or not
void GetUsersInCurrentChannel() get users in current channel
void GetUsersInDifferentChannel(String channel) get users in different channel, parameter is the channel name of type string (example: "#yourchannel")
Boolean IsClientRunning() Checks if the client is running.
Boolean SendMessageToAll(String message) send message to all channels
Boolean SendMessageToChannel(String message, String channel) Sends a message to a specific channel.
Boolean SendRawMessage(String message) Sends a raw message to irc server
void SetCustomDownloadDir(String downloaddir) Sets the download directory for dcc downloads.
void SetupIrc(String ip, String username, String channel, Int32 port = 0, String password = , Int32 timeout = 3000, Boolean enableSSL = True) Setup the client to be able to connect to the server
Boolean StartClient() Starts the irc client with the given parameters in the constructor
Boolean StopClient() Stops the client
Boolean StopXDCCDownload() returns true or false upon calling this method, for telling you if the downlaod has been stopped or not

IrcClient

For running IRC Client logic, here is where all the magic happens

public class SimpleIRCLib.IrcClient

Events

Type Name Summary
EventHandler<IrcDebugMessageEventArgs> OnDebugMessage Event Handler for firing when this client wants to send a debug message, event uses IrcDebugMessageEventArgs from IrcEventArgs.cs
EventHandler<IrcReceivedEventArgs> OnMessageReceived Event Handler for firing when a (parsed) message is received on a channel from other users, event uses IrcReceivedEventArgs from IrcEventArgs.cs
EventHandler<IrcRawReceivedEventArgs> OnRawMessageReceived Event Handler for firing when a raw message is received from the irc server, event uses IrcRawReceivedEventArgs from IrcEventArgs.cs
EventHandler<IrcUserListReceivedEventArgs> OnUserListReceived Event Handler for firing when a list with users per channel is received, event uses IrcUserListReceivedEventArgs from IrcEventArgs.cs

Methods

Type Name Summary
Boolean CheckIfDownloading() Checks if a download is running or not.
Boolean Connect() Starts the connection to the irc server, sends the register user command and register nick name command.
Boolean GetUsersInChannel(String channel = ) Sends the get names for specific channels or for all channels.
Boolean IsClientRunning() Gets the client status
Boolean IsConnectionEstablished() Gets the connection status
Boolean QuitConnect() Starts quiting procedure, sends QUIT message to server and waits until server closes connection with the client, after that, it shuts down every reader and stream, and stops the receiver task.
Boolean SendMessageToAll(String input) Sends message to all channels, if message is not one of the following: /msg [bot] xdcc send [pack] /msg [bot] xdcc cancel /msg [bot] xdcc remove [pack] /names [channels] (can be empty) /join [channels] /quit /msg [channel/user] [message]
Boolean SendMessageToChannel(String input, String channel) Sends message to specific channels, if message is not one of the following: /msg [bot] xdcc send [pack] /msg [bot] xdcc cancel /msg [bot] xdcc remove [pack] /names [channels] (can be empty) /join [channels] /quit /msg [channel/user] [message]
Boolean SendRawMsg(String msg) Sends a raw message to the irc server, without any parsing applied
void SetConnectionInformation(String ip, String username, String channel, DCCClient dccClient, String downloadDirectory, Int32 port = 0, String password = , Int32 timeout = 3000, Boolean enableSSL = True) Sets up the information needed for the client to start a connection to the irc server. Sends a warning to the debug message event if ports are out of the standard specified ports for IRC.
void SetDownloadDirectory(String downloadDirectory) Changes the download directory, will apply to the next instantiated download.
void StartReceivingChat() Starts the receiver task.
void StopClient() Stops the client.
Boolean StopXDCCDownload() Stops a download if a download is running.
Boolean WriteIrc(String input) Writes a message to the irc server.

IrcDebugMessageEventArgs

Event class for receiving debug messages from the IrcClient, fired within IrcClient.cs

public class SimpleIRCLib.IrcDebugMessageEventArgs

Properties

Type Name Summary
String Message Containing debug message.
String Type Containing type of message, handy for determining where the message originates from

IrcRawReceivedEventArgs

Event class for receiving raw messages from the irc server, fired within IrcClient.cs

public class SimpleIRCLib.IrcRawReceivedEventArgs

Properties

Type Name Summary
String Message Containing raw message from the irc server

IrcReceivedEventArgs

Event class for receiving messages from specific channels and users, fired within IrcClient.cs

public class SimpleIRCLib.IrcReceivedEventArgs

Properties

Type Name Summary
String Channel Containing channel name where user send his/hers/its message
String Message Containing message from user on a specific channel
String User Containing user name whom send the message on a specific channel

IrcUserListReceivedEventArgs

Event class for receiving a list with users per channel, fired within IrcClient.cs

public class SimpleIRCLib.IrcUserListReceivedEventArgs

Properties

Type Name Summary
Dictionary<String, List<String>> UsersPerChannel Dicitonary containing a list with user names per channel

DCCClient

Class for downloading files using the DCC protocol on a sperarate thread from the main IRC Client thread.

public class SimpleIRCLib.DCCClient

Properties

Type Name Summary
String BotName Bot name where file resides
Int64 BytesPerSecond Download speed in: KB/s
String CurrentFilePath Path to the file that is being downloaded, or has been downloaded
Boolean IsDownloading Check for status of DCCClient
Int32 KBytesPerSecond Download speed in: MB/s
Int32 MBytesPerSecond Download status, such as: WAITING,DOWNLOADING,FAILED:[ERROR],ABORTED
String NewDccString Raw DCC String used for getting the file location (server) and some basic file information
String NewFileName File name of the file being downloaded
Int64 NewFileSize FileSize of the file being downloaded
String NewIp Port of server of file location
Int32 NewPortNum Pack ID of file on bot where file resides
String PackNum Pack ID of file on bot where file resides
Int32 Progress Progress from 0-100 (%)
String Status Download status, such as: WAITING,DOWNLOADING,FAILED:[ERROR],ABORTED

Events

Type Name Summary
EventHandler<DCCDebugMessageArgs> OnDccDebugMessage For firing debug event using DCCDebugMessageArgs from DCCEventArgs.cs
EventHandler<DCCEventArgs> OnDccEvent For firing update event using DCCEventArgs from DCCEventArgs.cs

Methods

Type Name Summary
Boolean AbortDownloader(Int32 timeOut) Stops a download if one is running, checks if the donwnloader thread actually stops.
Boolean CheckIfDownloading() Checks if download is still running.
void Downloader() Method ran within downloader thread, starts a connection to the file server, and receives the file accordingly, sends updates using event handler during the download.
void StartDownloader(String dccString, String downloaddir, String bot, String pack, IrcClient client) Starts a downloader by parsing the received message from the irc server on information

DCCDebugMessageArgs

Event Class for handeling debug events fired within DCCClient.cs

public class SimpleIRCLib.DCCDebugMessageArgs

Properties

Type Name Summary
String Message Containing debug message
String Type Containing debug type

DCCEventArgs

Event Class for containing eventhandler for Download Updates from DCCClient.cs

public class SimpleIRCLib.DCCEventArgs

Properties

Type Name Summary
String Bot Bot name where file resides
Int64 BytesPerSecond Download speed in: B/s
String DccString Raw DCC String used for getting the file location (server) and some basic file information
String FileName File name of the file being downloaded
String FilePath Path to file that is being downloaded
Int64 FileSize FileSize of the file being downloaded
String Ip Server address of file location
Int32 KBytesPerSecond Download speed in: KB/s
Int32 MBytesPerSecond Download speed in: MB/s
String Pack Pack ID of file on bot where file resides
Int32 Port Port of server of file location
Int32 Progress Progress from 0-100 (%)
String Status Download status, such as: WAITING,DOWNLOADING,FAILED:[ERROR],ABORTED