summaryrefslogtreecommitdiff
path: root/modules/commands
diff options
context:
space:
mode:
Diffstat (limited to 'modules/commands')
-rw-r--r--modules/commands/cs_seen.cpp1
-rw-r--r--modules/commands/ms_cancel.cpp56
-rw-r--r--modules/commands/ms_rsend.cpp2
-rw-r--r--modules/commands/ms_send.cpp2
-rw-r--r--modules/commands/ms_sendall.cpp2
5 files changed, 42 insertions, 21 deletions
diff --git a/modules/commands/cs_seen.cpp b/modules/commands/cs_seen.cpp
index 80bc8e548..0eb5ae5cb 100644
--- a/modules/commands/cs_seen.cpp
+++ b/modules/commands/cs_seen.cpp
@@ -260,6 +260,7 @@ class CommandSeen : public Command
{
this->SetDesc(_("Tells you about the last time a user was seen"));
this->SetSyntax(_("\037nick\037"));
+ this->AllowUnregistered(true);
}
void Execute(CommandSource &source, const std::vector<Anope::string> &params) anope_override
diff --git a/modules/commands/ms_cancel.cpp b/modules/commands/ms_cancel.cpp
index 9e6f0ce63..07b7f3050 100644
--- a/modules/commands/ms_cancel.cpp
+++ b/modules/commands/ms_cancel.cpp
@@ -34,27 +34,47 @@ class CommandMSCancel : public Command
MemoInfo *mi = MemoInfo::GetMemoInfo(nname, ischan);
if (mi == NULL)
- source.Reply(ischan ? CHAN_X_NOT_REGISTERED : _(NICK_X_NOT_REGISTERED), nname.c_str());
+ {
+ source.Reply(ischan ? CHAN_X_NOT_REGISTERED : NICK_X_NOT_REGISTERED, nname.c_str());
+ return;
+ }
+
+ ChannelInfo *ci = NULL;
+ NickAlias *na = NULL;
+ if (ischan)
+ {
+ ci = ChannelInfo::Find(nname);
+
+ if (ci == NULL)
+ return; // can't happen
+ }
else
{
- ChannelInfo *ci = NULL;
- NickAlias *na = NULL;
- if (ischan)
- ci = ChannelInfo::Find(nname);
- else
- na = NickAlias::Find(nname);
- for (int i = mi->memos->size() - 1; i >= 0; --i)
- if (mi->GetMemo(i)->unread && source.nc->display.equals_ci(mi->GetMemo(i)->sender))
- {
- FOREACH_MOD(OnMemoDel, (ischan ? ci->name : na->nc->display, mi, mi->GetMemo(i)));
- mi->Del(i);
- source.Reply(_("Last memo to \002%s\002 has been cancelled."), nname.c_str());
- return;
- }
-
- source.Reply(_("No memo was cancelable."));
+ na = NickAlias::Find(nname);
+
+ if (na == NULL)
+ return; // can't happen
}
- return;
+
+ for (int i = mi->memos->size() - 1; i >= 0; --i)
+ {
+ Memo *m = mi->GetMemo(i);
+
+ if (!m->unread)
+ continue;
+
+ NickAlias *sender = NickAlias::Find(m->sender);
+
+ if (sender && sender->nc == source.GetAccount())
+ {
+ FOREACH_MOD(OnMemoDel, (ischan ? ci->name : na->nc->display, mi, m));
+ mi->Del(i);
+ source.Reply(_("Last memo to \002%s\002 has been cancelled."), (ischan ? ci->name : na->nc->display).c_str());
+ return;
+ }
+ }
+
+ source.Reply(_("No memo was cancelable."));
}
bool OnHelp(CommandSource &source, const Anope::string &subcommand) anope_override
diff --git a/modules/commands/ms_rsend.cpp b/modules/commands/ms_rsend.cpp
index b7744131a..e703ba067 100644
--- a/modules/commands/ms_rsend.cpp
+++ b/modules/commands/ms_rsend.cpp
@@ -51,7 +51,7 @@ class CommandMSRSend : public Command
source.Reply(ACCESS_DENIED);
else
{
- MemoServService::MemoResult result = memoserv->Send(source.GetNick(), nick, text);
+ MemoServService::MemoResult result = memoserv->Send(source.GetAccount()->display, nick, text);
if (result == MemoServService::MEMO_INVALID_TARGET)
source.Reply(_("\002%s\002 is not a registered unforbidden nick or channel."), nick.c_str());
else if (result == MemoServService::MEMO_TOO_FAST)
diff --git a/modules/commands/ms_send.cpp b/modules/commands/ms_send.cpp
index b028706d3..73ffd4c41 100644
--- a/modules/commands/ms_send.cpp
+++ b/modules/commands/ms_send.cpp
@@ -45,7 +45,7 @@ class CommandMSSend : public Command
return;
}
- MemoServService::MemoResult result = memoserv->Send(source.GetNick(), nick, text);
+ MemoServService::MemoResult result = memoserv->Send(source.GetAccount()->display, nick, text);
if (result == MemoServService::MEMO_SUCCESS)
{
source.Reply(_("Memo sent to \002%s\002."), nick.c_str());
diff --git a/modules/commands/ms_sendall.cpp b/modules/commands/ms_sendall.cpp
index 4cc0f350c..8f0514d6f 100644
--- a/modules/commands/ms_sendall.cpp
+++ b/modules/commands/ms_sendall.cpp
@@ -39,7 +39,7 @@ class CommandMSSendAll : public Command
const NickCore *nc = it->second;
if (nc != source.nc)
- memoserv->Send(source.GetNick(), nc->display, text);
+ memoserv->Send(source.GetAccount()->display, nc->display, text);
}
source.Reply(_("A massmemo has been sent to all registered users."));