ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/users.h
Revision: 1.6
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.5: +8 -6 lines
Log Message:
split up ermyth into ermyth-modules, libermyth (currently just ermyth-util) and ermyth-core

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.6 * $Id: users.h,v 1.5 2007-09-16 18:54:42 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 pippijn 1.6 #include <util/predicates.h>
20 pippijn 1.3
21     class user_t : public zero_initialised
22 pippijn 1.1 {
23 pippijn 1.3 struct callbacks
24     {
25     functor::callback3<char const * const /* uid */, char const /* mode */, char const * const /* buf */> sasl_input;
26     functor::callback1<user_t *> add;
27     functor::callback1<user_t *> away;
28     functor::callback3<sourceinfo_t *, char const * const /* account */, char const * const /* email */, bool /* return value */, functor::combiner::boolean::strongtrue> can_register;
29     functor::callback1<user_t *> remove;
30     functor::callback1<user_t *> identify;
31     functor::callback1<user_t *> oper;
32     functor::callback1<user_t *> deoper;
33     };
34    
35     public:
36 pippijn 1.6 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    
41 pippijn 1.4 unsigned mu_index; // index used in myuser_t::login_vector
42 pippijn 1.6
43 pippijn 1.1 char nick[NICKLEN];
44     char user[USERLEN];
45 pippijn 1.3 char host[HOSTLEN]; /* Real host */
46 pippijn 1.1 char gecos[GECOSLEN];
47 pippijn 1.3 char vhost[HOSTLEN]; /* Visible host */
48     char uid[IDLEN]; /* Used for TS6, P10, IRCNet ircd. */
49 pippijn 1.1 char ip[HOSTIPLEN];
50    
51     list_t channels;
52    
53     server_t *server;
54     myuser_t *myuser;
55    
56     unsigned int offenses;
57     unsigned int msgs;
58     time_t lastmsg;
59    
60     unsigned int flags;
61    
62     time_t ts;
63 pippijn 1.3
64     static callbacks callback;
65 pippijn 1.1 };
66    
67 pippijn 1.3 #define UF_AWAY 0x00000002
68     #define UF_INVIS 0x00000004
69     #define UF_IRCOP 0x00000010
70     #define UF_ADMIN 0x00000020
71     #define UF_SEENINFO 0x00000080
72     #define UF_HIDEHOSTREQ 0x00000200 /* host hiding requested */
73 pippijn 1.1
74 pippijn 1.3 #define CLIENT_NAME(user) ((user)->uid[0] ? (user)->uid : (user)->nick)
75 pippijn 1.1
76     /* function.c */
77     E bool is_ircop (user_t *user);
78     E bool is_admin (user_t *user);
79     E bool is_internal_client (user_t *user);
80    
81 pippijn 1.3 /* users.C */
82 pippijn 1.1 E void init_users (void);
83    
84 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);
85 pippijn 1.1 E void user_delete (user_t *u);
86 pippijn 1.3 E user_t *user_find (char const * const nick);
87     E user_t *user_find_named (char const * const nick);
88     E void user_changeuid (user_t *u, char const * const uid);
89     E void user_changenick (user_t *u, char const * const nick, time_t ts);
90     E void user_mode (user_t *user, char const * const modes);
91 pippijn 1.1
92     /* uid.c */
93     E void init_uid (void);
94     E char *uid_get (void);
95    
96     #endif