diff options
author | Adam <Adam@anope.org> | 2012-06-18 05:04:30 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-06-18 05:04:30 -0400 |
commit | 2dec8e767a70def4b9b04a96ae4f75e4d1013038 (patch) | |
tree | 36f5b551ff359a578e17d5e7d2f486970d759a7b /modules/commands/os_akill.cpp | |
parent | 873d4287de57f7f9caa23cb2c9265d1ad2804aba (diff) |
Allow userless command sources
Diffstat (limited to 'modules/commands/os_akill.cpp')
-rw-r--r-- | modules/commands/os_akill.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/modules/commands/os_akill.cpp b/modules/commands/os_akill.cpp index dec9b9ae9..ff840d353 100644 --- a/modules/commands/os_akill.cpp +++ b/modules/commands/os_akill.cpp @@ -59,7 +59,6 @@ class CommandOSAKill : public Command private: void DoAdd(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; Anope::string expiry, mask; if (params.size() < 2) @@ -159,7 +158,7 @@ class CommandOSAKill : public Command return; } - XLine *x = new XLine(mask, u->nick, expires, reason); + XLine *x = new XLine(mask, source.GetNick(), expires, reason); if (Config->AkillIds) x->UID = XLineManager::GenerateUID(); @@ -172,13 +171,13 @@ class CommandOSAKill : public Command if (percent > 95) { source.Reply(USERHOST_MASK_TOO_WIDE, mask.c_str()); - Log(LOG_ADMIN, u, this) << "tried to akill " << percent << "% of the network (" << affected << " users)"; + Log(LOG_ADMIN, source, this) << "tried to akill " << percent << "% of the network (" << affected << " users)"; x->destroy(); return; } EventReturn MOD_RESULT; - FOREACH_RESULT(I_OnAddXLine, OnAddXLine(u, x, akills)); + FOREACH_RESULT(I_OnAddXLine, OnAddXLine(source, x, akills)); if (MOD_RESULT == EVENT_STOP) { x->destroy(); @@ -191,14 +190,13 @@ class CommandOSAKill : public Command source.Reply(_("\002%s\002 added to the AKILL list."), mask.c_str()); - Log(LOG_ADMIN, u, this) << "on " << mask << " (" << x->Reason << ") expires in " << (expires ? duration(expires - Anope::CurTime) : "never") << " [affects " << affected << " user(s) (" << percent << "%)]"; + Log(LOG_ADMIN, source, this) << "on " << mask << " (" << x->Reason << ") expires in " << (expires ? duration(expires - Anope::CurTime) : "never") << " [affects " << affected << " user(s) (" << percent << "%)]"; if (readonly) source.Reply(READ_ONLY_MODE); } void DoDel(CommandSource &source, const std::vector<Anope::string> ¶ms) { - User *u = source.u; const Anope::string &mask = params.size() > 1 ? params[1] : ""; if (mask.empty()) @@ -230,7 +228,7 @@ class CommandOSAKill : public Command do { - FOREACH_MOD(I_OnDelXLine, OnDelXLine(u, x, akills)); + FOREACH_MOD(I_OnDelXLine, OnDelXLine(source, x, akills)); source.Reply(_("\002%s\002 deleted from the AKILL list."), x->Mask.c_str()); AkillDelCallback::DoDel(source, x); @@ -295,7 +293,7 @@ class CommandOSAKill : public Command entry["Mask"] = x->Mask; entry["Creator"] = x->By; entry["Created"] = do_strftime(x->Created, NULL, true); - entry["Expires"] = expire_left(source.u->Account(), x->Expires); + entry["Expires"] = expire_left(source.nc, x->Expires); entry["Reason"] = x->Reason; list.addEntry(entry); } @@ -348,12 +346,11 @@ class CommandOSAKill : public Command void DoClear(CommandSource &source) { - User *u = source.u; for (unsigned i = akills->GetCount(); i > 0; --i) { XLine *x = akills->GetEntry(i - 1); - FOREACH_MOD(I_OnDelXLine, OnDelXLine(u, x, akills)); + FOREACH_MOD(I_OnDelXLine, OnDelXLine(source, x, akills)); akills->DelXLine(x); } |