fixed last commit
[NeonServV5.git] / cmd_neonserv_resync.c
index a05c0eecb6d6234feff0f8c4cb8e898e4636b558..5ce398305d0ab694fbf81c49bc6d012604a4a618 100644 (file)
@@ -16,7 +16,7 @@ struct neonserv_cmd_resync_cache {
 };
 
 static CMD_BIND(neonserv_cmd_resync) {
-    int min_access = 1, max_access = 500;
+    int min_access = 0, max_access = 500;
     char *usermask = NULL;
     if(argc > 0)
         usermask = argv[0];
@@ -48,16 +48,18 @@ static USERLIST_CALLBACK(neonserv_cmd_resync_userlist_lookup) {
 
 static void neonserv_cmd_resync_async1(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, char *usermask, int min_access, int max_access) {
     MYSQL_RES *res;
-    MYSQL_ROW row, defaults;
+    MYSQL_ROW row, defaults = NULL;
     int i;
     int resync_op = 1;
     int resync_voice = 1;
     if(usermask && usermask[0] == '@') {
         resync_voice = 0;
         usermask++;
+        if(!*usermask) usermask = NULL;
     } else if(usermask && usermask[0] == '+') {
         resync_op = 0;
         usermask++;
+        if(!*usermask) usermask = NULL;
     }
     struct ChanUser *chanuser;
     int db_enfops, db_enfvoice;
@@ -96,7 +98,7 @@ static void neonserv_cmd_resync_async1(struct ClientSocket *client, struct Clien
                 }
             }
         }
-        if((usermask && match(usermask, row[1])) || caccess < min_access || caccess > max_access) continue;
+        if((usermask && *usermask && match(usermask, row[1])) || caccess < min_access || caccess > max_access) continue;
         if(caccess >= db_enfops) {
             if(!(chanuser->flags & CHANUSERFLAG_OPPED) && resync_op)
                 modeBufferOp(modeBuf, chanuser->user->nick);