Merge branch 'master' into IOMultiplexer
[NeonServV5.git] / src / IRCParser.c
index 0188de9b6798918c21b6a300a9b121ad403120c6..f9e79e0c127c720b34a67f96db5217334d0a2738 100644 (file)
@@ -35,27 +35,10 @@ 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);
 static void parse_raw(struct ClientSocket *client, char *from, char *cmd, char **argv, int argc);
 
-int parse_lines(struct ClientSocket *client, char *lines, int len) {
-    int i, used = 0;
-    char *line = lines;
-    for(i = 0; i < len; i++) {
-        if(lines[i] == '\r') //just zero it out :D
-            lines[i] = 0;
-        if(lines[i] == '\n') {
-            lines[i] = 0;
-            parse_line(client, line);
-            line = lines+(i+1);
-            used = i+1;
-        }
-    }
-    return used;
-}
-
-static void parse_line(struct ClientSocket *client, char *line) {
+void parse_line(struct ClientSocket *client, char *line) {
     int argc = 0;
     char *argv[MAXNUMPARAMS];
     #ifdef HAVE_THREADS
@@ -188,10 +171,15 @@ static IRC_CMD(raw_join) {
         event_registered(user, from);
         user->flags &= ~USERFLAG_WAS_REGISTERING;
     } else if(!(chan->flags & CHANFLAG_RECEIVED_USERLIST)) {
+        if(!isBot(user)) {
+            DESYNCHRONIZE(cache_sync);
+            return 1; //ignore join
+        }
+        
         chanuser = addChanUser(chan, user);
         chanuser->visCount = 1;
         
-        if(isBot(user) && isModeSet(chan->modes, 'D')) //if the bot joins a channel it could also be invisible
+        if(isModeSet(chan->modes, 'D')) //if the bot joins a channel it could also be invisible
             chanuser->flags |= CHANUSERFLAG_INVISIBLE;
         
         get_userlist_with_invisible(chan, 0, got_channel_userlist, chanuser);