See what's going on with flipcode!




This section of the archives stores flipcode's complete Developer Toolbox collection, featuring a variety of mini-articles and source code contributions from our readers.

 

  IRC Class Library
  Submitted by



This is an IRC class library I wrote in C#; it was my first project when transitioning over from C++. I've cleaned up the code quite a bit, so it should be readable. I'm doubtful many of you are coding in .Net languages at this point, but when DirectX 9 is released.. ;-) Anyway, if you ever feel like writing a chat client, or want to integrate one into your app or game, this may help you. :-) It's fully CLS-compliant, so you should be able to use it in VB.Net, etc. also.

How to use NetIdent. just instantiate it. It's a pretty simplistic and featureless Ident server, but sometimes you need one to get into IRC servers, so. :-)

How to use NetIRC. well, to initialize it you have to pass it a stream. The easiest way to do this is:

IrcClient client = new IrcClient(new TcpClient("irc.enterthegame.com", 6667).GetStream());

Now you'll want to add some methods to the various event handlers, and then call IrcClient.Login. Login doesn't block, like most of the methods, so you'll probably want to wait until the GotMotdEnd event is fired before doing anything else. Then you can go client.Join("#flipcode"); or somesuch. :-) This is not blocking, so you won't have joined #flipcode until the GotNameListEnd event is fired (you'll get that after possibly multiple firings of GotNameListReply, which will tell you the names of the people in the channel). Also, CHM format documentation (yay NDoc!) and precompiled binaries with Strong Names are available at my newly created (and quite hideous) website http://www.illusorystudios.com/coding/. If you don't care to fiddle with compiling the thing, these will be useful to you. :-)

Lastly, the license is more or less zlib's with the names changed, so it should be quite useable. :-)


The zip file viewer built into the Developer Toolbox made use of the zlib library, as well as the zlibdll source additions.

 

Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.