diff options
| author | 2014-01-21 18:44:08 +0100 | |
|---|---|---|
| committer | 2014-01-21 18:44:08 +0100 | |
| commit | e244cb2c63b1ac1d85bdbb4691f7b1bd940ae804 (patch) | |
| tree | 5a69b0efe6c0b7ab88925d3d066271ec40845e23 /src/modules/m_services_account.cpp | |
| parent | m_spanningtree Fix routing of ROUTE_TYPE_MESSAGE messages (diff) | |
| parent | Release 2.0.15 (diff) | |
Merge insp20
Diffstat (limited to 'src/modules/m_services_account.cpp')
| -rw-r--r-- | src/modules/m_services_account.cpp | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 5f288424c..8ab9c9a3b 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -102,6 +102,24 @@ class AChannel_M : public SimpleChannelModeHandler AChannel_M(Module* Creator) : SimpleChannelModeHandler(Creator, "regmoderated", 'M') { } }; +static bool ReadCGIIRCExt(const char* extname, User* user, const std::string*& out) +{ + ExtensionItem* wiext = ServerInstance->Extensions.GetItem(extname); + if (!wiext) + return false; + + if (wiext->creator->ModuleSourceFile != "m_cgiirc.so") + return false; + + StringExtItem* stringext = static_cast<StringExtItem*>(wiext); + std::string* addr = stringext->get(user); + if (!addr) + return false; + + out = addr; + return true; +} + class AccountExtItemImpl : public AccountExtItem { public: @@ -121,8 +139,19 @@ class AccountExtItemImpl : public AccountExtItem { // Logged in if (IS_LOCAL(user)) - user->WriteNumeric(900, "%s %s :You are now logged in as %s", - user->GetFullHost().c_str(), value.c_str(), value.c_str()); + { + const std::string* host = &user->dhost; + if (user->registered != REG_ALL) + { + if (!ReadCGIIRCExt("cgiirc_webirc_hostname", user, host)) + { + ReadCGIIRCExt("cgiirc_webirc_ip", user, host); + } + } + + user->WriteNumeric(900, "%s!%s@%s %s :You are now logged in as %s", + user->nick.c_str(), user->ident.c_str(), host->c_str(), value.c_str(), value.c_str()); + } AccountEvent(creator, user, value).Send(); } @@ -142,6 +171,7 @@ class ModuleServicesAccount : public Module Channel_r m4; User_r m5; AccountExtItemImpl accountname; + bool checking_ban; public: ModuleServicesAccount() : m1(this), m2(this), m3(this), m4(this), m5(this), accountname(this) @@ -219,8 +249,7 @@ class ModuleServicesAccount : public Module ModResult OnCheckBan(User* user, Channel* chan, const std::string& mask) CXX11_OVERRIDE { - static bool checking = false; - if (checking) + if (checking_ban) return MOD_RES_PASSTHRU; if ((mask.length() > 2) && (mask[1] == ':')) @@ -240,9 +269,9 @@ class ModuleServicesAccount : public Module /* If we made it this far we know the user isn't registered so just deny if it matches */ - checking = true; + checking_ban = true; bool result = chan->CheckBan(user, mask.substr(2)); - checking = false; + checking_ban = false; if (result) return MOD_RES_DENY; |
