Advertisement
captmicro

Untitled

May 11th, 2013
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. //check for PRIVMSG
  2.         char *privmsg = strstr(buffer, "PRIVMSG ");
  3.         if (privmsg != 0) //found!
  4.         {
  5.             char *chr, old, nick[512], msg[4096];
  6.  
  7.             memset(nick, 0, 512);
  8.             chr = strchr(buffer, '!');
  9.             if ((chr - buffer) > 32)
  10.                 chr = strchr(buffer, ' ');
  11.             old = *chr; *chr = 0;
  12.             strcpy(nick, buffer + 1);
  13.             *chr = old;
  14.  
  15.             memset(msg, 0, 4096);
  16.             chr = strchr(privmsg, ':');
  17.             strcpy(msg, chr + 1);
  18.             chr = strchr(msg, '\r');
  19.             if (chr != 0) *chr = 0;
  20.  
  21.             printf("\n================\n%s: %s\n================\n",
  22.                 nick, msg);
  23.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement