… | |
… | |
7 | * |
7 | * |
8 | * Portions of this file were derived from sources bearing the following license: |
8 | * Portions of this file were derived from sources bearing the following license: |
9 | * Copyright © 2005 William Pitcock, et al. |
9 | * Copyright © 2005 William Pitcock, et al. |
10 | * Rights to this code are as documented in doc/pod/license.pod. |
10 | * Rights to this code are as documented in doc/pod/license.pod. |
11 | * |
11 | * |
12 | * $Id: users.h,v 1.5 2007/09/16 18:54:42 pippijn Exp $ |
12 | * $Id: users.h,v 1.6 2007/09/22 14:27:26 pippijn Exp $ |
13 | */ |
13 | */ |
14 | |
14 | |
15 | #ifndef USERS_H |
15 | #ifndef USERS_H |
16 | #define USERS_H |
16 | #define USERS_H |
17 | |
17 | |
18 | #include <ermyth/callback.h> |
18 | #include <ermyth/callback.h> |
|
|
19 | #include <util/predicates.h> |
19 | |
20 | |
20 | class user_t : public zero_initialised |
21 | class user_t : public zero_initialised |
21 | { |
22 | { |
22 | struct callbacks |
23 | struct callbacks |
23 | { |
24 | { |
… | |
… | |
30 | functor::callback1<user_t *> oper; |
31 | functor::callback1<user_t *> oper; |
31 | functor::callback1<user_t *> deoper; |
32 | functor::callback1<user_t *> deoper; |
32 | }; |
33 | }; |
33 | |
34 | |
34 | public: |
35 | public: |
|
|
36 | typedef std::pair<char const * const, user_t *> pair_type; |
|
|
37 | typedef std::map<char const * const, user_t *, irccase_lt> map_type; |
|
|
38 | typedef std::vector<user_t *> vector_type; |
|
|
39 | static map_type map; |
|
|
40 | |
35 | unsigned mu_index; // index used in myuser_t::login_vector |
41 | unsigned mu_index; // index used in myuser_t::login_vector |
36 | |
42 | |
37 | char nick[NICKLEN]; |
43 | char nick[NICKLEN]; |
38 | char user[USERLEN]; |
44 | char user[USERLEN]; |
39 | char host[HOSTLEN]; /* Real host */ |
45 | char host[HOSTLEN]; /* Real host */ |
40 | char gecos[GECOSLEN]; |
46 | char gecos[GECOSLEN]; |
41 | char vhost[HOSTLEN]; /* Visible host */ |
47 | char vhost[HOSTLEN]; /* Visible host */ |
… | |
… | |
71 | E bool is_ircop (user_t *user); |
77 | E bool is_ircop (user_t *user); |
72 | E bool is_admin (user_t *user); |
78 | E bool is_admin (user_t *user); |
73 | E bool is_internal_client (user_t *user); |
79 | E bool is_internal_client (user_t *user); |
74 | |
80 | |
75 | /* users.C */ |
81 | /* users.C */ |
76 | typedef std::pair<char const * const, user_t *> user_pair; |
|
|
77 | typedef std::map<char const * const, user_t *, irccase_lt> user_map; |
|
|
78 | E user_map userlist; |
|
|
79 | |
|
|
80 | E void init_users (void); |
82 | E void init_users (void); |
81 | |
83 | |
82 | E user_t *user_add (char const * const nick, char const * const user, char const * const host, char const * const vhost, char const * const ip, char const * const uid, char const * const gecos, server_t *server, time_t ts); |
84 | E user_t *user_add (char const * const nick, char const * const user, char const * const host, char const * const vhost, char const * const ip, char const * const uid, char const * const gecos, server_t *server, time_t ts); |
83 | E void user_delete (user_t *u); |
85 | E void user_delete (user_t *u); |
84 | E user_t *user_find (char const * const nick); |
86 | E user_t *user_find (char const * const nick); |