added database structure for NeonHelp tables
authorpk910 <philipp@zoelle1.de>
Fri, 6 Jan 2012 19:32:46 +0000 (20:32 +0100)
committerpk910 <philipp@zoelle1.de>
Fri, 6 Jan 2012 19:32:46 +0000 (20:32 +0100)
database.sql
database.upgrade.sql
src/cmd_neonhelp_next.c
src/mysqlConn.c

index 14102125e458b9748da6726a3975f22e24aee235..718b05877b0e6523a3a91a518c816949682315cd 100644 (file)
@@ -359,4 +359,39 @@ CREATE TABLE `donotregister` (
 UNIQUE (
 `dnr_target`
 )
-) ENGINE = MYISAM ;
\ No newline at end of file
+) ENGINE = MYISAM ;
+
+-- --------------------------------------------------------
+
+--
+-- Tabellenstruktur für Tabelle `helpserv_requests`
+--
+
+CREATE TABLE IF NOT EXISTS `helpserv_requests` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `host` varchar(200) NOT NULL,
+  `hand` varchar(50) NOT NULL,
+  `nick` varchar(50) NOT NULL,
+  `status` int(1) NOT NULL,
+  `supporter` int(11) NOT NULL,
+  `time` int(20) NOT NULL,
+  `delay` int(20) NOT NULL,
+  `text` text NOT NULL,
+  `log` text NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=latin1;
+
+-- --------------------------------------------------------
+
+--
+-- Tabellenstruktur für Tabelle `helpserv_settings`
+--
+
+CREATE TABLE IF NOT EXISTS `helpserv_settings` (
+  `helpserv_botid` int(11) NOT NULL,
+  `helpserv_support` varchar(256) NOT NULL,
+  `helpserv_public` varchar(256) DEFAULT NULL,
+  `helpserv_intern` varchar(256) DEFAULT NULL,
+  PRIMARY KEY (`helpserv_botid`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
index 12a10ff797f4a167147f6eb806f9bfacd0a8258b..7051a441f05fa12b9bfba4fd6b20632cbb6bca5e 100644 (file)
@@ -96,3 +96,26 @@ ALTER TABLE `bot_channels` CHANGE `trigger` `trigger` VARCHAR( 50 ) CHARACTER SE
 ALTER TABLE `bot_binds` CHANGE `flags` `flags` INT( 10 ) NOT NULL ;
 
 -- version: 10
+
+CREATE TABLE IF NOT EXISTS `helpserv_requests` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `host` varchar(200) NOT NULL,
+  `hand` varchar(50) NOT NULL,
+  `nick` varchar(50) NOT NULL,
+  `status` int(1) NOT NULL,
+  `supporter` int(11) NOT NULL,
+  `time` int(20) NOT NULL,
+  `text` text NOT NULL,
+  `log` text NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM  DEFAULT CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `helpserv_settings` (
+  `helpserv_botid` int(11) NOT NULL,
+  `helpserv_support` varchar(256) NOT NULL,
+  `helpserv_public` varchar(256) DEFAULT NULL,
+  `helpserv_intern` varchar(256) DEFAULT NULL,
+  PRIMARY KEY (`helpserv_botid`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+-- version: 11
\ No newline at end of file
index 4cb7ee335ca40ca8cb78c5f5837a9b4d027b18f6..2e2a2d1e4948171c78c790d1d2fccd23a9629565 100644 (file)
@@ -26,12 +26,12 @@ CMD_BIND(neonhelp_cmd_next) {
     MYSQL_RES *res;
     MYSQL_ROW row, row2;
     int caccess = 0;
+    int userid;
     printf_mysql_query("SELECT `helpserv_support`, `helpserv_public`, `helpserv_intern` FROM `helpserv_settings` WHERE `helpserv_botid` = '%d'", client->clientid);
     res = mysql_use();
     if (!(row = mysql_fetch_row(res))) return;
     //check if the user is a supporter (access in the support channel)
     if((user->flags & USERFLAG_ISAUTHED)) {
-        int userid;
         if(user->flags & USERFLAG_HAS_USERID)
             userid = user->user_id;
         else {
@@ -104,5 +104,5 @@ CMD_BIND(neonhelp_cmd_next) {
     char *join_now = (row[1] ? build_language_string(user, sendbuf2, "NH_NEXT_JOIN", row[0]) : "");
     putsock(client, "PRIVMSG %s :%s %s", next_helpnode->user->nick, build_language_string(user, sendbuf1, "NH_NEXT_HELPER", next_helpnode->suppid, user->auth, user->nick), join_now);
     next_helpnode->status = 1;
-    printf_mysql_query("UPDATE `helpserv_requests` SET `status` = '1' WHERE `id` = '%d'", next_helpnode->suppid);
+    printf_mysql_query("UPDATE `helpserv_requests` SET `status` = '1', `supporter` = '%d' WHERE `id` = '%d'", userid, next_helpnode->suppid);
 }
index d2430f0889d0ec772dd1d15f236a655e0b266e22..88d63be09bea5ab38278f7294f4ac842ed2df7c7 100644 (file)
@@ -16,7 +16,7 @@
  */
 
 #include "mysqlConn.h"
-#define DATABASE_VERSION "10"
+#define DATABASE_VERSION "11"
 
 struct used_result {
     MYSQL_RES *result;