summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/chanserv.c1
-rw-r--r--src/mysql.c37
-rw-r--r--src/rdb.c9
3 files changed, 31 insertions, 16 deletions
diff --git a/src/chanserv.c b/src/chanserv.c
index 2c53e4af1..1b05f8202 100644
--- a/src/chanserv.c
+++ b/src/chanserv.c
@@ -1022,6 +1022,7 @@ void save_cs_rdb_dbase(void)
rdb_clear_table("anope_cs_levels");
rdb_clear_table("anope_cs_akicks");
rdb_clear_table("anope_cs_badwords");
+ rdb_clear_table("anope_cs_ttb");
for (i = 0; i < 256; i++) {
for (ci = chanlists[i]; ci; ci = ci->next) {
diff --git a/src/mysql.c b/src/mysql.c
index ed74b6e64..db84f0d27 100644
--- a/src/mysql.c
+++ b/src/mysql.c
@@ -246,7 +246,7 @@ char *db_mysql_secure(char *pass)
}
#else
- if (pass) {
+ if (!pass) {
snprintf(epass, sizeof(epass), "''");
} else if ((!MysqlSecure) || (strcmp(MysqlSecure, "") == 0)) {
snprintf(epass, sizeof(epass), "'%s'", pass);
@@ -455,7 +455,7 @@ void db_mysql_save_cs_info(ChannelInfo * ci)
"forbidby='%s',forbidreason='%s',bantype='%d',accesscount='%d',"
"akickcount='%d',mlock_on='%d',mlock_off='%d',mlock_limit='%d',"
"mlock_key='%s',mlock_flood='%s',mlock_redirect='%s',entry_message='%s',"
- "memomax='%d',botnick='%s',botflags='%d',ttb='%d',bwcount='%d',"
+ "memomax='%d',botnick='%s',botflags='%d',bwcount='%d',"
"capsmin='%d',capspercent='%d',floodlines='%d',floodsecs='%d',"
"repeattimes='%d',active='1' WHERE name='%s'",
cifoundernick,
@@ -474,7 +474,6 @@ void db_mysql_save_cs_info(ChannelInfo * ci)
(int) ci->memos.memomax,
cibotnick,
(int) ci->botflags,
- (int) ci->ttb,
(int) ci->bwcount,
(int) ci->capsmin,
(int) ci->capspercent,
@@ -617,6 +616,16 @@ void db_mysql_save_cs_info(ChannelInfo * ci)
}
}
+ /* TTB's */
+ for (j = 0; j < TTB_SIZE; j++) {
+ snprintf(sqlcmd, MAX_SQL_BUF, "INSERT DELAYED INTO anope_cs_ttb (channel, ttb_id, value)"
+ " VALUES ('%s', %d, %d)", ciname, j, ci->ttb[j]);
+ if (db_mysql_query(sqlcmd)) {
+ log_perror("Can't create sql query: %s", sqlcmd);
+ db_mysql_error(MYSQL_WARNING, "query");
+ }
+ }
+
free(ciname);
free(cifoundernick); /* mark */
free(cisuccessornick); /* mark */
@@ -1148,7 +1157,7 @@ void db_mysql_load_cs_dbase(void)
return;
snprintf(sqlcmd, MAX_SQL_BUF,
- "SELECT `name`,`founder`,`successor`,`founderpass`,`descr`,`url`,`email`,`time_registered`,`last_used`,`last_topic`,`last_topic_setter`,`last_topic_time`,`flags`,`forbidby`,`forbidreason`,`bantype`,`accesscount`,`akickcount`,`mlock_on`,`mlock_off`,`mlock_limit`,`mlock_key`,`mlock_flood`,`mlock_redirect`,`entry_message`,`memomax`,`botnick`,`botflags`,`ttb`,`bwcount`,`capsmin`,`capspercent`,`floodlines`,`floodsecs`,`repeattimes` FROM `anope_cs_info`");
+ "SELECT `name`,`founder`,`successor`,`founderpass`,`descr`,`url`,`email`,`time_registered`,`last_used`,`last_topic`,`last_topic_setter`,`last_topic_time`,`flags`,`forbidby`,`forbidreason`,`bantype`,`accesscount`,`akickcount`,`mlock_on`,`mlock_off`,`mlock_limit`,`mlock_key`,`mlock_flood`,`mlock_redirect`,`entry_message`,`memomax`,`botnick`,`botflags`,`bwcount`,`capsmin`,`capspercent`,`floodlines`,`floodsecs`,`repeattimes` FROM `anope_cs_info`");
if (db_mysql_query(sqlcmd)) {
log_perror("Can't create sql query: %s", sqlcmd);
db_mysql_error(MYSQL_WARNING, "query");
@@ -1323,16 +1332,28 @@ void db_mysql_load_cs_dbase(void)
ci->bi = findbot(mysql_row[26]);
ci->botflags = atoi(mysql_row[27]);
- ci->ttb = scalloc(2 * TTB_SIZE, 1);
- for (j = 0; j < TTB_SIZE; j++) {
- ci->ttb[j] = 0;
- }
ci->capsmin = atoi(mysql_row[30]);
ci->capspercent = atoi(mysql_row[31]);
ci->floodlines = atoi(mysql_row[32]);
ci->floodsecs = atoi(mysql_row[33]);
ci->repeattimes = atoi(mysql_row[34]);
+ ci->ttb = scalloc(2 * TTB_SIZE, 1);
+ snprintf(sqlcmd, MAX_SQL_BUF, "SELECT `ttb_id`, `value` FROM `anope_cs_ttb` WHERE `channel` = '%s'", tempstr);
+ if (db_mysql_query(sqlcmd)) {
+ log_perror("Can't create sql query: %s", sqlcmd);
+ db_mysql_error(MYSQL_WARNING, "query");
+ }
+ res = mysql_store_result(mysql);
+ while ((row = mysql_fetch_row(res))) {
+ j = atoi(row[0]);
+ ci->ttb[j] = atoi(row[1]);
+ }
+ for (j = 0; j < TTB_SIZE; j++) {
+ if (!ci->ttb[j])
+ ci->ttb[j] = 0;
+ }
+
ci->bwcount = atoi(mysql_row[29]);
if (ci->bwcount) {
ci->badwords = scalloc(ci->bwcount, sizeof(BadWord));
diff --git a/src/rdb.c b/src/rdb.c
index 992106f3c..560286789 100644
--- a/src/rdb.c
+++ b/src/rdb.c
@@ -232,6 +232,7 @@ int rdb_cs_delchan(ChannelInfo * ci)
rdb_scrub_table("anope_cs_akicks", buf);
rdb_scrub_table("anope_cs_levels", buf);
rdb_scrub_table("anope_cs_badwords", buf);
+ rdb_scrub_table("anope_cs_ttb", buf);
if (ci->founder) {
snprintf(buf, sizeof(buf),
"update anope_ns_core set channelcount=channelcount-1 where display='%s'",
@@ -462,41 +463,33 @@ void rdb_load_dbases(void)
{
if (!skeleton) {
rdb_load_ns_dbase();
- anope_cmd_pong(ServerName, ServerName);
if (debug)
alog("debug: RDB Loaded NickServ DataBase (1/8)");
if (s_HostServ) {
rdb_load_hs_dbase();
- anope_cmd_pong(ServerName, ServerName);
if (debug)
alog("debug: RDB Loaded HostServ DataBase (2/8)");
}
if (s_BotServ) {
rdb_load_bs_dbase();
- anope_cmd_pong(ServerName, ServerName);
if (debug)
alog("debug: RDB Loaded BotServ DataBase (3/8)");
}
rdb_load_cs_dbase();
- anope_cmd_pong(ServerName, ServerName);
if (debug)
alog("debug: RDB Loaded ChanServ DataBase (4/8)");
}
rdb_load_os_dbase();
- anope_cmd_pong(ServerName, ServerName);
if (debug)
alog("debug: RDB Loaded OperServ DataBase (5/8)");
rdb_load_news();
- anope_cmd_pong(ServerName, ServerName);
if (debug)
alog("debug: RDB Loaded News DataBase (6/8)");
rdb_load_exceptions();
- anope_cmd_pong(ServerName, ServerName);
if (debug)
alog("debug: RDB Loaded Exception Database (7/8)");
if (PreNickDBName) {
rdb_load_ns_req_dbase();
- anope_cmd_pong(ServerName, ServerName);
if (debug)
alog("debug: RDB Loaded PreNick DataBase (8/8)");
} else {