ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/include/users.h
Revision: 1.4
Committed: Sun Sep 9 20:05:51 2007 UTC (16 years, 8 months ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.3: +2 -2 lines
Log Message:
- changed configurations to the c++ stdlib
- more #defines to enum
- removed getopt.h and link.h from the system as they were unused
- reworked logstreams
- added an itoa with old syntax
- made klines objects
- moved some global variables into appropriate classes
- fixed boost.foreach's compiler workaround #if's
- allow other files to add exceptions with ADD_EXCEPTION
- changed mynick_t to c++ object
- moved servers.h out of atheme.h
- corrected PING from inspircd 1.2

File Contents

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