diff options
-rw-r--r-- | include/modules.h | 33 | ||||
-rw-r--r-- | src/hostserv.c | 4 | ||||
-rw-r--r-- | src/nickcore.cpp | 1 | ||||
-rw-r--r-- | src/users.c | 2 |
4 files changed, 37 insertions, 3 deletions
diff --git a/include/modules.h b/include/modules.h index 00d32f27e..101fa6902 100644 --- a/include/modules.h +++ b/include/modules.h @@ -799,6 +799,10 @@ class CoreExport Module */ virtual void OnDefconLevel(int level) { } + /** Called on finduser() + * @param u pointer to the user + */ + virtual void OnFindUser(User *u) { } /** Called on findnick() * @param nick nickname to be searched for */ @@ -844,6 +848,28 @@ class CoreExport Module * @param nc pointer to the NickCore */ virtual void OnNickClearAccess(NickCore *nc) { } + + /** called from NickCore::EraseAccess() + * @param nc pointer to the NickCore + * @param entry The access mask + */ + virtual void OnNickEraseAccess(NickCore *nc, const std::string &entry) { } + + /** called when a HostCore is deleted + * @param hc pointer to the HostCore + */ + virtual void OnDeleteHostCore(HostCore *hc) { } + + /** called on findHostCore + * @param nick the name of the HostCore we are searching for + */ + virtual void OnFindHostCore(const std::string &nick) { } + + /** called when a new HostCore is inserted + * @param hc pointer to the HostCore + */ + virtual void OnInsertHostCore(HostCore *hc) { } + }; @@ -855,8 +881,8 @@ 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, + I_OnFindUser, I_OnFindNick, I_OnDelNick, I_OnFindCore, I_OnDelCore, I_OnChangeCoreDisplay, + I_OnFindRequestNick, I_OnDelNickRequest, I_OnMakeNickRequest, I_OnNickClearAccess, I_OnNickEraseAccess, /* ChanServ */ I_OnChanForbidden, I_OnChanSuspend, I_OnChanDrop, I_OnChanExpire, I_OnAccessAdd, I_OnAccessChange, @@ -866,6 +892,9 @@ enum Implementation I_OnBotJoin, I_OnBotKick, I_OnBotCreate, I_OnBotChange, I_OnBotDelete, I_OnBotAssign, I_OnBotUnAssign, I_OnUserKicked, I_OnBotFantasy, I_OnBotNoFantasyAccess, I_OnBotBan, + /* HostServ */ + I_OnDeleteHostCore, I_OnFindHostCore, I_OnInsertHostCore, + /* Users */ I_OnUserConnect, I_OnUserNickChange, I_OnUserLogoff, I_OnPreJoinChannel, I_OnJoinChannel, I_OnPrePartChannel, I_OnPartChannel, diff --git a/src/hostserv.c b/src/hostserv.c index a385bc14f..86d998ff4 100644 --- a/src/hostserv.c +++ b/src/hostserv.c @@ -185,7 +185,7 @@ HostCore *findHostCore(HostCore * phead, const char *nick, bool* found) if (!nick) { return NULL; } - + FOREACH_MOD(I_OnFindHostCore, OnFindHostCore(nick)); while (current != NULL) { if (stricmp(nick, current->nick) == 0) { *found = true; @@ -258,6 +258,7 @@ HostCore *insertHostCore(HostCore * phead, HostCore * prev, const char *nick, newCore->next = tmp; } } + FOREACH_MOD(I_OnInsertHostCore, OnInsertHostCore(newCore)); return phead; } @@ -274,6 +275,7 @@ HostCore *deleteHostCore(HostCore * phead, HostCore * prev) tmp = prev->next; prev->next = tmp->next; } + FOREACH_MOD(I_OnDeleteHostCore, OnDeleteHostCore(tmp)); delete [] tmp->vHost; delete [] tmp->nick; delete [] tmp->creator; diff --git a/src/nickcore.cpp b/src/nickcore.cpp index 0e6d0f5d3..f195c233a 100644 --- a/src/nickcore.cpp +++ b/src/nickcore.cpp @@ -68,6 +68,7 @@ void NickCore::EraseAccess(const std::string &entry) for (unsigned i = 0; i < access.size(); ++i) if (access[i] == entry) { + FOREACH_MOD(I_OnNickEraseAccess, OnNickEraseAccess(this, entry)); access.erase(access.begin() + i); break; } diff --git a/src/users.c b/src/users.c index 0569ad60b..f6510ae3d 100644 --- a/src/users.c +++ b/src/users.c @@ -429,6 +429,7 @@ User *finduser(const char *nick) user = user->next; if (debug >= 3) alog("debug: finduser(%s) -> 0x%p", nick, static_cast<void *>(user)); + FOREACH_MOD(I_OnFindUser, OnFindUser(user)); return user; } @@ -474,6 +475,7 @@ User *find_byuid(const char *uid) while (u) { next = next_uid(); if (u->GetUID() == uid) { + FOREACH_MOD(I_OnFindUser, OnFindUser(u)); return u; } u = next; |