memo.h

Go to the documentation of this file.
00001 /*
00002  *
00003  * (C) 2003-2013 Anope Team
00004  * Contact us at team@anope.org
00005  *
00006  * Please read COPYING and README for further details.
00007  *
00008  * Based on the original code of Epona by Lara.
00009  * Based on the original code of Services by Andy Church.
00010  *
00011  */
00012 
00013 #ifndef MEMO_H
00014 #define MEMO_H
00015 
00016 #include "anope.h"
00017 #include "serialize.h"
00018 
00019 class CoreExport Memo : public Serializable
00020 {
00021  public:
00022         bool unread;
00023         bool receipt;
00024         Memo();
00025         ~Memo();
00026 
00027         void Serialize(Serialize::Data &data) const anope_override;
00028         static Serializable* Unserialize(Serializable *obj, Serialize::Data &);
00029 
00030         Anope::string owner;
00031         /* When it was sent */
00032         time_t time;
00033         Anope::string sender;
00034         Anope::string text;
00035 };
00036 
00037 /* Memo info structures.  Since both nicknames and channels can have memos,
00038  * we encapsulate memo data in a MemoInfo to make it easier to handle.
00039  */
00040 struct CoreExport MemoInfo
00041 {
00042         int16_t memomax;
00043         Serialize::Checker<std::vector<Memo *> > memos;
00044         std::vector<Anope::string> ignores;
00045 
00046         MemoInfo();
00047         Memo *GetMemo(unsigned index) const;
00048         unsigned GetIndex(Memo *m) const;
00049         void Del(unsigned index);
00050         bool HasIgnore(User *u);
00051 
00052         static MemoInfo *GetMemoInfo(const Anope::string &targ, bool &is_chan);
00053 };
00054 
00055 #endif // MEMO_H