diff options
| author | lethality <lethality@anope.org> | 2012-06-22 21:26:33 +0100 |
|---|---|---|
| committer | lethality <lethality@anope.org> | 2012-06-22 21:26:33 +0100 |
| commit | d8a99d619f7ae301ecf188dc460b1f5c7cb791ac (patch) | |
| tree | b327ce05b9b5cb598fbc829e48041d465bc2d579 /modules/commands/os_login.cpp | |
| parent | ba53c7eb03add30acefbbc95bbd8b4b825b465b0 (diff) | |
| parent | 2dec8e767a70def4b9b04a96ae4f75e4d1013038 (diff) | |
Merge branch '1.9' of ssh://anope.git.sf.net/gitroot/anope/anope into 1.9
Diffstat (limited to 'modules/commands/os_login.cpp')
| -rw-r--r-- | modules/commands/os_login.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/modules/commands/os_login.cpp b/modules/commands/os_login.cpp index 1bae1cf58..0ceac6428 100644 --- a/modules/commands/os_login.cpp +++ b/modules/commands/os_login.cpp @@ -27,22 +27,26 @@ class CommandOSLogin : public Command { const Anope::string &password = params[0]; - Oper *o = source.u->Account()->o; + User *u = source.GetUser(); + if (!u) + return; + + Oper *o = source.nc->o; if (o == NULL) source.Reply(_("No oper block for your nick.")); else if (o->password.empty()) source.Reply(_("Your oper block doesn't require logging in.")); - else if (source.u->HasExt("os_login_password_correct")) + else if (u->HasExt("os_login_password_correct")) source.Reply(_("You are already identified.")); else if (o->password != password) { source.Reply(PASSWORD_INCORRECT); - bad_password(source.u); + bad_password(u); } else { - Log(LOG_ADMIN, source.u, this) << "and successfully identified to " << source.owner->nick; - source.u->Extend("os_login_password_correct", NULL); + Log(LOG_ADMIN, source, this) << "and successfully identified to " << source.owner->nick; + u->Extend("os_login_password_correct", NULL); source.Reply(_("Password accepted.")); } @@ -71,17 +75,21 @@ class CommandOSLogout : public Command void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) anope_override { - Oper *o = source.u->Account()->o; + User *u = source.GetUser(); + if (!u) + return; + + Oper *o = source.nc->o; if (o == NULL) source.Reply(_("No oper block for your nick.")); else if (o->password.empty()) source.Reply(_("Your oper block doesn't require logging in.")); - else if (!source.u->HasExt("os_login_password_correct")) + else if (!u->HasExt("os_login_password_correct")) source.Reply(_("You are not identified.")); else { - Log(LOG_ADMIN, source.u, this); - source.u->Shrink("os_login_password_correct"); + Log(LOG_ADMIN, source, this); + u->Shrink("os_login_password_correct"); source.Reply(_("You have been logged out.")); } } |
