All pastes #188405 Raw Edit

IRCLib

public text v1 · immutable
·published 2006-10-02 01:54 UTC
rendered paste body
using System;
using System.Collections.Generic;
using System.Text;
using IRCLib;
using System.Windows.Forms;

namespace IRCLib_Tester {
    class Program {
        static Client cl;
        static void Main(string[] args) {
            cl = new Client("void", "leet");
            cl.Message += new MessageEventHandler(cl_Message);
            cl.Raw += new RawEventHandler(cl_Raw);
            cl.RawSend += new RawSendEventHandler(cl_RawSend);
            cl.Connect("irc.farklem.com", 6667);
            System.Threading.Thread.Sleep(6000);
            cl.JoinChannel("#trp");
        }

        static void cl_RawSend(object sender, RawSendArgs e) {
            Console.WriteLine("<- " + e.Message);
        }

        static void cl_Raw(object sender, RawArgs e) {
            Console.WriteLine("-> " + e.Message);
        }

        static void cl_Message(Client sender, MessageArgs e) {
            string[] data = e.Message.Split(" ".ToCharArray());
            string param = "";
            for (int x = 1; x < data.Length; x++) {
                param += data[x] + " ";
            }

            if (e.Origin.Nickname == "VoiDeD") {
                if (data[0] == "!channels") {
                    string chans = "";
                    foreach (string tchan in cl.Channels) {
                        chans += tchan + " ";
                    }
                    cl.SendMessage(e.Channel, "I am on: " + chans);
                }
                if (data[0] == "!say") {
                    cl.SendMessage(e.Channel, param);
                }
                if (data[0] == "!nick") {
                    cl.Nick = param;
                }
                if (data[0] == "!quit") {
                    cl.Disconnect(param);
                }
                if (data[0] == "!action") {
                    cl.SendAction(e.Channel, param);
                }
                if (data[0] == "!join") {
                    cl.JoinChannel(param);
                }
                if (data[0] == "!part") {
                    cl.PartChannel(param);
                }
            }
        }
    }
}