Debian Codegraph @

include/users.h

raw
1 /*
2 * Copyright (C) 2005 William Pitcock, et al.
3 * Rights to this code are as documented in doc/LICENSE.
4 *
5 * Data structures for connected clients.
6 *
7 */
8
9 #ifndef USERS_H
10 #define USERS_H
11
12 struct user_
13 {
14 object_t parent;
15
16 stringref nick;
17 stringref user;
18 stringref host; /* Real host */
19 stringref gecos;
20 stringref chost; /* Cloaked host */
21 stringref vhost; /* Visible host */
22 stringref uid; /* Used for TS6, P10, IRCNet ircd. */
23 stringref ip;
24
25 mowgli_list_t channels;
26
27 server_t *server;
28 myuser_t *myuser;
29
30 unsigned int offenses;
31 unsigned int msgs; /* times FLOOD_MSGS_FACTOR */
32 time_t lastmsg;
33
34 unsigned int flags;
35
36 time_t ts;
37
38 mowgli_node_t snode; /* for server_t.userlist */
39
40 char *certfp; /* client certificate fingerprint */
41 };
42
43 #define FLOOD_MSGS_FACTOR 256
44
45 #define UF_AWAY 0x00000002
46 #define UF_INVIS 0x00000004
47 #define UF_IRCOP 0x00000010
48 #define UF_ADMIN 0x00000020
49 #define UF_SEENINFO 0x00000080
50 #define UF_IMMUNE 0x00000100 /* user is immune from kickban, don't bother enforcing akicks */
51 #define UF_HIDEHOSTREQ 0x00000200 /* host hiding requested */
52 #define UF_SOPER_PASS 0x00000400 /* services oper pass entered */
53 #define UF_DOENFORCE 0x00000800 /* introduce enforcer when nick changes */
54 #define UF_ENFORCER 0x00001000 /* this is an enforcer client */
55 #define UF_WASENFORCED 0x00002000 /* this user was FNCed once already */
56 #define UF_DEAF 0x00004000 /* user does not receive channel msgs */
57 #define UF_SERVICE 0x00008000 /* user is a service (e.g. +S on charybdis) */
58 #define UF_KLINESENT 0x00010000 /* we've sent a kline for this user */
59
60 #define CLIENT_NAME(user) ((user)->uid != NULL ? (user)->uid : (user)->nick)
61
62 typedef struct {
63 user_t *u; /* User in question. Write NULL here if you delete the user. */
64 const char *oldnick; /* Previous nick for nick changes. u->nick is the new nick. */
65 } hook_user_nick_t;
66
67 typedef struct {
68 user_t *const u;
69 const char *comment;
70 } hook_user_delete_t;
71
72 /* function.c */
73 E bool is_ircop(user_t *user);
74 E bool is_admin(user_t *user);
75 E bool is_internal_client(user_t *user);
76 E bool is_autokline_exempt(user_t *user);
77 E bool is_service(user_t *user);
78
79 /* users.c */
80 E mowgli_patricia_t *userlist;
81 E mowgli_patricia_t *uidlist;
82
83 E void init_users(void);
84
85 E user_t *user_add(const char *nick, const char *user, const char *host, const char *vhost, const char *ip, const char *uid, const char *gecos, server_t *server, time_t ts);
86 E void user_delete(user_t *u, const char *comment);
87 E user_t *user_find(const char *nick);
88 E user_t *user_find_named(const char *nick);
89 E void user_changeuid(user_t *u, const char *uid);
90 E bool user_changenick(user_t *u, const char *nick, time_t ts);
91 E void user_mode(user_t *user, const char *modes);
92 E void user_sethost(user_t *source, user_t *target, const char *host);
93 E const char *user_get_umodestr(user_t *u);
94 E bool user_is_channel_banned(user_t *u, char ban_type);
95
96 /* uid.c */
97 E void init_uid(void);
98 E const char *uid_get(void);
99
100 #endif
101
102 /* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs
103 * vim:ts=8
104 * vim:sw=8
105 * vim:noexpandtab
106 */