Another year is about to end... So we have to update these damn copyright information :P
[NeonServV5.git] / src / cmd_global_modcmd.c
index a5f36ad98760c1a813ed2b74fddce90206fc224c..cc242f94a66096e55a60e88298c20df01901662d 100644 (file)
@@ -1,5 +1,5 @@
 /* cmd_global_modcmd.c - NeonServ v5.3
- * Copyright (C) 2011  Philipp Kreil (pk910)
+ * Copyright (C) 2011-2012  Philipp Kreil (pk910)
  * 
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -119,11 +119,13 @@ static int global_cmd_modcmd_flags(struct UserNode *user, struct cmd_binding *cb
     char flags[MAXLEN];
     int flagpos = 0;
     int ret = 0;
+    unsigned int visible_flags = 0;
     int i = 0;
     while(global_cmd_modcmd_show_flags[i].name) {
         if(cbind->func->flags & global_cmd_modcmd_show_flags[i].flag) {
             flagpos += sprintf(flags + flagpos, (flagpos ? " %s" : "\00314%s"), global_cmd_modcmd_show_flags[i].name);
         }
+        visible_flags |= global_cmd_modcmd_show_flags[i].flag;
         i++;
     }
     if(flagpos) 
@@ -156,9 +158,9 @@ static int global_cmd_modcmd_flags(struct UserNode *user, struct cmd_binding *cb
         else
             cbind->flags &= ~current_flag;
         if(cbind->botid == 0)
-            printf_mysql_query("UPDATE `bot_binds` SET `flags` = '%u' WHERE `botclass` = '0' AND `botid` = '%d' AND `command` = '%s'", cbind->flags, cbind->clientid, escape_string(cbind->cmd));
+            printf_mysql_query("UPDATE `bot_binds` SET `flags` = '%u' WHERE `botclass` = '0' AND `botid` = '%d' AND `command` = '%s'", (cbind->flags & visible_flags), cbind->clientid, escape_string(cbind->cmd));
         else
-            printf_mysql_query("UPDATE `bot_binds` SET `flags` = '%u' WHERE `botclass` = '%d' AND `command` = '%s'", cbind->flags, cbind->botid, escape_string(cbind->cmd));
+            printf_mysql_query("UPDATE `bot_binds` SET `flags` = '%u' WHERE `botclass` = '%d' AND `command` = '%s'", (cbind->flags & visible_flags), cbind->botid, escape_string(cbind->cmd));
         ret = 1;
     }
     i = 0;