diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-14 12:47:19 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-14 12:47:19 +0000 |
commit | eacdc9ef87b671e80f27043e021d98daa44bce92 (patch) | |
tree | 66d2e97f70cc1c2be1fceace41d8f706539e2a68 /src | |
parent | 9a3475ed584b09c221219b306611c0b691161a08 (diff) |
Added (untested!) OnCheckReady and OnUserRegister (gonna write an ident lookup module!)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1081 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/commands.cpp | 1 | ||||
-rw-r--r-- | src/inspircd.cpp | 22 | ||||
-rw-r--r-- | src/modules.cpp | 2 |
3 files changed, 22 insertions, 3 deletions
diff --git a/src/commands.cpp b/src/commands.cpp index 951c2281b..7d77a6a2b 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1764,6 +1764,7 @@ void handle_nick(char **parameters, int pcnt, userrec *user) user->dns_done = (!lookup_dns(user->nick)); if (user->dns_done) log(DEBUG,"Aborting dns lookup of %s because dns server experienced a failure.",user->nick); + FOREACH_MOD OnUserRegister(userrec* user); } if (user->registered == 3) { diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 273259019..badf284e7 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -2575,11 +2575,27 @@ void FullConnectUser(userrec* user) NetSendToAll(buffer); } + +// this returns 1 when all modules are satisfied that the user should be allowed onto the irc server +// (until this returns true, a user will block in the waiting state, waiting to connect up to the +// registration timeout maximum seconds) +bool AllModulesReportReady(userrec* user) +{ + for (int i = 0; i <= MODCOUNT; i++) { + int res = modules[i]->OnCheckReady(user); + if (!res) { + return false; + } + } + } + return true; +} + /* shows the message of the day, and any other on-logon stuff */ void ConnectUser(userrec *user) { // dns is already done, things are fast. no need to wait for dns to complete just pass them straight on - if ((user->dns_done) && (user->registered >= 3)) + if ((user->dns_done) && (user->registered >= 3) && (AllModulesReportReady(user))) { FullConnectUser(user); } @@ -3906,13 +3922,13 @@ int InspIRCd(void) kill_link(count2->second,"Registration timeout"); goto label; } - if ((TIME > count2->second->signon) && (count2->second->registered == 3)) + if ((TIME > count2->second->signon) && (count2->second->registered == 3) && (AllModulesReportReady(user))) { count2->second->dns_done = true; FullConnectUser(count2->second); goto label; } - if ((count2->second->dns_done) && (count2->second->registered == 3)) // both NICK and USER... and DNS + if ((count2->second->dns_done) && (count2->second->registered == 3) && AllModulesReportReady(user))) // both NICK and USER... and DNS { FullConnectUser(count2->second); goto label; diff --git a/src/modules.cpp b/src/modules.cpp index 6ff60b208..12dccdade 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -333,6 +333,8 @@ void Module::OnLoadModule(Module* mod,std::string name) { }; void Module::OnBackgroundTimer(time_t curtime) { }; void Module::OnSendList(userrec* user, chanrec* channel, char mode) { }; int Module::OnPreCommand(std::string command, char **parameters, int pcnt, userrec *user) { return 0; }; +bool Module::OnCheckReady(userrec* user) { return true; }; +void Module::OnUserRegister(userrec* user) { }; // server is a wrapper class that provides methods to all of the C-style // exports in the core |