Support Forums

Full Version: IRC Class Libaray 1.1 - C++ IRC bots made easy
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hey guys, here's my C++ IRC class library, it now had even more IRC protocol managing functions that the last version, and it uses C++ strings instead of C-style character arrays.

This object class is very easy to use and takes care of all the socket programing so you dont have to Oui

Heres an example irc bot skeleton using my irc class:

Code:
/*  Example of IRC class usage
    Coded by delme
*/

#include "irc.cpp"

int main() {
    //set options here
    string IRCServer = "irc.swiftirc.net";
    int IRCPort = 6667;
    string Nick = "BotNick";
    string Channel = "#bot-test";

    string sBuffer;
    int i;

    IRC irc;
    if (irc.Connect(IRCServer,IRCPort) != IRC_CONNECT_SUCESS) {
        return 0;
    }
    irc.Register(Nick);
    irc.Join(Channel);

    while(1) {
        sBuffer = irc.RecvData();
        if (irc.GetLastError()!=IRC_RECIEVE_ERROR) {
            i = irc.ParseData(sBuffer);
            if (i==IRC_PRIVMSG) {
                //privmsg
                if (irc.s_privmsg.Message=="!quit") {
                    irc.Notice("Quitting...",irc.s_privmsg.User);
                    break;
                }
            }
        } else {
            break;
        }
    }
    irc.Quit();
    return 0;
}

Here are the files:

IRC Class download:
[Image: logo.gif]

IRC Class and an example Code::Blocks project using it:
[Image: logo.gif]

A help file containing info on all functions/data structures/and implementations inside the class (please read this before asking me any questions concerning the usage of this class):
[Image: logo.gif]

I hope you guys find this useful!

Please leave your opinions bellow Oui

If you need any help also don't hesitate to ask.

Edit log:
Code:
[24/05/10] Edited the class a bit, added an example project and added a help file - updated post
[26/05/10] Updated to version 1.1 - all errors fixed and lots more functions added
Updated the main post, added a help file and an example Code::Blocks project.
Awesome man, thanks for the good share appreciate it.
(05-24-2010, 01:02 AM)† KaLaShNiKoV † Wrote: [ -> ]Awesome man, thanks for the good share appreciate it.

No problem Smile
It has been pointed out to me that there is a possibility of a stack overflow in this library (my bad Big Grin) if you have already downloaded this library please discontinue use until I have it fixed, hopefuly today or tomorow.

Sorry guys :S
Bump, fixed all errors and released version 1.1, read the help file for any info on the new functions and new way of using the class.
I like this Class, it's a bit buggy though, when will the next one be released? Smile
(06-09-2010, 09:33 AM)TomC Wrote: [ -> ]I like this Class, it's a bit buggy though, when will the next one be released? Smile

There is a new one in progress, I should have finished it soon, I have homework and stuff at the moment though, I just need some help with using getaddrinfo() as gethostbyname has been depreciated and declaring strings inside a class, instead of globaly. If anyone can offer any ideas?
Hi,

how many time do you need for the new version?

I want this use in my programm, that i develop in this days.

Thank you
Very nice share mate, i'll add this to my collection. It may come useful later Smile
Pages: 1 2