diff options
| author | 2009-02-25 02:54:04 +0000 | |
|---|---|---|
| committer | 2009-02-25 02:54:04 +0000 | |
| commit | d56e1a1d586d61cfee2cdb8f6e8ecd71428385d8 (patch) | |
| tree | 755752df6552740ea32ea8f36ec17fc58bf838e1 /src/modules | |
| parent | Clarify module mismatch message (diff) | |
| download | inspircd++-d56e1a1d586d61cfee2cdb8f6e8ecd71428385d8.tar.gz inspircd++-d56e1a1d586d61cfee2cdb8f6e8ecd71428385d8.tar.bz2 inspircd++-d56e1a1d586d61cfee2cdb8f6e8ecd71428385d8.zip | |
Allow accountname to be changed without an explicit unset
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11149 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/m_services_account.cpp | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/src/modules/m_services_account.cpp b/src/modules/m_services_account.cpp index 6789d26d8..a763e8e68 100644 --- a/src/modules/m_services_account.cpp +++ b/src/modules/m_services_account.cpp @@ -320,37 +320,29 @@ class ModuleServicesAccount : public Module { User* dest = (User*)target; - /* logging them out? */ - if (extdata.empty()) - { - std::string* account; - dest->GetExt("accountname", account); - if (account) - { - dest->Shrink("accountname"); - delete account; - } + std::string* account; + if (dest->GetExt("accountname", account)) { + // remove old account so that we can set new (or leave unset) + dest->Shrink("accountname"); + delete account; } - else + + if (!extdata.empty()) { - // if they dont already have an accountname field, accept the remote server's - std::string* text; - if (!dest->GetExt("accountname", text)) - { - text = new std::string(extdata); - // remove any accidental leading/trailing spaces - trim(*text); - dest->Extend("accountname", text); + account = new std::string(extdata); + // remove any accidental leading/trailing spaces + trim(*account); + dest->Extend("accountname", account); - if (IS_LOCAL(dest)) - dest->WriteNumeric(900, "%s %s %s :You are now logged in as %s", dest->nick.c_str(), dest->GetFullHost().c_str(), text->c_str(), text->c_str()); + if (IS_LOCAL(dest)) + dest->WriteNumeric(900, "%s %s %s :You are now logged in as %s", + dest->nick.c_str(), dest->GetFullHost().c_str(), account->c_str(), account->c_str()); - AccountData ac; - ac.user = dest; - ac.account = *text; - Event n((char*)&ac, this, "account_login"); - n.Send(ServerInstance); - } + AccountData ac; + ac.user = dest; + ac.account = *account; + Event n((char*)&ac, this, "account_login"); + n.Send(ServerInstance); } } } |
