diff options
| author | Adam <Adam@anope.org> | 2014-06-25 11:02:19 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2014-06-25 11:02:19 -0400 |
| commit | ee3289029d61da12013e0f5a3e4faf2d07543a0e (patch) | |
| tree | df7391c321a913fc56db2d075292c0a6ddb0536d /modules/commands/ms_del.cpp | |
| parent | fd9bb0ea7e3c8a39f1632c2ebbdc25d0fac192a0 (diff) | |
Remove the rest of the 1.8 logic "let's write all of the command handler with no return statement!"
Fix if (something) else if (!something) tests
Remove returns at the bottom of void functions
Diffstat (limited to 'modules/commands/ms_del.cpp')
| -rw-r--r-- | modules/commands/ms_del.cpp | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/modules/commands/ms_del.cpp b/modules/commands/ms_del.cpp index 4e4ca5ed4..17722d340 100644 --- a/modules/commands/ms_del.cpp +++ b/modules/commands/ms_del.cpp @@ -73,49 +73,53 @@ class CommandMSDel : public Command source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "MEMO", ci->name); return; } + mi = ci->memos; } else mi = source.nc->memos; if (numstr.empty() || (!isdigit(numstr[0]) && !numstr.equals_ci("ALL") && !numstr.equals_ci("LAST"))) + { this->OnSyntaxError(source, numstr); - else if (!mi || mi->memos->empty()) + return; + } + + if (!mi || mi->memos->empty()) { if (!chan.empty()) source.Reply(_("\002{0}\002 has no memos."), chan); else source.Reply(_("You have no memos.")); + return; + } + + if (isdigit(numstr[0])) + { + MemoDelCallback list(source, ci, mi, numstr); + list.Process(); + } + else if (numstr.equals_ci("LAST")) + { + /* Delete last memo. */ + if (MemoServ::Event::OnMemoDel) + MemoServ::Event::OnMemoDel(&MemoServ::Event::MemoDel::OnMemoDel, ci ? ci->name : source.nc->display, mi, mi->GetMemo(mi->memos->size() - 1)); + mi->Del(mi->memos->size() - 1); + source.Reply(_("Memo \002{0}\002 has been deleted."), mi->memos->size() + 1); } else { - if (isdigit(numstr[0])) - { - MemoDelCallback list(source, ci, mi, numstr); - list.Process(); - } - else if (numstr.equals_ci("LAST")) + /* Delete all memos. */ + for (unsigned i = mi->memos->size(); i > 0; --i) { - /* Delete last memo. */ if (MemoServ::Event::OnMemoDel) - MemoServ::Event::OnMemoDel(&MemoServ::Event::MemoDel::OnMemoDel, ci ? ci->name : source.nc->display, mi, mi->GetMemo(mi->memos->size() - 1)); - mi->Del(mi->memos->size() - 1); - source.Reply(_("Memo \002{0}\002 has been deleted."), mi->memos->size() + 1); + MemoServ::Event::OnMemoDel(&MemoServ::Event::MemoDel::OnMemoDel, ci ? ci->name : source.nc->display, mi, mi->GetMemo(i)); + mi->Del(i - 1); } + if (!chan.empty()) + source.Reply(_("All memos for channel \002{0}\002 have been deleted."), chan); else - { - /* Delete all memos. */ - for (unsigned i = mi->memos->size(); i > 0; --i) - { - if (MemoServ::Event::OnMemoDel) - MemoServ::Event::OnMemoDel(&MemoServ::Event::MemoDel::OnMemoDel, ci ? ci->name : source.nc->display, mi, mi->GetMemo(i)); - mi->Del(i - 1); - } - if (!chan.empty()) - source.Reply(_("All memos for channel \002{0}\002 have been deleted."), chan); - else - source.Reply(_("All of your memos have been deleted.")); - } + source.Reply(_("All of your memos have been deleted.")); } } |
