GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: Add Line Numbers


erroneus code by merlin
#include <iostream>
#include <windows.h>
#include <process.h>

#include "IRC.h"

using namespace std;

int R_End_Motd(char *params, irc_reply_data *hostdata, void *conn) {
    IRC *irc_conn = (IRC*)conn;

    irc_conn->privmsg("ChanServ", "vhost blah blah");

    return 0;
}

int R_VHost_Login(char *params, irc_reply_data *hostdata, void *conn) {
    IRC *irc_conn = (IRC*)conn;
    
    if (!strcmp(hostdata->nick, "ChanServ")) {
        irc_conn->join("#channel");
    }

    return 0;
}

void Thread_CMD(void *conn) {
    IRC *irc_conn = (IRC*)conn;
    
    getc(stdin);
    irc_conn->quit("TestIRC v0.1");
    _endthread();
}

void main() {
    IRC conn;
    WSADATA wsaData;

    if (WSAStartup(MAKEWORD(1,1), &wsaData)) {
        cout << "Failed to initialise winsock!" << endl;
    }

    conn.hook_irc_command("376", &R_End_Motd);
    conn.hook_irc_command("NOTICE", &R_VHost_Login);

    _beginthread(Thread_CMD, 0, (void*)&conn);
    conn.start("ca.enterthegame.com", 6667, "SillyBot", "SillyBot", "SillyBot", "");
    conn.message_loop();
    WSACleanup();
}