modules/server/input.h File Reference

Go to the source code of this file.

Functions

int server_parse_input (char *text)


Function Documentation

int server_parse_input ( char *  text  ) 

Definition at line 28 of file input.c.

References irc_msg::args, bind_check(), BIND_RET_BREAK, BT_raw, BT_server_input, irc_msg::cmd, egg_msprintf(), global_input_string, irc_msg_cleanup(), irc_msg_parse(), LOG_RAW, irc_msg::nargs, NULL, irc_msg::prefix, putlog(), server_config, uhost_cache_lookup, and user_lookup_by_irchost().

00029 {
00030   irc_msg_t msg;
00031   char *from_nick = NULL, *from_uhost = NULL;
00032   user_t *u = NULL;
00033   char buf[128], *full;
00034   int r;
00035 
00036   if (global_input_string) {
00037     free(global_input_string);
00038     global_input_string = NULL;
00039   }
00040   r = bind_check(BT_server_input, NULL, text, text);
00041   if (r & BIND_RET_BREAK) return(0);
00042   if (global_input_string) text = global_input_string;
00043 
00044   /* This would be a good place to put an SFILT bind, so that scripts
00045     and other modules can modify text sent from the server. */
00046   if (server_config.raw_log) {
00047     putlog(LOG_RAW, "*", "[@] %s", text);
00048   }
00049 
00050   irc_msg_parse(text, &msg);
00051 
00052   if (msg.prefix) {
00053     from_nick = msg.prefix;
00054     from_uhost = strchr(from_nick, '!');
00055     if (from_uhost) {
00056       u = user_lookup_by_irchost(from_nick);
00057       *from_uhost = 0;
00058       from_uhost++;
00059     }
00060     else {
00061       from_uhost = uhost_cache_lookup(from_nick);
00062       if (from_uhost) {
00063         full = egg_msprintf(buf, sizeof(buf), NULL, "%s!%s", from_nick, from_uhost);
00064         u = user_lookup_by_irchost(full);
00065         if (full != buf) free(full);
00066       }
00067     }
00068   }
00069 
00070   bind_check(BT_raw, NULL, msg.cmd, from_nick, from_uhost, u, msg.cmd, msg.nargs, msg.args);
00071   irc_msg_cleanup(&msg);
00072   return(0);
00073 }


Generated on Sun Nov 30 18:43:36 2008 for eggdrop1.9 by  doxygen 1.5.6