fixed database (increased flags field size)
authorpk910 <philipp@zoelle1.de>
Sun, 25 Dec 2011 21:09:29 +0000 (22:09 +0100)
committerpk910 <philipp@zoelle1.de>
Sun, 25 Dec 2011 21:09:29 +0000 (22:09 +0100)
database.sql
database.upgrade.sql
src/cmd_global_modcmd.c
src/mysqlConn.c

index db8c41f438eb2ae6f276891f479e38e53d631376..14102125e458b9748da6726a3975f22e24aee235 100644 (file)
@@ -58,7 +58,7 @@ CREATE TABLE IF NOT EXISTS `bot_binds` (
   `parameters` varchar(100) NOT NULL,
   `chan_access` varchar(256) DEFAULT NULL,
   `global_access` int(3) DEFAULT NULL,
-  `flags` tinyint(4) NOT NULL,
+  `flags` int(10) NOT NULL,
   PRIMARY KEY (`id`),
   KEY `botid` (`botid`)
 ) ENGINE=MyISAM  DEFAULT CHARSET=latin1;
index 2b11e65b4d75bdb0c42fc5f2cdddc528ded31faa..12a10ff797f4a167147f6eb806f9bfacd0a8258b 100644 (file)
@@ -92,3 +92,7 @@ ALTER TABLE `bot_binds` ADD INDEX ( `botclass` );
 ALTER TABLE `bot_channels` CHANGE `trigger` `trigger` VARCHAR( 50 ) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT '+';
 
 -- version: 9
+
+ALTER TABLE `bot_binds` CHANGE `flags` `flags` INT( 10 ) NOT NULL ;
+
+-- version: 10
index a5f36ad98760c1a813ed2b74fddce90206fc224c..5a5ce2ea827c279a99cb902260b1f1537803593b 100644 (file)
@@ -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;
index dcd99e5d39a48d9ba5516522c0d4e507bebbb105..802c5918ea53b80de775b5fcccbb32c602ccb96a 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #include "mysqlConn.h"
-#define DATABASE_VERSION "9"
+#define DATABASE_VERSION "10"
 
 struct used_result {
     MYSQL_RES *result;