summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDukePyrolator <DukePyrolator@5417fbe8-f217-4b02-8779-1006273d7864>2009-07-21 03:32:49 +0000
committerDukePyrolator <DukePyrolator@5417fbe8-f217-4b02-8779-1006273d7864>2009-07-21 03:32:49 +0000
commit55d4d6084e907eba711fedb79c3fc0552f1afc7b (patch)
tree53cd28c6980ecfdaa844ffbe8ae6b92dbbec2865
parentcbec05c4286b042fa3cd586e132925bbac1a3a7d (diff)
added 9 new events
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2387 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--include/account.h6
-rw-r--r--include/modules.h51
-rw-r--r--src/core/ns_register.c1
-rw-r--r--src/nickcore.cpp2
-rw-r--r--src/nickserv.c19
-rw-r--r--src/users.c2
6 files changed, 74 insertions, 7 deletions
diff --git a/include/account.h b/include/account.h
index f8fd71b3c..09db33955 100644
--- a/include/account.h
+++ b/include/account.h
@@ -24,7 +24,7 @@ class NickRequest
class NickCore;
-class CoreExport NickAlias
+class CoreExport NickAlias : public Extensible
{
public:
NickAlias();
@@ -48,14 +48,14 @@ class CoreExport NickCore : public Extensible
NickCore *next, *prev;
char *display; /* How the nick is displayed */
- char pass[PASSMAX]; /* Password of the nicks */
+ char pass[PASSMAX]; /* Password of the nicks */
char *email; /* E-mail associated to the nick */
char *greet; /* Greet associated to the nick */
uint32 icq; /* ICQ # associated to the nick */
char *url; /* URL associated to the nick */
uint32 flags; /* See NI_* below */
uint16 language; /* Language selected by nickname owner (LANG_*) */
- std::vector<std::string> access; /* Access list, vector of strings */
+ std::vector<std::string> access; /* Access list, vector of strings */
MemoInfo memos;
uint16 channelcount; /* Number of channels currently registered */
diff --git a/include/modules.h b/include/modules.h
index 79436e063..15a49c607 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -676,7 +676,7 @@ class CoreExport Module
/** Called when a user disconnects
* @param nick The name of the user
*/
- virtual void OnUserLogoff(const char *nick) { }
+ virtual void OnUserLogoff(User *u) { }
/** Called when a new bot is made
* @param bi The bot
@@ -792,6 +792,52 @@ class CoreExport Module
* @param level The level
*/
virtual void OnDefconLevel(int level) { }
+
+ /** Called on findnick()
+ * @param nick nickname to be searched for
+ */
+ virtual void OnFindNick(const std::string &nick) { }
+
+ /** Called on delnick()
+ * @ param na pointer to the nickalias
+ */
+ virtual void OnDelNick(NickAlias *na) { }
+
+ /* Called on findcore()
+ * @param nick nickname to be searched for (nc->display)
+ */
+ virtual void OnFindCore(const std::string &nick) { }
+
+ /** Called on delcore()
+ * @param nc pointer to the NickCore
+ */
+ virtual void OnDelCore(NickCore *nc) { }
+
+ /** Called on change_core_display()
+ * @param nc pointer to the NickCore
+ * @param newdisplay the new display
+ */
+ virtual void OnChangeCoreDisplay(NickCore *nc, const std::string &newdisplay) { }
+
+ /** Called on findrequestnick()
+ * @param nick nicname to be searched for
+ */
+ virtual void OnFindRequestNick(const std::string &nick) { }
+
+ /** called from ns_register.c, after the NickRequest have been created
+ * @param nr pointer to the NickRequest
+ */
+ virtual void OnMakeNickRequest(NickRequest *nr) { }
+
+ /** called on delnickrequest()
+ * @param nr pointer to the NickRequest
+ */
+ virtual void OnDelNickRequest(NickRequest *nr) { }
+
+ /** called from NickCore::ClearAccess()
+ * @param nc pointer to the NickCore
+ */
+ virtual void OnNickClearAccess(NickCore *nc) { }
};
@@ -803,13 +849,14 @@ enum Implementation
/* NickServ */
I_OnNickExpire, I_OnNickForbidden, I_OnNickGroup, I_OnNickLogout, I_OnNickIdentify, I_OnNickDrop,
I_OnNickRegister, I_OnNickSuspended, I_OnNickUnsuspended,
+ I_OnFindNick, I_OnDelNick, I_OnFindCore, I_OnDelCore, I_OnChangeCoreDisplay,
+ I_OnFindRequestNick, I_OnDelNickRequest, I_OnMakeNickRequest, I_OnNickClearAccess,
/* ChanServ */
I_OnChanForbidden, I_OnChanSuspend, I_OnChanDrop, I_OnChanExpire, I_OnAccessAdd, I_OnAccessChange,
I_OnAccessDel, I_OnAccessClear, I_OnChanRegistered, I_OnChanUnsuspend,
/* BotServ */
-
I_OnBotJoin, I_OnBotKick, I_OnBotCreate, I_OnBotChange, I_OnBotDelete, I_OnBotAssign, I_OnBotUnAssign,
I_OnUserKicked, I_OnBotFantasy, I_OnBotNoFantasyAccess, I_OnBotBan,
diff --git a/src/core/ns_register.c b/src/core/ns_register.c
index b036a19b8..516aa15c0 100644
--- a/src/core/ns_register.c
+++ b/src/core/ns_register.c
@@ -305,6 +305,7 @@ class CommandNSRegister : public CommandNSConfirm
if (email)
nr->email = sstrdup(email);
nr->requested = time(NULL);
+ FOREACH_MOD(I_OnMakeNickRequest, OnMakeNickRequest(nr));
if (NSEmailReg)
{
if (!do_sendregmail(u, nr))
diff --git a/src/nickcore.cpp b/src/nickcore.cpp
index 804d0c1c7..0e6d0f5d3 100644
--- a/src/nickcore.cpp
+++ b/src/nickcore.cpp
@@ -1,4 +1,5 @@
#include "services.h"
+#include "pseudo.h"
NickCore::NickCore()
{
@@ -74,5 +75,6 @@ void NickCore::EraseAccess(const std::string &entry)
void NickCore::ClearAccess()
{
+ FOREACH_MOD(I_OnNickClearAccess, OnNickClearAccess(this));
access.clear();
}
diff --git a/src/nickserv.c b/src/nickserv.c
index f09cdb9fd..88371b3db 100644
--- a/src/nickserv.c
+++ b/src/nickserv.c
@@ -851,10 +851,14 @@ NickRequest *findrequestnick(const char *nick)
return NULL;
}
+ FOREACH_MOD(I_OnFindRequestNick, OnFindRequestNick(nick));
+
for (nr = nrlists[HASH(nick)]; nr; nr = nr->next)
{
if (stricmp(nr->nick, nick) == 0)
+ {
return nr;
+ }
}
return NULL;
}
@@ -875,12 +879,15 @@ NickAlias *findnick(const char *nick)
return NULL;
}
+ FOREACH_MOD(I_OnFindNick, OnFindNick(nick));
+
for (na = nalists[HASH(nick)]; na; na = na->next)
{
if (stricmp(na->nick, nick) == 0)
+ {
return na;
+ }
}
-
return NULL;
}
@@ -907,10 +914,14 @@ NickCore *findcore(const char *nick)
return NULL;
}
+ FOREACH_MOD(I_OnFindCore, OnFindCore(nick));
+
for (nc = nclists[HASH(nick)]; nc; nc = nc->next)
{
if (stricmp(nc->display, nick) == 0)
+ {
return nc;
+ }
}
return NULL;
@@ -1070,6 +1081,7 @@ void change_core_display(NickCore * nc, const char *newdisplay)
}
*/
/* Log ... */
+ FOREACH_MOD(I_OnChangeCoreDisplay, OnChangeCoreDisplay(nc, newdisplay));
alog("%s: changing %s nickname group display to %s", s_NickServ,
nc->display, newdisplay);
@@ -1108,6 +1120,8 @@ static int delcore(NickCore * nc)
int i;
User *user;
+ FOREACH_MOD(I_OnDelCore, OnDelCore(nc));
+
/* Clean up this nick core from any users online using it
* (ones that /nick but remain unidentified)
*/
@@ -1171,6 +1185,7 @@ int delnickrequest(NickRequest * nr)
{
if (nr)
{
+ FOREACH_MOD(I_OnDelNickRequest, OnDelNickRequest(nr));
nrlists[HASH(nr->nick)] = nr->next;
if (nr->nick)
delete [] nr->nick;
@@ -1201,6 +1216,8 @@ int delnick(NickAlias * na)
NickServCollide::ClearTimers(na);
NickServRelease::ClearTimers(na, true);
+ FOREACH_MOD(I_OnDelNick, OnDelNick(na));
+
/* Second thing to do: look for an user using the alias
* being deleted, and make appropriate changes */
if ((u = finduser(na->nick)))
diff --git a/src/users.c b/src/users.c
index fd9d25549..e0312f5f3 100644
--- a/src/users.c
+++ b/src/users.c
@@ -227,7 +227,7 @@ User::~User()
delete [] srealname;
}
- FOREACH_MOD(I_OnUserLogoff, OnUserLogoff(this->nick));
+ FOREACH_MOD(I_OnUserLogoff, OnUserLogoff(this));
if (debug >= 2)
alog("debug: User::~User() called");