struct irc_cmd *irc_commands = NULL;
static struct UserNode *registering_users = NULL;
+int statistics_privmsg = 0;
+int statistics_network_users = 0;
+int statistics_network_channels = 0;
static void parse_line(struct ClientSocket *client, char *line);
static void register_irc_function(char *command, irc_cmd_t *func);
if(argv[0][0] == '#') { //Channel message
struct ChanNode *chan = getChanByName(argv[0]);
if(chan && chan->chanbot == client->user) {
+ if(statistics_enabled)
+ statistics_privmsg++;
if(argv[1][0] == '\001') {
char *cmd = &argv[1][1];
char *text = strstr(cmd, " ");
return 1;
}
+static IRC_CMD(raw_251) {
+ if(argc < 2) return 0;
+ char *total_user_str = argv[1];
+ char total_visible[20], total_invisible[20];
+ int i, total_visible_pos = 0, total_invisible_pos = 0;
+ while(*total_user_str) {
+ if(*total_user_str == ' ') {
+ i++;
+ } else if(i == 2) {
+ if(total_visible_pos < 20)
+ total_visible[total_visible_pos++] = *total_user_str;
+ } else if(i == 5) {
+ if(total_invisible_pos < 20)
+ total_invisible[total_invisible_pos++] = *total_user_str;
+ }
+ total_user_str++;
+ }
+ total_visible[total_visible_pos] = '\0';
+ total_invisible[total_invisible_pos] = '\0';
+ statistics_network_users = atoi(total_visible) + atoi(total_invisible);
+ return 1;
+}
+
+static IRC_CMD(raw_254) {
+ if(argc < 3) return 0;
+ statistics_network_channels = atoi(argv[1]);
+ statistics_update();
+ return 1;
+}
+
void init_parser() {
//all the raws we receive...
register_irc_function("001", raw_001);
+ register_irc_function("251", raw_251);
+ register_irc_function("254", raw_254);
register_irc_function("324", raw_324);
register_irc_function("367", raw_367);
register_irc_function("INVITE", raw_invite);