summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/commands/ms_cancel.cpp2
-rw-r--r--modules/commands/ms_ignore.cpp2
-rw-r--r--modules/commands/ms_rsend.cpp2
-rw-r--r--modules/database/db_sql_live.cpp2
-rw-r--r--modules/pseudoclients/memoserv.cpp22
-rw-r--r--modules/pseudoclients/memoserv.h7
6 files changed, 5 insertions, 32 deletions
diff --git a/modules/commands/ms_cancel.cpp b/modules/commands/ms_cancel.cpp
index 908c4ef96..e03883d91 100644
--- a/modules/commands/ms_cancel.cpp
+++ b/modules/commands/ms_cancel.cpp
@@ -34,7 +34,7 @@ class CommandMSCancel : public Command
const Anope::string &nname = params[0];
bool ischan;
- MemoInfo *mi = MemoServService->GetMemoInfo(nname, ischan);
+ MemoInfo *mi = MemoInfo::GetMemoInfo(nname, ischan);
if (mi == NULL)
source.Reply(ischan ? CHAN_X_NOT_REGISTERED : _(NICK_X_NOT_REGISTERED), nname.c_str());
diff --git a/modules/commands/ms_ignore.cpp b/modules/commands/ms_ignore.cpp
index ec56624b8..7caa30f88 100644
--- a/modules/commands/ms_ignore.cpp
+++ b/modules/commands/ms_ignore.cpp
@@ -44,7 +44,7 @@ class CommandMSIgnore : public Command
}
bool ischan;
- MemoInfo *mi = MemoServService->GetMemoInfo(channel, ischan);
+ MemoInfo *mi = MemoInfo::GetMemoInfo(channel, ischan);
ChannelInfo *ci = ChannelInfo::Find(channel);
if (!mi)
source.Reply(ischan ? CHAN_X_NOT_REGISTERED : _(NICK_X_NOT_REGISTERED), channel.c_str());
diff --git a/modules/commands/ms_rsend.cpp b/modules/commands/ms_rsend.cpp
index 19bd80437..fafcf5eff 100644
--- a/modules/commands/ms_rsend.cpp
+++ b/modules/commands/ms_rsend.cpp
@@ -63,7 +63,7 @@ class CommandMSRSend : public Command
source.Reply(_("Memo sent to \002%s\002."), name.c_str());
bool ischan;
- MemoInfo *mi = MemoServService->GetMemoInfo(nick, ischan);
+ MemoInfo *mi = MemoInfo::GetMemoInfo(nick, ischan);
if (mi == NULL)
throw CoreException("NULL mi in ms_rsend");
Memo *m = (mi->memos->size() ? mi->GetMemo(mi->memos->size() - 1) : NULL);
diff --git a/modules/database/db_sql_live.cpp b/modules/database/db_sql_live.cpp
index 156e6e120..aec84c8ef 100644
--- a/modules/database/db_sql_live.cpp
+++ b/modules/database/db_sql_live.cpp
@@ -109,7 +109,7 @@ class DBMySQL : public Module, public Pipe
this->RunQueryResult(create[i]);
Result res = this->RunQueryResult(this->SQL->BuildInsert(this->prefix + s_type->GetName(), obj->id, *data));
- if (obj->id != res.GetID())
+ if (res.GetID() && obj->id != res.GetID())
{
/* In this case obj is new, so place it into the object map */
obj->id = res.GetID();
diff --git a/modules/pseudoclients/memoserv.cpp b/modules/pseudoclients/memoserv.cpp
index 17aaaa308..ca54f3378 100644
--- a/modules/pseudoclients/memoserv.cpp
+++ b/modules/pseudoclients/memoserv.cpp
@@ -39,30 +39,10 @@ class MyMemoServService : public MemoServService
public:
MyMemoServService(Module *m) : MemoServService(m) { }
- MemoInfo *GetMemoInfo(const Anope::string &target, bool &ischan) anope_override
- {
- if (!target.empty() && target[0] == '#')
- {
- ischan = true;
- ChannelInfo *ci = ChannelInfo::Find(target);
- if (ci != NULL)
- return &ci->memos;
- }
- else
- {
- ischan = false;
- NickAlias *na = NickAlias::Find(target);
- if (na != NULL)
- return &na->nc->memos;
- }
-
- return NULL;
- }
-
MemoResult Send(const Anope::string &source, const Anope::string &target, const Anope::string &message, bool force) anope_override
{
bool ischan;
- MemoInfo *mi = this->GetMemoInfo(target, ischan);
+ MemoInfo *mi = MemoInfo::GetMemoInfo(target, ischan);
if (mi == NULL)
return MEMO_INVALID_TARGET;
diff --git a/modules/pseudoclients/memoserv.h b/modules/pseudoclients/memoserv.h
index e314c7208..71ca064de 100644
--- a/modules/pseudoclients/memoserv.h
+++ b/modules/pseudoclients/memoserv.h
@@ -14,13 +14,6 @@ class MemoServService : public Service
MemoServService(Module *m) : Service(m, "MemoServService", "MemoServ") { }
- /** Retrieve the memo info for a nick or channel
- * @param target Target
- * @param ischan Set to true if target is a channel
- * @return A memoinfo structure or NULL
- */
- virtual MemoInfo *GetMemoInfo(const Anope::string &target, bool &ischan) = 0;
-
/** Sends a memo.
* @param source The source of the memo, can be anythin.
* @param target The target of the memo, nick or channel.