Hello There, Guest!
View New Posts  |  View Today's Posts
[C#] IRC Client Class

ii 
  • 0 Vote(s) - 0 Average


01-28-2012, 06:14 PM #1
KoBE
¯\_(ツ)_/¯
******
Global Moderators
Posts: 4,862 Threads:494 Joined: Jun 2011 Reputation: 67

IRC Client Class
Update ( 08/01/2014 ) :
I've added this project to GitHub. All source can be seen there ( https://github.com/cshivers/IrcClient-csharp ). Doing so, I've decided to roll the version back to v1.0. All version updates will be reflected on GitHub.

Update (01/13/2014) :
I've finally made the class multi-threaded and thread-safe so the end-user doesn't have to worry about cross-thread operations. I will put together an example app eventually, but here is the source. It's currently written in C# so if you want to use it in VB.Net apps you'll have to compile it yourself until I am able to get a DLL uploaded.
  • The class is set up to trigger events and let the user handle only what they wish to handle.
  • Current events:
    • UserJoined - fires when a user joins
    • UserLeft - fires when a user quits
    • ChannelMessage - fires when a channel message is received
    • PrivateMessage - fires when a private message is received
    • NoticeMessage - fires when a notice is received
    • UpdateUserList - fires when the IRC numeric 353 is received (user list)
    • NickTaken - fires if the client's nick is in use already
    • Disconnected - fires when the client is disconnected (currently disabled)
    • OnConnected- fires when the client is connected (when you are able to join a channel)
    • NickChanged- fires if someone changes their nick
    • ExceptionThrown- fires when an exception is thrown on the underlying thread
Example usage:
Code:
// new instance
client = new IrcClient("server", 6667);

// connect to the server
client.Connect();

// join channel
client.JoinChannel("#channel");

//send message
client.SendMessage("#channel","Message");

//send notice
client.SendNotice("user","Message");

C# listen to events:
Code:
irc.ChannelMessage += (c, u, m) =>
{
    rtbOutput.AppendText(u + ":\t" + m + "\n");
    rtbOutput.ScrollToCaret();
};

VB.Net listen to events:
Code:
Private WithEvents irc As IrcClient
Private Sub irc_ChannelMessage(Channel As String, User As String, Message As String) Handles irc.ChannelMessage
    rtbOuput.AppendText(User & ":" & vbTab & Message & vbNewLine);
End Sub

Private Sub irc_OnConnect() Handles irc.OnConnect
    irc.JoinChannel("#techlifeforum")
End Sub

Preview:



Demo Apps:
http://tech.reboot.pro/showthread.php?ti...6#pid15106
This post was last modified: 08-01-2014, 01:47 PM by KoBE.

01-28-2012, 07:00 PM #2
AceInfinity
Developer
*******
Administrators
Posts: 9,733 Threads:1,026 Joined: Jun 2011 Reputation: 76

RE: IRC Client Class [Development]
Chat time = slower development lol

Sounds interesting KoBE anyways :)


Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer

Development Site: aceinfinity.net

 ▲
 ▲ ▲

01-30-2012, 03:59 PM #3
KoBE
¯\_(ツ)_/¯
******
Global Moderators
Posts: 4,862 Threads:494 Joined: Jun 2011 Reputation: 67

RE: IRC Client Class [Development]
I've updated the OP with a video of what I have so far along with an example usage.

01-30-2012, 07:04 PM #4
AceInfinity
Developer
*******
Administrators
Posts: 9,733 Threads:1,026 Joined: Jun 2011 Reputation: 76

RE: IRC Client Class [Development]
Haha, soon as I heard that Nightwish song I started laughing lol. Reminded me of that other post you made when you were drunk, then I imagined you coding this at that point in time Laugh

It looks good though, I forgot about using that intro in my videos... Nice work NormalSmile


Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer

Development Site: aceinfinity.net

 ▲
 ▲ ▲

01-30-2012, 07:45 PM #5
KoBE
¯\_(ツ)_/¯
******
Global Moderators
Posts: 4,862 Threads:494 Joined: Jun 2011 Reputation: 67

RE: IRC Client Class [Development]
There are quite a lot of IRC Numeric codes that I could put into this.

I'm going to add some error handling and a bit more functionality (IsConnected, Username already taken, ITENTIFY, GHOST, etc..)

Or maybe, I'll just add a SendRaw() method, and let whoever is using the class send that themselves.

After this class is pretty stable, I think I'm going to build a Tech-Bot with it. When I do that, I am going to try my hands at developing a plugin framework (never tried :\). That way people can develop their own games/auto-respond type plugins for it. If I get that far with this then I think it'd be sweet!

01-30-2012, 09:55 PM #6
AceInfinity
Developer
*******
Administrators
Posts: 9,733 Threads:1,026 Joined: Jun 2011 Reputation: 76

RE: IRC Client Class [Development]
I personally just used RAW packets when I was scripting in mIRC.

That would be cool though, I was going to develop plugin functionality for my notepad too but I left it where it's at as I was working on higher priority changes at the time.

All that lazy code I had in it previously from having to restart the development on my app after everything turned to s*** when my designer corrupted for that project was also fixed.


Microsoft MVP .NET Programming - (2012 - Present)
®Crestron DMC-T Certified Automation Programmer

Development Site: aceinfinity.net

 ▲
 ▲ ▲

02-09-2012, 08:04 AM #7
antispam
Junior Member
**
Posts: 1 Threads:0 Joined: Feb 2012 Reputation: 0

RE: IRC Client Class [Development]
Testing..
Nice work KoBE :-)

02-09-2012, 09:54 AM #8
Sam Baker
I LOVE TLF!!!
*****
BSOD Crew
Posts: 1,525 Threads:76 Joined: Jun 2011 Reputation: 40

RE: IRC Client Class [Development]
5 billion and 1 new IRC bots coming your way lol
your code is going to get ripped over and over and over!
if you charge 1¢ by rip you will be a millionaire! :P
Now i am become death,The destroyer of worlds ~oppenheimer


02-09-2012, 03:34 PM #9
KoBE
¯\_(ツ)_/¯
******
Global Moderators
Posts: 4,862 Threads:494 Joined: Jun 2011 Reputation: 67

RE: IRC Client Class [Development]
Lol, if this is going to get ripped, wait for the release of my actual client. This is just the base class that makes it possible.

Thanks for the kind (HG style) words. :D

02-13-2012, 12:13 PM #10
KoBE
¯\_(ツ)_/¯
******
Global Moderators
Posts: 4,862 Threads:494 Joined: Jun 2011 Reputation: 67

RE: IRC Client Class v1.0
Updated the OP with the full source. I will be creating a thread showing how to use this class in your own projects.


ii 


Forum Jump:


Possibly Related Threads...
Thread Author Replies Views Last Post
   Create your own IRC Client [C#/VB.Net] KoBE 185 124,870 10-01-2016, 06:57 PM
Last Post: AceInfinity
Star  Multi-Client Server Async Socket Example KoBE 165 173,503 09-10-2016, 05:17 AM
Last Post: R4TK3N
  Telnet Client AceInfinity 5 2,991 06-05-2016, 07:48 PM
Last Post: AceInfinity
   Twitch chat bot (irc client) dmgvol 11 19,779 08-24-2015, 11:59 PM
Last Post: Signal_20
   Justin.tv and Twitch.tv chat client. KoBE 41 23,665 07-13-2015, 11:02 PM
Last Post: KoBE


Users browsing this thread: 1 Guest(s)