1
0
mirror of https://github.com/anope/anope.git synced 2026-07-09 00:23:13 +02:00

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.
This commit is contained in:
Adam
2013-01-25 03:09:51 -05:00
parent 3769cc1a35
commit 76d9e58ae5
8 changed files with 43 additions and 51 deletions
+1 -21
View File
@@ -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;