summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command.cpp2
-rw-r--r--src/memos.cpp15
2 files changed, 13 insertions, 4 deletions
diff --git a/src/command.cpp b/src/command.cpp
index afabf24fc..35a99eb80 100644
--- a/src/command.cpp
+++ b/src/command.cpp
@@ -117,7 +117,7 @@ void CommandSource::Reply(const Anope::string &message)
this->reply->SendMessage(this->service, tok);
}
-Command::Command(Module *o, const Anope::string &sname, size_t minparams, size_t maxparams) : Service(o, "Command", sname), max_params(maxparams), min_params(minparams), module(owner)
+Command::Command(Module *o, const Anope::string &sname, size_t minparams, size_t maxparams) : Service(o, "Command", sname), max_params(maxparams), min_params(minparams), module(o)
{
allow_unregistered = require_user = false;
}
diff --git a/src/memos.cpp b/src/memos.cpp
index 0f591757b..bf8f0eb73 100644
--- a/src/memos.cpp
+++ b/src/memos.cpp
@@ -19,13 +19,12 @@
Memo::Memo() : Serializable("Memo")
{
+ mi = NULL;
unread = receipt = false;
}
Memo::~Memo()
{
- bool ischan;
- MemoInfo *mi = MemoInfo::GetMemoInfo(this->owner, ischan);
if (mi)
{
std::vector<Memo *>::iterator it = std::find(mi->memos->begin(), mi->memos->end(), this);
@@ -60,7 +59,10 @@ Serializable* Memo::Unserialize(Serializable *obj, Serialize::Data &data)
if (obj)
m = anope_dynamic_static_cast<Memo *>(obj);
else
+ {
m = new Memo();
+ m->mi = mi;
+ }
m->owner = owner;
data["time"] >> m->time;
@@ -99,7 +101,14 @@ void MemoInfo::Del(unsigned index)
{
if (index >= this->memos->size())
return;
- delete this->GetMemo(index);
+
+ Memo *m = this->GetMemo(index);
+
+ std::vector<Memo *>::iterator it = std::find(memos->begin(), memos->end(), m);
+ if (it != memos->end())
+ memos->erase(it);
+
+ delete m;
}
bool MemoInfo::HasIgnore(User *u)