From abb1f08cf0b36ffd7ad54252a6893236dc274aff Mon Sep 17 00:00:00 2001 From: pk910 Date: Fri, 6 Jan 2012 20:32:46 +0100 Subject: [PATCH] added database structure for NeonHelp tables --- database.sql | 37 ++++++++++++++++++++++++++++++++++++- database.upgrade.sql | 23 +++++++++++++++++++++++ src/cmd_neonhelp_next.c | 4 ++-- src/mysqlConn.c | 2 +- 4 files changed, 62 insertions(+), 4 deletions(-) diff --git a/database.sql b/database.sql index 1410212..718b058 100644 --- a/database.sql +++ b/database.sql @@ -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; + diff --git a/database.upgrade.sql b/database.upgrade.sql index 12a10ff..7051a44 100644 --- a/database.upgrade.sql +++ b/database.upgrade.sql @@ -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 diff --git a/src/cmd_neonhelp_next.c b/src/cmd_neonhelp_next.c index 4cb7ee3..2e2a2d1 100644 --- a/src/cmd_neonhelp_next.c +++ b/src/cmd_neonhelp_next.c @@ -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); } diff --git a/src/mysqlConn.c b/src/mysqlConn.c index d2430f0..88d63be 100644 --- a/src/mysqlConn.c +++ b/src/mysqlConn.c @@ -16,7 +16,7 @@ */ #include "mysqlConn.h" -#define DATABASE_VERSION "10" +#define DATABASE_VERSION "11" struct used_result { MYSQL_RES *result; -- 2.20.1