mirror of
https://github.com/anope/anope.git
synced 2026-07-09 22:23:12 +02:00
Move assign and unassign to new events, allow for halting too should modules desire that.
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2107 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
+10
-3
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
|
||||
#include "services.h"
|
||||
#include "modules.h"
|
||||
|
||||
BotInfo::BotInfo(const char *nnick)
|
||||
{
|
||||
@@ -89,6 +90,11 @@ void BotInfo::RejoinAll()
|
||||
|
||||
void BotInfo::Assign(User *u, ChannelInfo *ci)
|
||||
{
|
||||
EventReturn MOD_RESULT = EVENT_CONTINUE;
|
||||
FOREACH_RESULT(I_OnBotAssign, OnBotAssign(u, ci, this));
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
return;
|
||||
|
||||
if (ci->bi)
|
||||
{
|
||||
if (u)
|
||||
@@ -101,13 +107,14 @@ void BotInfo::Assign(User *u, ChannelInfo *ci)
|
||||
this->chancount++;
|
||||
if (ci->c && ci->c->usercount >= BSMinUsers)
|
||||
bot_join(ci);
|
||||
|
||||
send_event(EVENT_BOT_ASSIGN, 2, ci->name, this->nick);
|
||||
}
|
||||
|
||||
void BotInfo::UnAssign(User *u, ChannelInfo *ci)
|
||||
{
|
||||
send_event(EVENT_BOT_UNASSIGN, 2, ci->name, ci->bi->nick);
|
||||
EventReturn MOD_RESULT = EVENT_CONTINUE;
|
||||
FOREACH_RESULT(I_OnBotUnAssign, OnBotUnAssign(u, ci));
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
return;
|
||||
|
||||
if (u && ci->c && ci->c->usercount >= BSMinUsers)
|
||||
ircdproto->SendPart(ci->bi, ci->name, "UNASSIGN from %s", u->nick);
|
||||
|
||||
+1
-1
@@ -694,7 +694,7 @@ void backup_databases()
|
||||
rename_database(OperDBName, ext);
|
||||
rename_database(NewsDBName, ext);
|
||||
rename_database(ExceptionDBName, ext);
|
||||
send_event(EVENT_DB_BACKUP, 1, EVENT_STOP);
|
||||
send_event(EVENT_DB_BACKUP, 1, "stop");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ void load_config() {
|
||||
* When anope saves her databases, we do the same.
|
||||
**/
|
||||
int save_ignoredb(int argc, char **argv) {
|
||||
if ((argc >= 1) && (!stricmp(argv[0], EVENT_STOP)))
|
||||
if ((argc >= 1) && (!stricmp(argv[0], "stop")))
|
||||
save_ignore_db();
|
||||
|
||||
return MOD_CONT;
|
||||
@@ -149,7 +149,7 @@ int save_ignoredb(int argc, char **argv) {
|
||||
* When anope backs her databases up, we do the same.
|
||||
**/
|
||||
int backup_ignoredb(int argc, char **argv) {
|
||||
if ((argc >= 1) && (!stricmp(argv[0], EVENT_STOP))) {
|
||||
if ((argc >= 1) && (!stricmp(argv[0], "stop"))) {
|
||||
if (debug)
|
||||
alog("[os_ignore_db] debug: Backing up %s database...", IgnoreDB);
|
||||
ModuleDatabaseBackup(IgnoreDB);
|
||||
|
||||
Reference in New Issue
Block a user