import "ecere" import "console" static IRCSocket ircSocket { }; static Console console { text = "Ecere IRC Client"; hasClose = true; hasMaximize = true; hasMinimize = true; borderStyle = sizable; anchor = { 0, 0, 0, 0 }; background = black; alpha = 255; logTextColor = white; editTextColor = white; editHeight = 16; // height = 480; referenceHeight = 480; bool ProcessCommand(const char * command) { bool result = false; char *tokens[10]; int count = Tokenize((char *)command, 10, tokens, false); // ==== OFFLINE ==== // Exit if(!strcmp(tokens[0], "/exit")) { ((GuiApplication)__thisModule).desktop.Destroy(0); result = true; } // Server else if(!strcmp(tokens[0], "/server")) { if(count > 1) { //ircSocket = eSocket_Connect("paris.fr.eu.undernet.org", 6667, OnConnect, null); //ircSocket = eSocket_Connect("irc2.magic.ca", 6667, OnConnect, null); ircSocket.Connect(tokens[1], 6667); } } // ==== ONLINE ==== else if(ircSocket) { char sendbuf[1024]; // nick if(!strcmpi(tokens[0], "/nick")) { ircSocket.Sendf( "NICK %s\n", tokens[1]); ircSocket.Sendf("USER %s %s %s %s\n", tokens[1], tokens[1], tokens[1], tokens[1]); } // msg else if(!strcmpi(tokens[0], "/msg")) { int c; sprintf(sendbuf, "PRIVMSG %s :", tokens[1]); for(c = 2; c 1) { strcpy(sendbuf, "JOIN "); if (tokens[1][0] != '#' && tokens[1][0] != '&') { strcat(sendbuf, "#"); } strcat(sendbuf, tokens[1]); } strcat(sendbuf, "\n"); ircSocket.SendString(sendbuf); } // AUTRE else { int c; strcpy(sendbuf, tokens[0]); for(c = 1; c 1) { buffer[count-2] = 0; console.Log("\nIDENT:"); console.Log(buffer); Sendf("%s : USERID : OTHER : jerome\n", buffer); } return count; } } class IdentService : Service { port = 113; void OnAccept() { IdentSocket { this }; } } static IdentService identService { }; class IRCApp : GuiApplication { bool Init() { identService.Start(); return true; } }