MemoServ::MemoInfo *GetMemoInfo(const Anope::string &target, bool &is_registered, bool &ischan, bool create) override { if (!target.empty() && target[0] == '#') { ischan = true; ChanServ::Channel *ci = ChanServ::Find(target); if (ci != NULL) { is_registered = true; if (create && !ci->GetMemos()) { MemoServ::MemoInfo *mi = Serialize::New<MemoServ::MemoInfo *>(); mi->SetOwner(ci); } return ci->GetMemos(); } else is_registered = false; } else { ischan = false; NickServ::Nick *na = NickServ::FindNick(target); if (na != NULL) { is_registered = true; if (create && !na->GetAccount()->GetMemos()) { MemoServ::MemoInfo *mi = Serialize::New<MemoServ::MemoInfo *>(); mi->SetOwner(na->GetAccount()); } return na->GetAccount()->GetMemos(); } else is_registered = false; } return NULL; }
void OnChanRegistered(ChanServ::Channel *ci) override { MemoServ::MemoInfo *mi = Serialize::New<MemoServ::MemoInfo *>(); mi->SetOwner(ci); mi->SetMemoMax(Config->GetModule(this)->Get<int>("maxmemos")); }
void OnNickRegister(User *, NickServ::Nick *na, const Anope::string &) override { MemoServ::MemoInfo *mi = Serialize::New<MemoServ::MemoInfo *>(); mi->SetOwner(na->GetAccount()); mi->SetMemoMax(Config->GetModule(this)->Get<int>("maxmemos")); }