ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/users.h
Revision: 1.5
Committed: Sun Sep 16 18:54:42 2007 UTC (16 years, 8 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.4: +9 -4 lines
Log Message:
#defines to enum

File Contents

# User Rev Content
1 pippijn 1.5 /**
2     * users.h: Data structures for connected clients.
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 pippijn 1.3 * Copyright © 2005 William Pitcock, et al.
10 pippijn 1.2 * Rights to this code are as documented in doc/pod/license.pod.
11 pippijn 1.1 *
12 pippijn 1.5 * $Id: users.h,v 1.4 2007-09-09 20:05:51 pippijn Exp $
13 pippijn 1.1 */
14    
15     #ifndef USERS_H
16     #define USERS_H
17    
18 pippijn 1.3 #include <ermyth/callback.h>
19    
20     class user_t : public zero_initialised
21 pippijn 1.1 {
22 pippijn 1.3 struct callbacks
23     {
24     functor::callback3<char const * const /* uid */, char const /* mode */, char const * const /* buf */> sasl_input;
25     functor::callback1<user_t *> add;
26     functor::callback1<user_t *> away;
27     functor::callback3<sourceinfo_t *, char const * const /* account */, char const * const /* email */, bool /* return value */, functor::combiner::boolean::strongtrue> can_register;
28     functor::callback1<user_t *> remove;
29     functor::callback1<user_t *> identify;
30     functor::callback1<user_t *> oper;
31     functor::callback1<user_t *> deoper;
32     };
33    
34     public:
35 pippijn 1.4 unsigned mu_index; // index used in myuser_t::login_vector
36 pippijn 1.1
37     char nick[NICKLEN];
38     char user[USERLEN];
39 pippijn 1.3 char host[HOSTLEN]; /* Real host */
40 pippijn 1.1 char gecos[GECOSLEN];
41 pippijn 1.3 char vhost[HOSTLEN]; /* Visible host */
42     char uid[IDLEN]; /* Used for TS6, P10, IRCNet ircd. */
43 pippijn 1.1 char ip[HOSTIPLEN];
44    
45     list_t channels;
46    
47     server_t *server;
48     myuser_t *myuser;
49    
50     unsigned int offenses;
51     unsigned int msgs;
52     time_t lastmsg;
53    
54     unsigned int flags;
55    
56     time_t ts;
57 pippijn 1.3
58     static callbacks callback;
59 pippijn 1.1 };
60    
61 pippijn 1.3 #define UF_AWAY 0x00000002
62     #define UF_INVIS 0x00000004
63     #define UF_IRCOP 0x00000010
64     #define UF_ADMIN 0x00000020
65     #define UF_SEENINFO 0x00000080
66     #define UF_HIDEHOSTREQ 0x00000200 /* host hiding requested */
67 pippijn 1.1
68 pippijn 1.3 #define CLIENT_NAME(user) ((user)->uid[0] ? (user)->uid : (user)->nick)
69 pippijn 1.1
70     /* function.c */
71     E bool is_ircop (user_t *user);
72     E bool is_admin (user_t *user);
73     E bool is_internal_client (user_t *user);
74    
75 pippijn 1.3 /* 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 pippijn 1.1
80     E void init_users (void);
81    
82 pippijn 1.3 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 pippijn 1.1 E void user_delete (user_t *u);
84 pippijn 1.3 E user_t *user_find (char const * const nick);
85     E user_t *user_find_named (char const * const nick);
86     E void user_changeuid (user_t *u, char const * const uid);
87     E void user_changenick (user_t *u, char const * const nick, time_t ts);
88     E void user_mode (user_t *user, char const * const modes);
89 pippijn 1.1
90     /* uid.c */
91     E void init_uid (void);
92     E char *uid_get (void);
93    
94     #endif