Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(int argc, char *argv[]) {
- //Parse Arguments
- char i;
- int curse = 1;
- while ((i = getopt(argc,argv,"c")) != -1) {
- switch (i) {
- case 'c':
- curse = 0;
- break;
- }
- }
- //Login Info
- string uname, pword, url, chatip, cookie, aid, input, tag;
- if (curse == 0) {
- cout<<"Username: ";
- cin>>uname;
- cout<<"Password: ";
- cin>>pword;
- //MD5 Hash
- pword = MD5String((char*)pword.c_str());
- //Get Serialized Information
- url = login(uname,pword);
- //Deserialize
- deserialize ds;
- vector<string> info = ds.process((char*)url.c_str());
- for(unsigned int i = 0; i < info.size(); i++) {
- if (strstr(info[i].c_str(),"Invalid")) {
- cout<<"Invalid Username or Password.\n";
- exit(1);
- }
- else if (!strcmp(info[i].c_str(),"account_id")) {
- aid = info[i+1];
- }
- else if (!strcmp(info[i].c_str(),"chat_url")) {
- chatip = info[i+1];
- }
- else if (!strcmp(info[i].c_str(),"cookie")) {
- cookie = info[i+1];
- }
- else if (!strcmp(info[i].c_str(),"tag")) {
- tag = info[i+1];
- }
- else if (!strcmp(info[i].c_str(),"buddy_id")) {
- buddies buddy;
- buddy.id = (int*)malloc(sizeof(int));
- *buddy.id = atoi(info[i+1].c_str());
- i += 3;
- buddy.name = (char*)info[i].c_str();
- i += 4;
- buddy.tag = (char*)info[i].c_str();
- buddylist.push_back(buddy);
- }
- }
- uname = "["+tag+"]"+uname;
- //Start up the Curses screen and greet connection
- cursescr scr;
- scr.uname = uname;
- scr.mode = 0;
- tcpwatch tcp;
- tcp.scrhandle = &scr;
- //Start connection
- tcp.setaddress((char*)chatip.c_str());
- if (tcp.greet((char*)cookie.c_str(),(char*)aid.c_str()) != 0) {
- scr.paint_msg("Could not connect to the Heroes of Newerth Chat Server.");
- exit(1);
- }
- //Enter Main Loop
- while (true) {
- input = scr.readinput();
- if (input == "/quit") {
- break;
- }
- else if (input.substr(0,6) == "/join ") { //Join Channel
- tcp.newch((char*)input.substr(5).c_str(),(input.length()-6));
- }
- else if (input.substr(0,6) == "/leave") { //Leave Channel
- tcp.leavech();
- }
- else if (input.substr(0,7) == "/whois ") { //Whois Request
- tcp.whois((char*)input.c_str(),input.length());
- }
- else if (input.substr(0,3) == "/w ") { //Whisper
- tcp.whisper((char*)input.c_str(),input.length());
- }
- else if (input.length() != 0 && input[0] != '/') { //Normal Text Send
- tcp.sendtext((char*)input.c_str(), input.length());
- }
- tcp.rwrap();
- }
- }
- else {
- string dir = argv[0];
- size_t place = dir.find_last_of("/\\");
- chdir(dir.substr(0,place).c_str());
- gtkscr scr;
- tcpwatch tcp;
- int retval = 0;
- scr.id = 0;
- logged_on = FALSE;
- char null[] = {0x00};
- if (read_pref("r") == "yes" && read_pref("u") != "") {
- scr.uname = read_pref("u");
- scr.pword = read_pref("p");
- logged_on = TRUE;
- }
- while (retval != -1) {
- do {
- switch (retval) {
- case 1: //Stats Window
- scr.statwindow(NULL);
- break;
- case 2: //Connect
- if (logged_on == TRUE) {
- tcp.dc();
- }
- logged_on = scr.login();
- break;
- case 3: //Disconnect
- if (logged_on == TRUE) {
- tcp.dc();
- logged_on = FALSE;
- }
- break;
- case 4: //Setup Window
- scr.setupwindow();
- break;
- default:
- break;
- }
- if (logged_on == FALSE) {
- scr.mainloop(FALSE);
- retval = statushandler();
- }
- } while (logged_on == FALSE);
- uname = scr.uname;
- pword = scr.pword;
- if (pword.length() != 32) {
- //MD5 Hash
- pword = MD5String((char*)pword.c_str());
- if (read_pref("r") == "yes") {
- write_pref("u",uname);
- write_pref("p",pword);
- }
- }
- //Get Serialized Information
- url = login(uname,pword);
- //Deserialize
- deserialize ds;
- vector<string> info = ds.process((char*)url.c_str());
- for(unsigned int i = 0; i < info.size(); i++) {
- if (strstr(info[i].c_str(),"Invalid")) {
- scr.paint_msg("Invalid Username or Password.");
- scr.mainloop(FALSE);
- retval = statushandler();
- logged_on = FALSE;
- break;
- }
- else if (!strcmp(info[i].c_str(),"account_id")) {
- int id = atoi(info[i+1].c_str());
- aid = info[i+1];
- if (scr.id == 0) {scr.id = id;}
- }
- else if (!strcmp(info[i].c_str(),"chat_url")) {
- chatip = info[i+1];
- }
- else if (!strcmp(info[i].c_str(),"cookie")) {
- cookie = info[i+1];
- }
- else if (!strcmp(info[i].c_str(),"tag")) {
- tag = info[i+1];
- }
- else if (!strcmp(info[i].c_str(),"buddy_id")) {
- buddies buddy;
- buddy.id = (int*)malloc(sizeof(int));
- *buddy.id = atoi(info[i+1].c_str());
- while (strcmp(info[i].c_str(),"nickname")) {i++;}
- buddy.name = (char*)info[i+1].c_str();
- while (strcmp(info[i].c_str(),"clan_tag")) {i++;}
- if (info[i+1] != ":N:") { //If user is in a clan (has a clan tag)
- buddy.tag = (char*)info[i+1].c_str();
- }
- else {buddy.tag = (char*)"";}
- char null[] = {0x00};
- buddy.status = (char*)malloc(1);
- memcpy(buddy.status,null,1);
- buddylist.push_back(buddy);
- }
- else if (!strcmp(info[i].c_str(),"ignored_list")) {
- int n = 0; i++;
- for (i; ;i++) {
- if (!strcmp(info[i].c_str(),":A:")) {
- n++;
- }
- else if (!strcmp(info[i].c_str(),":N:")) {
- n--;
- }
- else if (!strcmp(info[i].c_str(),"ignored_id")) {
- ignored ignoreuser;
- ignoreuser.id = (int*)malloc(sizeof(int));
- *ignoreuser.id = atoi(info[i+1].c_str());
- if (!strcmp(info[i+2].c_str(),"reason")) {
- ignoreuser.reason = (char*)info[i+3].c_str();
- } else { ignoreuser.reason = (char*)""; }
- while (strcmp(info[i].c_str(),"nickname")) {i++;}
- ignoreuser.name = (char*)info[i+1].c_str();
- ignorelist.push_back(ignoreuser);
- }
- if (n == 0 || !strcmp(info[i].c_str(),"error")) {
- break;
- }
- }
- }
- else if (!strcmp(info[i].c_str(),"banned_list")) {
- int n = 0; i++;
- for (i; ; i++) {
- if (!strcmp(info[i].c_str(),":A:")) {
- n++;
- }
- else if (!strcmp(info[i].c_str(),":N:")) {
- n--;
- }
- else if (!strcmp(info[i].c_str(),"banned_id")) {
- banned banuser;
- banuser.id = (int*)malloc(sizeof(int));
- *banuser.id = atoi(info[i+1].c_str());
- if (!strcmp(info[i+2].c_str(),"reason")) {
- banuser.reason = (char*)info[i+3].c_str();
- } else { banuser.reason = (char*)""; }
- while (strcmp(info[i].c_str(),"nickname")) {i++;}
- banuser.name = (char*)info[i+1].c_str();
- banlist.push_back(banuser);
- }
- if (n == 0 || !strcmp(info[i].c_str(),"error")) {
- break;
- }
- }
- }
- else if (!strcmp(info[i].c_str(),"clan_member_info")) {
- if (!strcmp(info[i+2].c_str(),"error")) {scr.clanname = ""; scr.clantag = ""; break;} //Catch users with no clan
- while (strcmp(info[i].c_str(),"name")) {i++;}
- scr.clanname = (char*)info[i+1].c_str();
- scr.clantag = (char*)info[i+3].c_str();
- }
- else if (!strcmp(info[i].c_str(),"clan_roster")) {
- while (i < info.size()) {
- if (!strcmp(info[i].c_str(),"account_id")) {
- clan member;
- member.id = (int*)malloc(sizeof(int));
- *member.id = atoi(info[i+1].c_str());
- while (strcmp(info[i].c_str(),"nickname")) {i++;}
- member.name = (char*)info[i+1].c_str();
- member.status = (char*)malloc(1);
- char null[] = {0x00};
- memcpy(member.status,null,1);
- clanlist.push_back(member);
- }
- i++;
- }
- }
- }
- if (logged_on == TRUE) {
- if (tag != "") {
- uname = "["+tag+"]"+uname;
- }
- tag = "";
- scr.uname = uname;
- scr.mode = 1;
- scr.log_on();
- tcp.scrhandle = &scr;
- tcp.setaddress((char*)chatip.c_str());
- if (tcp.greet((char*)cookie.c_str(),(char*)aid.c_str()) != 0) {
- scr.paint_msg("Could not connect to the Heroes of Newerth Chat Server.");
- scr.mainloop(FALSE);
- retval = statushandler();
- logged_on = FALSE;
- }
- else {scr.clanupdate();}
- if (read_pref("c") != "") {
- tcp.leavech();
- string chans = read_pref("c");
- string chan;
- for (int i=0; i < chans.length()+1; i++) {
- if (chans[i] == ',' || chans[i] == '\0') {
- tcp.newch((char*)chan.c_str(),chan.length());
- chan.clear();
- }
- else {chan += chans[i];}
- }
- }
- while (logged_on == TRUE) {
- //Handle Text Input
- input = scr.mainloop(TRUE);
- if (input == "/quit") {
- scr.destroy();
- break;
- }
- else if (input.substr(0,5) == "/help") {
- scr.print_help();
- }
- else if (input.substr(0,6) == "/join ") {
- tcp.newch((char*)input.substr(6).c_str(),(input.length()-6));
- }
- else if (input.substr(0,6) == "/leave") {
- tcp.leavech();
- }
- else if (input.substr(0,5) == "/msg " && input.length() > 5) { //Private Message
- scr.privchat((char*)input.substr(5,(input.length()-5)).c_str(),FALSE);
- tcp.storage[tcp.numchan].name = (char*)input.substr(5,(input.length()-5)).c_str();
- tcp.storage[tcp.numchan].id = (char*)"privchat";
- tcp.numchan++;
- }
- else if (input.substr(0,7) == "/emote ") {
- tcp.emote((char*)input.substr(7,input.length()-7).c_str());
- }
- else if (input.substr(0,5) == "/stat") { //Stats
- if (input[5] == ' ' && input.length() > 8) {
- scr.statwindow((char*)input.substr(6,input.length()-6).c_str());
- }
- else { scr.statwindow(NULL); }
- }
- else if (input.substr(0,7) == "/whois ") { //Whois Request
- tcp.whois((char*)input.c_str(),input.length());
- }
- else if (input.substr(0,3) == "/w ") {
- tcp.whisper((char*)input.c_str(),input.length());
- }
- else if (input.substr(0,1) == "\\") { //Priv Message Send
- tcp.privmsg((char*)input.c_str(),input.length());
- }
- else if (input.substr(0,9) == "/banlist " && input.length() > 7) {
- ds.flush();
- string out;
- if (input.substr(9,4) == "add ") {
- char* tid = nick2id((char*)input.substr(13,input.length()-13).c_str());
- if (tid != "-1") {
- ban(scr.id,tid,(char*)"",(char*)cookie.c_str(),TRUE);
- out = "Username " + input.substr(13,input.length()-13) + " successfully banned.";
- }
- else {out = "Username " + input.substr(13,input.length()-13) + " not found.";}
- scr.paint_msg(out);
- }
- if (input.substr(9,7) == "remove ") {
- char* tid = nick2id((char*)input.substr(16,input.length()-16).c_str());
- if (tid != "-1") {
- ban(scr.id,tid,(char*)"",(char*)cookie.c_str(),FALSE);
- out = "Username " + input.substr(16,input.length()-16) + " removed from banlist.";
- }
- else {out = "Username " + input.substr(16,input.length()-16) + " not found.";}
- scr.paint_msg(out);
- }
- if (input.substr(9,4) == "list") {
- string out;
- for (unsigned int i = 0; i < banlist.size(); i++) {
- out = "^r" + (string)banlist[i].name + " ^m" + (string)banlist[i].reason;
- scr.paint_msg(out);
- }
- if (banlist.size() == 0) {
- scr.paint_msg("^bNo users in your banlist!");
- }
- }
- if (input.substr(9,4) == "help") {
- string helpinfo;
- helpinfo = "Banlist Commands:\n";
- helpinfo += "\t/banlist add [user]\t\tAdd 'user' to your banlist.\n";
- helpinfo += "\t/banlist remove [user]\t\tRemove 'user' from your banlist.\n";
- helpinfo += "\t/banlist list\t\t\tList the users in your banlist.\n";
- helpinfo += "\t/banlist help\t\t\tShow this help information.";
- scr.paint_msg(helpinfo);
- }
- }
- else if (input.substr(0,8) == "/ignore " && input.length() > 10) {
- ds.flush();
- if (input.substr(8,4) == "add ") {
- string out;
- char* tid = nick2id((char*)input.substr(12,input.length()-12).c_str());
- if (tid != "-1") {
- ignore(scr.id,tid,(char*)"",(char*)cookie.c_str(),TRUE);
- out = "Username " + input.substr(12,input.length()-12) + " set to ignore.";
- }
- else {out = "Username " + input.substr(12,input.length()-12) + " not found.";}
- scr.paint_msg(out);
- }
- if (input.substr(8,7) == "remove ") {
- string out;
- char* tid = nick2id((char*)input.substr(15,input.length()-15).c_str());
- if (tid != "-1") {
- ignore(scr.id,tid,(char*)"",(char*)cookie.c_str(),FALSE);
- out = "Username " + input.substr(15,input.length()-15) + " no longer ignored.";
- }
- else {out = "Username " + input.substr(15,input.length()-15) + " not found.";}
- scr.paint_msg(out);
- }
- if (input.substr(8,4) == "list") {
- string out;
- for (unsigned int i = 0; i < ignorelist.size(); i++) {
- out = "^r" + (string)ignorelist[i].name + " ^m" + (string)ignorelist[i].reason;
- scr.paint_msg(out);
- }
- if (ignorelist.size() == 0) {
- scr.paint_msg("^bNo users in your ignore list!");
- }
- }
- if (input.substr(8,4) == "help") {
- string helpinfo;
- helpinfo = "Ignore Commands:\n";
- helpinfo += "\t/ignore add [user]\t\tAdd 'user' to your ignore list.\n";
- helpinfo += "\t/ignore remove [user]\t\tRemove 'user' from your ignore list.\n";
- helpinfo += "\t/ignore list\t\t\t\tList the users in your ignore list.\n";
- helpinfo += "\t/ignore help\t\t\tShow this help information.";
- scr.paint_msg(helpinfo);
- }
- }
- else if ((input.substr(0,7) == "/buddy " && input.length() > 7) || (input.substr(0,3) == "/b " && input.length() > 3)) {
- if (input.substr(0,3) == "/b ") {
- input = "/buddy " + input.substr(3,input.length()-3);
- }
- ds.flush();
- if (input.substr(7,4) == "add ") {
- string out;
- char* nick = (char*)malloc(input.length()-11);
- memcpy(nick,&input.substr(11,input.length()-11)[0],input.length()-11);
- char* tid = nick2id(nick);
- if (tid != "-1") {
- buddy(scr.id,tid,(char*)cookie.c_str(),TRUE,nick);
- out = "Username " + input.substr(11,input.length()-11) + " added to buddylist.";
- scr.buddyupdate();
- }
- else {out = "Username " + input.substr(11,input.length()-11) + " not found.";}
- scr.paint_msg(out);
- }
- if (input.substr(7,7) == "delete ") {
- string out;
- char* tid = nick2id((char*)input.substr(14,input.length()-14).c_str());
- if (tid != "-1") {
- buddy(scr.id,tid,(char*)cookie.c_str(),FALSE);
- out = "Username " + input.substr(14,input.length()-14) + " deleted from buddylist.";
- scr.buddyupdate();
- }
- else {out = "Username " + input.substr(14,input.length()-14) + " not found.";}
- scr.paint_msg(out);
- }
- if (input.substr(7,4) == "list") {
- scr.buddy_list();
- }
- if (input.substr(7,8) == "message ") {
- tcp.buddy_message((char*)input.substr(15,input.length()-15).c_str());
- }
- if (input.substr(7,4) == "help") {
- string helpinfo;
- helpinfo = "Buddy Commands:\n";
- helpinfo += "\t/buddy list\t\t\t\tList buddies and their status.\n";
- helpinfo += "\t/buddy help\t\t\tShow this help information.\n";
- helpinfo += "\t/buddy message [msg]\tSend 'msg' to your buddies.\n";
- helpinfo += "\t/buddy add [user]\t\tAdd 'user' to your buddylist.\n";
- helpinfo += "\t/buddy delete [buddy]\tRemove 'buddy' from your buddylist.";
- scr.paint_msg(helpinfo);
- }
- scr.buddyupdate();
- }
- else if (input.substr(0,6) == "/clan ") {
- if (input.substr(6,7) == "invite ") {
- char* nick = (char*)malloc(input.length()-12);
- memcpy(nick,&input.substr(13,input.length()-13)[0],input.length()-13);
- memcpy(nick+(input.length()-13),null,1);
- tcp.clan_invite(nick);
- string out = "Invite sent to " + (string)nick + ".";
- scr.paint_msg(out);
- }
- else if (input.substr(6,7) == "delete ") {
- char* nick = (char*)malloc(input.length()-12);
- memcpy(nick,&input.substr(13,input.length()-13)[0],input.length()-13);
- memcpy(nick+(input.length()-13),null,1);
- tcp.clan_remove(nick);
- string out = (string)nick + " successfully removed from clan.";
- scr.paint_msg(out);
- }
- else if (input.substr(6,5) == "leave") {
- char* nick = (char*)uname.substr(scr.clantag.length()+2,uname.length()-(scr.clantag.length()+2)).c_str();
- tcp.clan_remove(nick);
- scr.paint_msg("You have left the clan.");
- }
- else if (input.substr(6,8) == "message ") {
- char* msg = (char*)malloc(input.length()-13);
- memcpy(msg,&input.substr(14,input.length()-14)[0],input.length()-14);
- memcpy(msg+(input.length()-14),null,1);
- tcp.clan_message(msg);
- }
- else if (input.substr(6,8) == "promote ") {
- char* nick = (char*)malloc(input.length()-13);
- memcpy(nick,&input.substr(14,input.length()-14)[0],input.length()-14);
- memcpy(nick+(input.length()-14),null,1);
- tcp.clan_mote(nick,TRUE);
- }
- else if (input.substr(6,7) == "demote ") {
- char* nick = (char*)malloc(input.length()-12);
- memcpy(nick,&input.substr(13,input.length()-13)[0],input.length()-13);
- memcpy(nick+(input.length()-13),null,1);
- tcp.clan_mote(nick,FALSE);
- }
- else if (input.substr(6,4) == "list") {
- scr.clan_list();
- }
- else if (input.substr(6,4) == "help") {
- string helpinfo;
- helpinfo = "Clan Commands:\n";
- helpinfo += "\t/clan list\t\t\t\tList clan members and status.\n";
- helpinfo += "\t/clan help\t\t\t\tShow this help information.\n";
- helpinfo += "\t/clan message [msg]\t\tSend 'msg' to your clan.\n";
- helpinfo += "\t/clan promote [member]\tPromote 'member' in the clan.\n";
- helpinfo += "\t/clan demote [member]\tDemote 'member' in the clan.\n";
- helpinfo += "\t/clan delete [member]\tRemove 'member' from the clan.\n";
- helpinfo += "\t/clan invite [user]\t\tInvite 'user' to the clan.\n";
- helpinfo += "\t/clan leave\t\t\tLeave the clan.";
- scr.paint_msg(helpinfo);
- }
- }
- else if (input.substr(0,7) == "/topic ") {
- tcp.topic((char*)input.substr(7,input.length()-7).c_str());
- }
- else if (input.substr(0,6) == "/kick ") {
- tcp.kick((char*)input.substr(6,input.length()-6).c_str());
- }
- else if (input.substr(0,5) == "/ban ") {
- tcp.ban((char*)input.substr(5,input.length()-5).c_str(),TRUE);
- }
- else if (input.substr(0,7) == "/unban ") {
- tcp.ban((char*)input.substr(7,input.length()-7).c_str(),FALSE);
- }
- else if (input.substr(0,9) == "/silence ") {
- int s = input.find(" ",9);
- tcp.silence((char*)input.substr(9,(s-9)).c_str(),atoi(input.substr(s,input.length()-s).c_str()));
- }
- else if (input.substr(0,6) == "/auth ") {
- if (input.substr(6,4) == "add ") {
- tcp.auth(0,(char*)input.substr(10,input.length()-10).c_str());
- }
- if (input.substr(6,7) == "delete ") {
- tcp.auth(1,(char*)input.substr(13,input.length()-13).c_str());
- }
- if (input.substr(6,6) == "enable") {tcp.auth(2);}
- if (input.substr(6,7) == "disable") {tcp.auth(3);}
- if (input.substr(6,4) == "help") {
- string helpinfo;
- helpinfo = "Channel Authorization Commands:\n";
- helpinfo += "\t/auth add [user]\t\t\t\tAuthorize 'user' in the current channel.\n";
- helpinfo += "\t/auth delete [user]\t\t\tDelete 'user' from current channel authorization.\n";
- helpinfo += "\t/auth enable\t\t\t\tAllow only authorized users in the channel.\n";
- helpinfo += "\t/auth disable\t\t\t\tAllow any users in the channel.\n";
- helpinfo += "\t/auth help\t\t\t\t\tShow this help information.";
- scr.paint_msg(helpinfo);
- }
- }
- else if (input.substr(0,9) == "/promote ") {
- tcp.mote((char*)input.substr(9,input.length()-9).c_str(),true);
- }
- else if (input.substr(0,8) == "/demote ") {
- tcp.mote((char*)input.substr(8,input.length()-8).c_str(),false);
- }
- else if (input.substr(0,9) == "/password") {
- if (input.length() > 9) {
- tcp.password((char*)input.substr(10,input.length()-10).c_str());
- }
- else { tcp.password((char*)"");}
- }
- else if (input.substr(0,4) == "/afk") {
- if (input.length() > 4) {
- tcp.avail(1,(char*)input.substr(5,input.length()-5).c_str());
- }
- else { tcp.avail(1,(char*)"Away from Keyboard"); }
- }
- else if (input.substr(0,4) == "/dnd") {
- if (input.length() > 4) {
- tcp.avail(2,(char*)input.substr(5,input.length()-5).c_str());
- }
- else { tcp.avail(2,(char*)"Do Not Disturb"); }
- }
- else if (input.substr(0,10) == "/available") {
- tcp.avail(0, (char*)"chat_command_available_message");
- }
- else if (input.length() != 0 && input[0] != '/' && scr.curchan != 0) {
- tcp.sendtext((char*)input.c_str(), input.length());
- }
- //Handle Right Clicks
- if (eventrecord.event != NULL) {
- ds.flush();
- char* tid = nick2id(eventrecord.args);
- if (tid != "-1") {
- if (eventrecord.event == "stats") {
- scr.statwindow(eventrecord.args);
- }
- else if (eventrecord.event == "whois") {
- input = "/whois " + (string)eventrecord.args;
- tcp.whois((char*)input.c_str(),input.length());
- }
- else if (eventrecord.event == "msg") {
- scr.privchat(eventrecord.args,FALSE);
- tcp.storage[tcp.numchan].name = eventrecord.args;
- tcp.storage[tcp.numchan].id = (char*)"privchat";
- tcp.numchan++;
- }
- else if (eventrecord.event == "whisper") {
- input = "/w " + (string)eventrecord.args + " ";
- scr.writeinput((char*)input.c_str());
- }
- else if (eventrecord.event == "buddy") {
- buddy(scr.id,tid,(char*)cookie.c_str(),TRUE,eventrecord.args);
- string out = "Username " + (string)eventrecord.args + " added to buddylist.";
- scr.paint_msg(out);
- scr.buddyupdate();
- }
- else if (eventrecord.event == "rbuddy") {
- buddy(scr.id,tid,(char*)cookie.c_str(),FALSE);
- string out = "Username " + (string)eventrecord.args + " removed from buddylist.";
- scr.paint_msg(out);
- scr.buddyupdate();
- }
- else if (eventrecord.event == "ignore") {
- ignore(scr.id,tid,NULL,(char*)cookie.c_str(),TRUE);
- string out = "Username " + (string)eventrecord.args + " set to ignore.";
- scr.paint_msg(out);
- }
- else if (eventrecord.event == "ban") {
- ban(scr.id,tid,NULL,(char*)cookie.c_str(),TRUE);
- string out = "Username " + (string)eventrecord.args + " successfully banned.";
- scr.paint_msg(out);
- }
- }
- eventrecord.event = NULL;
- eventrecord.args = (char*)"";
- }
- //Handle closing channels
- if (channelexit != -1) {
- tcp.leavech(channelexit);
- channelexit = -1;
- }
- //Receive any pending packets
- tcp.rwrap();
- if (strlen(status) > 0) {
- retval = statushandler();
- if (retval == 1) {scr.statwindow(NULL);}
- if (retval == 4) {scr.setupwindow();}
- else {break;}
- }
- }
- }
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment