From 76d9e58ae59ca99452ebaeedef661d0f82fc7104 Mon Sep 17 00:00:00 2001 From: Adam Date: Fri, 25 Jan 2013 03:09:51 -0500 Subject: mysql_insert_id doesn't return an id if one isnt generated, so check that it really returns a value before using it. Also fix memos to cleanup after themselves when deleted. --- modules/pseudoclients/memoserv.cpp | 22 +--------------------- modules/pseudoclients/memoserv.h | 7 ------- 2 files changed, 1 insertion(+), 28 deletions(-) (limited to 'modules/pseudoclients') 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. -- cgit