ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/account/myuser.h
Revision: 1.10
Committed: Sat Sep 22 14:27:26 2007 UTC (16 years, 8 months ago) by pippijn
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.9: +3 -1 lines
Log Message:
split up ermyth into ermyth-modules, libermyth (currently just ermyth-util) and ermyth-core

File Contents

# Content
1 /**
2 * myuser.h: Data structures for account information.
3 *
4 * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team
5 * Rights to this code are as documented in COPYING.
6 *
7 *
8 * Portions of this file were derived from sources bearing the following license:
9 * Copyright © 2005-2006 Atheme Development Group
10 * Rights to this code are as documented in doc/pod/license.pod.
11 *
12 * $Id: myuser.h,v 1.9 2007-09-16 18:54:42 pippijn Exp $
13 */
14
15 #ifndef ACCOUNT_MYUSER_H
16 #define ACCOUNT_MYUSER_H
17
18 #include <account/metadata.h>
19 #include <account/mymemo.h>
20 #include <ermyth/callback.h>
21 #include <util/predicates.h>
22 #include <util/containers.h>
23
24 enum myuser_flag
25 {
26 MU_HOLD = 1 << 0,
27 MU_NEVEROP = 1 << 1,
28 MU_NOOP = 1 << 2,
29 MU_WAITAUTH = 1 << 3,
30 MU_HIDEMAIL = 1 << 4,
31 MU_OLD_ALIAS = 1 << 5, /* obsolete */
32 MU_NOMEMO = 1 << 6,
33 MU_EMAILMEMOS = 1 << 7,
34 MU_CRYPTPASS = 1 << 8,
35 MU_OLD_SASL = 1 << 9, /* obsolete */
36 MU_NOBURSTLOGIN = 1 << 10
37 };
38
39 /* services accounts */
40 class myuser_t : public object, public zero_initialised, public has_metadata
41 {
42 virtual void _destroy ();
43
44 struct callbacks : has_metadata::callbacks
45 {
46 functor::callback1<myuser_t *> drop;
47 functor::callback1<myuser_t *> registered;
48 };
49
50 public:
51 /* account/myuser.C */
52 typedef std::pair<char const * const, myuser_t *> pair_type;
53 typedef std::map<char const * const, myuser_t *, str_lt> map_type;
54 static map_type map;
55
56 public:
57 typedef indexing_vector<user_t, &user_t::mu_index> login_vector;
58 typedef indexing_vector<mymemo_t, &mymemo_t::mu_index> memo_vector;
59 typedef unordered_vector<char *> mzignore_vector; // memo ignores
60
61 myuser_t ()
62 : has_metadata (metadata::MYUSER)
63 {
64 }
65
66 unsigned flags;
67
68 char name[NICKLEN];
69 char pass[NICKLEN];
70 char email[EMAILLEN];
71
72 login_vector logins; /* user_t's currently logged in to this */
73 time_t registered;
74 time_t lastlogin;
75
76 list_t chanacs;
77 soper_t *soper;
78
79 memo_vector memos; /* store memos */
80 unsigned int memoct_new;
81 unsigned int memo_ratelimit_num; /* memos sent recently */
82 time_t memo_ratelimit_time; /* last time a memo was sent */
83 mzignore_vector memo_ignores;
84
85 /* openservices patch */
86 list_t access_list;
87
88 list_t nicks; /* registered nicks, must include mu->name if nonempty */
89
90 list_t subscriptions; /* presence subscriptors */
91
92 static callbacks callback;
93
94 /**
95 * Methods
96 */
97 static myuser_t *create (char const * const name, char const * const pass, char const * const email, unsigned int flags);
98
99 void notice (char const * const from, char const * const fmt, ...) const;
100
101 /* function.C */
102 bool is_founder (mychan_t *mychan) const;
103 bool should_owner (mychan_t *mychan) const;
104 bool should_protect (mychan_t *mychan) const;
105
106 void set_password (char const * const newpassword);
107 bool verify_password (char const * const password) const;
108
109 bool access_verify (user_t *u);
110 bool access_add (char const * const mask);
111 char *access_find (char const * const mask);
112 void access_delete (char const * const mask);
113
114 static myuser_t *find (char const * const name);
115 static myuser_t *find_ext (char const * const name);
116
117 unsigned num_channels ();
118
119 static void cleanup ();
120 };
121
122 #endif