X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=cmd_neonserv_resync.c;h=c9d4bba40d11c86e57f660b096715f63435f6154;hb=795115bf680185ae01043bd1222b78bfed8c1d87;hp=a05c0eecb6d6234feff0f8c4cb8e898e4636b558;hpb=c955324b8d2e776fc73b5ed16a26c1c5a3482a09;p=NeonServV5.git diff --git a/cmd_neonserv_resync.c b/cmd_neonserv_resync.c index a05c0ee..c9d4bba 100644 --- a/cmd_neonserv_resync.c +++ b/cmd_neonserv_resync.c @@ -1,4 +1,6 @@ +#include "cmd_neonserv.h" + /* * argv[0] - usermask * argv[1] - min access @@ -15,8 +17,8 @@ struct neonserv_cmd_resync_cache { int max_access; }; -static CMD_BIND(neonserv_cmd_resync) { - int min_access = 1, max_access = 500; +CMD_BIND(neonserv_cmd_resync) { + int min_access = 0, max_access = 500; char *usermask = NULL; if(argc > 0) usermask = argv[0]; @@ -48,16 +50,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,19 +100,19 @@ 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); } else if(caccess >= db_enfvoice) { - if((chanuser->flags & CHANUSERFLAG_OPPED) && resync_op) + if((chanuser->flags & CHANUSERFLAG_OPPED) && resync_op && !(chanuser->user->flags & (USERFLAG_ISBOT | USERFLAG_ISIRCOP))) modeBufferDeop(modeBuf, chanuser->user->nick); if(!(chanuser->flags & CHANUSERFLAG_VOICED) && resync_voice) modeBufferVoice(modeBuf, chanuser->user->nick); } else { - if((chanuser->flags & CHANUSERFLAG_OPPED) && resync_op) + if((chanuser->flags & CHANUSERFLAG_OPPED) && resync_op && !(chanuser->user->flags & (USERFLAG_ISBOT | USERFLAG_ISIRCOP))) modeBufferDeop(modeBuf, chanuser->user->nick); - if((chanuser->flags & CHANUSERFLAG_VOICED) && resync_voice) + if((chanuser->flags & CHANUSERFLAG_VOICED) && resync_voice && !(chanuser->user->flags & (USERFLAG_ISBOT | USERFLAG_ISIRCOP))) modeBufferDevoice(modeBuf, chanuser->user->nick); }