/** * mychan.h: Data structures for account information. * * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team * Rights to this code are as documented in COPYING. * * * Portions of this file were derived from sources bearing the following license: * Copyright © 2005-2006 Atheme Development Group * Rights to this code are as documented in doc/pod/license.pod. * * $Id: mychan.h,v 1.8 2007/09/22 14:27:26 pippijn Exp $ */ #ifndef ACCOUNT_MYCHAN_H #define ACCOUNT_MYCHAN_H #include #include #include enum mychan_flag { MC_HOLD = 1 << 0, MC_NOOP = 1 << 1, MC_RESTRICTED = 1 << 2, MC_SECURE = 1 << 3, MC_VERBOSE = 1 << 4, MC_STAFFONLY = 1 << 5, MC_KEEPTOPIC = 1 << 6, MC_VERBOSE_OPS = 1 << 7, MC_TOPICLOCK = 1 << 8, MC_GUARD = 1 << 9, /* The following are temporary state */ MC_INHABIT = 1 << 10, /* we're on channel to enforce akick/staffonly/close */ MC_MLOCK_CHECK = 1 << 11, /* we need to check mode locks */ MC_FORCEVERBOSE = 1 << 12, /* fantasy cmd in progress, be verbose */ MC_VERBOSE_MASK = MC_VERBOSE | MC_VERBOSE_OPS }; // registered channel class mychan_t : public object, public zero_initialised, public has_metadata { virtual void _destroy (); struct callbacks : has_metadata::callbacks { functor::callback2 info; functor::callback1 drop; functor::callback2 registered; }; public: /* account.c */ typedef std::pair pair_type; typedef std::map map_type; static map_type map; public: unsigned flags; mychan_t () : has_metadata (metadata::MYCHAN) { } char name[CHANNELLEN]; myuser_t *founder; channel_t *chan; list_t chanacs; time_t registered; time_t used; int mlock_on; int mlock_off; unsigned int mlock_limit; char *mlock_key; list_t metadata; static callbacks callback; /** * Methods */ static mychan_t *create (char const * const name); static mychan_t *find (char const * const name); bool isused (); unsigned num_founders (); char const * const founder_names (); myuser_t *pick_candidate (unsigned int minlevel, int maxtime); myuser_t *pick_successor (); static void cleanup (); }; #endif