mirror of
https://github.com/anope/anope.git
synced 2026-07-07 20:05:43 +02:00
BUILD : 1.7.4 (295) BUGS : none NOTES : Rolling back previous commit.
git-svn-id: svn://svn.anope.org/anope/trunk@295 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@184 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
parent
a090c812cf
commit
3422f4a798
+90
-1
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -58,7 +58,7 @@
|
||||
# define MYSQL_WARNING 2
|
||||
# define MYSQL_ERROR 4
|
||||
|
||||
#include <mysql.h>
|
||||
#include "mysql.h"
|
||||
#include "errmsg.h"
|
||||
#endif
|
||||
|
||||
|
||||
+22
-9
@@ -722,6 +722,28 @@ void save_bs_dbase(void)
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
void save_bs_rdb_dbase(void)
|
||||
{
|
||||
#ifdef USE_RDB
|
||||
int i;
|
||||
BotInfo *bi;
|
||||
|
||||
if (!rdb_open())
|
||||
return;
|
||||
|
||||
rdb_clear_table("anope_bs_core");
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
for (bi = botlists[i]; bi; bi = bi->next) {
|
||||
rdb_save_bs_core(bi);
|
||||
}
|
||||
}
|
||||
rdb_close();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/* Inserts a bot in the bot list. I can't be much explicit mh? */
|
||||
|
||||
static void insert_bot(BotInfo * bi)
|
||||
@@ -778,7 +800,6 @@ static void change_bot_nick(BotInfo * bi, char *newnick)
|
||||
static int delbot(BotInfo * bi)
|
||||
{
|
||||
cs_remove_bot(bi);
|
||||
rdb_bs_del_bot(bi);
|
||||
|
||||
if (bi->next)
|
||||
bi->next->prev = bi->prev;
|
||||
@@ -826,7 +847,6 @@ static void unassign(User * u, ChannelInfo * ci)
|
||||
u->nick);
|
||||
}
|
||||
ci->bi->chancount--;
|
||||
rdb_bs_change_bot_chancount(ci->bi);
|
||||
ci->bi = NULL;
|
||||
}
|
||||
|
||||
@@ -1371,8 +1391,6 @@ static int do_bot(User * u)
|
||||
bi->real = sstrdup(real);
|
||||
bi->created = time(NULL);
|
||||
bi->chancount = 0;
|
||||
|
||||
rdb_bs_add_bot(bi);
|
||||
|
||||
/* We check whether user with this nick is online, and kill it if so */
|
||||
EnforceQlinedNick(nick, s_BotServ);
|
||||
@@ -1499,8 +1517,6 @@ static int do_bot(User * u)
|
||||
/* We check whether user with this nick is online, and kill it if so */
|
||||
EnforceQlinedNick(nick, s_BotServ);
|
||||
}
|
||||
|
||||
rdb_bs_change_bot(bi, nick, user, host ,real);
|
||||
|
||||
if (strcmp(nick, bi->nick))
|
||||
change_bot_nick(bi, nick);
|
||||
@@ -1637,7 +1653,6 @@ static int do_assign(User * u)
|
||||
unassign(u, ci);
|
||||
ci->bi = bi;
|
||||
bi->chancount++;
|
||||
rdb_bs_change_bot_chancount(bi);
|
||||
if (ci->c && ci->c->usercount >= BSMinUsers) {
|
||||
bot_join(ci);
|
||||
}
|
||||
@@ -1906,11 +1921,9 @@ static int do_set(User * u)
|
||||
if ((bi = findbot(chan))) {
|
||||
if (!stricmp(value, "ON")) {
|
||||
bi->flags |= BI_PRIVATE;
|
||||
rdb_bs_change_bot_flags(bi);
|
||||
notice_lang(s_BotServ, u, BOT_SET_PRIVATE_ON, bi->nick);
|
||||
} else if (!stricmp(value, "OFF")) {
|
||||
bi->flags &= ~BI_PRIVATE;
|
||||
rdb_bs_change_bot_flags(bi);
|
||||
notice_lang(s_BotServ, u, BOT_SET_PRIVATE_OFF, bi->nick);
|
||||
} else {
|
||||
syntax_error(s_BotServ, u, "SET PRIVATE",
|
||||
|
||||
+47
-3
@@ -1288,6 +1288,35 @@ void save_cs_dbase(void)
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
void save_cs_rdb_dbase(void)
|
||||
{
|
||||
#ifdef USE_RDB
|
||||
int i;
|
||||
ChannelInfo *ci;
|
||||
|
||||
if (!rdb_open())
|
||||
return;
|
||||
|
||||
rdb_tag_table("anope_cs_info");
|
||||
rdb_scrub_table("anope_ms_info", "serv='CHAN'");
|
||||
rdb_clear_table("anope_cs_access");
|
||||
rdb_clear_table("anope_cs_levels");
|
||||
rdb_clear_table("anope_cs_akicks");
|
||||
rdb_clear_table("anope_cs_badwords");
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
for (ci = chanlists[i]; ci; ci = ci->next) {
|
||||
rdb_save_cs_info(ci);
|
||||
} /* for (chanlists[i]) */
|
||||
} /* for (i) */
|
||||
|
||||
rdb_scrub_table("anope_cs_info", "active='0'");
|
||||
rdb_close();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/* Check the current modes on a channel; if they conflict with a mode lock,
|
||||
* fix them. */
|
||||
|
||||
@@ -1922,6 +1951,12 @@ void cs_remove_nick(const NickCore * nc)
|
||||
ci->founder = nc2;
|
||||
ci->successor = NULL;
|
||||
nc2->channelcount++;
|
||||
#ifdef USE_RDB
|
||||
if (rdb_open()) {
|
||||
rdb_cs_set_founder(ci->name, nc2->display);
|
||||
rdb_close();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
alog("%s: Deleting channel %s owned by deleted nick %s", s_ChanServ, ci->name, nc->display);
|
||||
@@ -1966,6 +2001,12 @@ void cs_remove_nick(const NickCore * nc)
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef USE_RDB
|
||||
if (rdb_open()) {
|
||||
rdb_cs_deluser(nc->display);
|
||||
rdb_close();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -2094,6 +2135,12 @@ int delchan(ChannelInfo * ci)
|
||||
}
|
||||
ci->c->ci = NULL;
|
||||
}
|
||||
#ifdef USE_RDB
|
||||
if (rdb_open()) {
|
||||
rdb_cs_delchan(ci);
|
||||
rdb_close();
|
||||
}
|
||||
#endif
|
||||
if (ci->next)
|
||||
ci->next->prev = ci->prev;
|
||||
if (ci->prev)
|
||||
@@ -3841,7 +3888,6 @@ static int access_del(User * u, ChanAccess * access, int *perm, int uacc)
|
||||
(*perm)++;
|
||||
return 0;
|
||||
}
|
||||
rdb_cs_del_access(access);
|
||||
access->nc = NULL;
|
||||
access->in_use = 0;
|
||||
return 1;
|
||||
@@ -3977,7 +4023,6 @@ static int do_access(User * u)
|
||||
return MOD_CONT;
|
||||
}
|
||||
access->level = level;
|
||||
rdb_cs_add_access(ci, access);
|
||||
alog("%s: %s!%s@%s (level %d) set access level %d to %s (group %s) on channel %s", s_ChanServ, u->nick, u->username, GetHost(u), ulev, access->level, na->nick, nc->display, ci->name);
|
||||
notice_lang(s_ChanServ, u, CHAN_ACCESS_LEVEL_CHANGED,
|
||||
access->nc->display, chan, level);
|
||||
@@ -4007,7 +4052,6 @@ static int do_access(User * u)
|
||||
access->in_use = 1;
|
||||
access->level = level;
|
||||
access->last_seen = 0;
|
||||
rdb_cs_add_access(ci, access);
|
||||
|
||||
alog("%s: %s!%s@%s (level %d) set access level %d to %s (group %s) on channel %s", s_ChanServ, u->nick, u->username, GetHost(u), ulev, access->level, na->nick, nc->display, ci->name);
|
||||
notice_lang(s_ChanServ, u, CHAN_ACCESS_ADDED, nc->display,
|
||||
|
||||
@@ -297,6 +297,7 @@ char *MysqlSecure;
|
||||
char *MysqlSock;
|
||||
int MysqlRetries = 0;
|
||||
int MysqlRetryGap = 0;
|
||||
int UseRDB = 0;
|
||||
|
||||
int DefConLevel;
|
||||
int DefCon1;
|
||||
@@ -491,6 +492,7 @@ Directive directives[] = {
|
||||
{"MysqlSock", {{PARAM_STRING, PARAM_RELOAD, &MysqlSock}}},
|
||||
{"MysqlRetries", {{PARAM_POSINT, PARAM_RELOAD, &MysqlRetries}}},
|
||||
{"MysqlRetryGap", {{PARAM_POSINT, PARAM_RELOAD, &MysqlRetryGap}}},
|
||||
{"UseRDB", {{PARAM_SET, PARAM_RELOAD, &UseRDB}}},
|
||||
{"ModuleAutoload", {{PARAM_STRING, PARAM_RELOAD, &Modules}}},
|
||||
{"ModuleDelayedAutoload",
|
||||
{{PARAM_STRING, PARAM_RELOAD, &ModulesDelayed}}},
|
||||
|
||||
@@ -443,11 +443,25 @@ int listOut(User * u)
|
||||
/*************************************************************************/
|
||||
void delHostCore(char *nick)
|
||||
{
|
||||
#ifdef USE_RDB
|
||||
static char clause[128];
|
||||
#endif
|
||||
HostCore *tmp;
|
||||
boolean found = false;
|
||||
tmp = findHostCore(head, nick, &found);
|
||||
if (found) {
|
||||
head = deleteHostCore(head, tmp);
|
||||
|
||||
#ifdef USE_RDB
|
||||
/* Reflect this change in the database right away. */
|
||||
if (rdb_open()) {
|
||||
|
||||
snprintf(clause, sizeof(clause), "nick='%s'", nick);
|
||||
rdb_scrub_table("anope_hs_core", clause);
|
||||
rdb_close();
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -609,6 +623,25 @@ void save_hs_dbase(void)
|
||||
|
||||
#undef SAFE
|
||||
|
||||
void save_hs_rdb_dbase(void)
|
||||
{
|
||||
#ifdef USE_RDB
|
||||
HostCore *current;
|
||||
|
||||
if (!rdb_open())
|
||||
return;
|
||||
|
||||
rdb_clear_table("anope_hs_core");
|
||||
|
||||
current = head;
|
||||
while (current != NULL) {
|
||||
rdb_save_hs_core(current);
|
||||
current = current->next;
|
||||
}
|
||||
rdb_close();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/* End of Load/Save Functions */
|
||||
/*************************************************************************/
|
||||
|
||||
+28
-6
@@ -607,11 +607,6 @@ int init(int ac, char **av)
|
||||
lang_init();
|
||||
if (debug)
|
||||
alog("debug: Loaded languages");
|
||||
|
||||
/* Initialize remote database support */
|
||||
rdb_init();
|
||||
if (debug)
|
||||
alog("debug: Loaded remote databases");
|
||||
|
||||
/* Initialize subservices */
|
||||
ns_init();
|
||||
@@ -622,6 +617,10 @@ int init(int ac, char **av)
|
||||
hostserv_init();
|
||||
helpserv_init();
|
||||
|
||||
#ifdef USE_RDB
|
||||
rdb_init();
|
||||
#endif
|
||||
|
||||
/* Initialize proxy detection */
|
||||
#ifdef USE_THREADS
|
||||
if (ProxyDetect && !proxy_init()) {
|
||||
@@ -644,6 +643,12 @@ int init(int ac, char **av)
|
||||
#endif
|
||||
|
||||
/* Load up databases */
|
||||
#ifdef USE_RDB
|
||||
if (UseRDB)
|
||||
rdb_load_dbases();
|
||||
/* Need a better way to handle this -dane */
|
||||
if (!UseRDB) {
|
||||
#endif
|
||||
if (!skeleton) {
|
||||
load_ns_dbase();
|
||||
if (debug)
|
||||
@@ -677,8 +682,25 @@ int init(int ac, char **av)
|
||||
if (debug)
|
||||
alog("debug: Loaded PreNick database (9/9)");
|
||||
}
|
||||
#ifdef USE_RDB
|
||||
}
|
||||
#endif
|
||||
alog("Databases loaded");
|
||||
save_databases();
|
||||
|
||||
/* Save the databases back to file/mysql to reflect any changes */
|
||||
#ifdef USE_RDB
|
||||
if (!UseRDB) { /* Only save if we are not using remote databases
|
||||
* to avoid floods. As a side effects our nice
|
||||
* FFF databases won't get overwritten if the
|
||||
* mysql db is broken (empty etc.) */
|
||||
#endif
|
||||
alog("Info: Reflecting database records.");
|
||||
save_databases();
|
||||
#ifdef USE_RDB
|
||||
} else {
|
||||
alog("Info: Not reflecting database records.");
|
||||
}
|
||||
#endif
|
||||
/* Make myself known to myself in the serverlist */
|
||||
me_server = new_server(NULL, ServerName, ServerDesc, SERVER_ISME);
|
||||
|
||||
|
||||
+35
-1
@@ -48,6 +48,7 @@ int is44 = 0; /* -is44 */
|
||||
#endif
|
||||
|
||||
#ifdef USE_RDB
|
||||
int do_mysql = 0; /* use mysql ? */
|
||||
#endif
|
||||
|
||||
/* Set to 1 if we are to quit */
|
||||
@@ -153,6 +154,40 @@ void save_databases(void)
|
||||
save_news();
|
||||
waiting = -18;
|
||||
save_exceptions();
|
||||
|
||||
#ifdef USE_RDB
|
||||
if (do_mysql) {
|
||||
if (debug)
|
||||
alog("debug: Saving RDB databases");
|
||||
waiting = -10;
|
||||
if (!skeleton) {
|
||||
waiting = -11;
|
||||
save_ns_rdb_dbase();
|
||||
waiting = -12;
|
||||
save_cs_rdb_dbase();
|
||||
if (PreNickDBName) {
|
||||
save_ns_req_rdb_dbase();
|
||||
waiting = -13;
|
||||
}
|
||||
/* Temporary fix to avoid unwanted timeouts... */
|
||||
send_cmd(ServerName, "PONG %s", ServerName);
|
||||
if (s_BotServ) {
|
||||
waiting = -14;
|
||||
save_bs_rdb_dbase();
|
||||
}
|
||||
if (s_HostServ) {
|
||||
waiting = -15;
|
||||
save_hs_rdb_dbase();
|
||||
}
|
||||
waiting = -16;
|
||||
save_os_rdb_dbase();
|
||||
waiting = -17;
|
||||
save_rdb_news();
|
||||
waiting = -18;
|
||||
save_rdb_exceptions();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
@@ -197,7 +232,6 @@ void do_restart_services(void)
|
||||
|
||||
static void services_shutdown(void)
|
||||
{
|
||||
rdb_end();
|
||||
if (!quitmsg)
|
||||
quitmsg = "Terminating, reason unknown";
|
||||
alog("%s", quitmsg);
|
||||
|
||||
+1581
-188
File diff suppressed because it is too large
Load Diff
+19
@@ -238,6 +238,25 @@ void save_news()
|
||||
|
||||
#undef SAFE
|
||||
|
||||
void save_rdb_news()
|
||||
{
|
||||
#ifdef USE_RDB
|
||||
int i;
|
||||
NewsItem *ni;
|
||||
|
||||
if (!rdb_open())
|
||||
return;
|
||||
|
||||
rdb_clear_table("anope_os_news");
|
||||
for (i = 0; i < nnews; i++) {
|
||||
ni = &news[i];
|
||||
rdb_save_news(ni);
|
||||
}
|
||||
|
||||
rdb_close();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/***************************** News display ******************************/
|
||||
/*************************************************************************/
|
||||
|
||||
+112
File diff suppressed because it is too large
Load Diff
@@ -774,6 +774,19 @@ void save_os_dbase(void)
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
void save_os_rdb_dbase(void)
|
||||
{
|
||||
#ifdef USE_RDB
|
||||
if (!rdb_open())
|
||||
return;
|
||||
rdb_save_os_db(maxusercnt, maxusertime, &akills, &sglines, &sqlines,
|
||||
&szlines, hcache[0]);
|
||||
rdb_close();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/* Removes the nick structure from OperServ lists. */
|
||||
|
||||
void os_remove_nick(NickCore * nc)
|
||||
|
||||
@@ -460,6 +460,25 @@ void save_exceptions()
|
||||
|
||||
#undef SAFE
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
void save_rdb_exceptions()
|
||||
{
|
||||
#ifdef USE_RDB
|
||||
int i;
|
||||
Exception *e;
|
||||
|
||||
if (!rdb_open())
|
||||
return;
|
||||
rdb_clear_table("anope_os_exceptions");
|
||||
for (i = 0; i < nexceptions; i++) {
|
||||
e = &exceptions[i];
|
||||
rdb_save_exceptions(e);
|
||||
}
|
||||
rdb_close();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
/************************ Exception Manipulation *************************/
|
||||
/*************************************************************************/
|
||||
|
||||
+4
-4
@@ -8,13 +8,13 @@
|
||||
VERSION_MAJOR="1"
|
||||
VERSION_MINOR="7"
|
||||
VERSION_PATCH="4"
|
||||
VERSION_BUILD="294"
|
||||
VERSION_BUILD="295"
|
||||
|
||||
# $Log$
|
||||
#
|
||||
# BUILD : 1.7.4 (294)
|
||||
# BUGS :
|
||||
# NOTES : First import. Current status: anope_bs_core finished for new phase1, anope_cs_access working for cs access add.
|
||||
# BUILD : 1.7.4 (295)
|
||||
# BUGS : none
|
||||
# NOTES : Rolling back previous commit.
|
||||
#
|
||||
# BUILD : 1.7.4 (283)
|
||||
# BUGS : N/A
|
||||
|
||||
Reference in New Issue
Block a user