/** * myuser.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: myuser.h,v 1.10 2007/09/22 14:27:26 pippijn Exp $ */ #ifndef ACCOUNT_MYUSER_H #define ACCOUNT_MYUSER_H #include #include #include #include #include enum myuser_flag { MU_HOLD = 1 << 0, MU_NEVEROP = 1 << 1, MU_NOOP = 1 << 2, MU_WAITAUTH = 1 << 3, MU_HIDEMAIL = 1 << 4, MU_OLD_ALIAS = 1 << 5, /* obsolete */ MU_NOMEMO = 1 << 6, MU_EMAILMEMOS = 1 << 7, MU_CRYPTPASS = 1 << 8, MU_OLD_SASL = 1 << 9, /* obsolete */ MU_NOBURSTLOGIN = 1 << 10 }; /* services accounts */ class myuser_t : public object, public zero_initialised, public has_metadata { virtual void _destroy (); struct callbacks : has_metadata::callbacks { functor::callback1 drop; functor::callback1 registered; }; public: /* account/myuser.C */ typedef std::pair pair_type; typedef std::map map_type; static map_type map; public: typedef indexing_vector login_vector; typedef indexing_vector memo_vector; typedef unordered_vector mzignore_vector; // memo ignores myuser_t () : has_metadata (metadata::MYUSER) { } unsigned flags; char name[NICKLEN]; char pass[NICKLEN]; char email[EMAILLEN]; login_vector logins; /* user_t's currently logged in to this */ time_t registered; time_t lastlogin; list_t chanacs; soper_t *soper; memo_vector memos; /* store memos */ unsigned int memoct_new; unsigned int memo_ratelimit_num; /* memos sent recently */ time_t memo_ratelimit_time; /* last time a memo was sent */ mzignore_vector memo_ignores; /* openservices patch */ list_t access_list; list_t nicks; /* registered nicks, must include mu->name if nonempty */ list_t subscriptions; /* presence subscriptors */ static callbacks callback; /** * Methods */ static myuser_t *create (char const * const name, char const * const pass, char const * const email, unsigned int flags); void notice (char const * const from, char const * const fmt, ...) const; /* function.C */ bool is_founder (mychan_t *mychan) const; bool should_owner (mychan_t *mychan) const; bool should_protect (mychan_t *mychan) const; void set_password (char const * const newpassword); bool verify_password (char const * const password) const; bool access_verify (user_t *u); bool access_add (char const * const mask); char *access_find (char const * const mask); void access_delete (char const * const mask); static myuser_t *find (char const * const name); static myuser_t *find_ext (char const * const name); unsigned num_channels (); static void cleanup (); }; #endif