Author: Isomer <isomer@coders.net>
[ircu2.10.12-pk.git] / include / s_user.h
1 /*
2  * s_user.h
3  *
4  * $Id$
5  */
6 #ifndef INCLUDED_s_user_h
7 #define INCLUDED_s_user_h
8 #ifndef INCLUDED_sys_types_h
9 #include <sys/types.h>
10 #define INCLUDED_sys_types_h
11 #endif
12
13 struct Client;
14 struct User;
15 struct Gline;
16 struct Channel;
17 struct MsgBuf;
18
19 /*
20  * Macros
21  */
22
23 /*
24  * Nick flood limit
25  * Minimum time between nick changes.
26  * (The first two changes are allowed quickly after another however).
27  */
28 #define NICK_DELAY 30
29
30 /*
31  * Target flood time.
32  * Minimum time between target changes.
33  * (MAXTARGETS are allowed simultaneously however).
34  * Its set to a power of 2 because we devide through it quite a lot.
35  */
36 #define TARGET_DELAY 128
37
38 /* return values for hunt_server() */
39
40 #define HUNTED_NOSUCH   (-1)    /* if the hunted server is not found */
41 #define HUNTED_ISME     0       /* if this server should execute the command */
42 #define HUNTED_PASS     1       /* if message passed onwards successfully */
43
44 /* used when sending to #mask or $mask */
45
46 #define MATCH_SERVER  1
47 #define MATCH_HOST    2
48
49 #define COOKIE_VERIFIED 0xffffffff
50
51 extern struct SLink *opsarray[];
52
53 typedef void (*InfoFormatter)(struct Client* who, struct MsgBuf* buf);
54
55 /*
56  * Prototypes
57  */
58 extern struct User* make_user(struct Client *cptr);
59 extern void         free_user(struct User *user);
60 extern int          register_user(struct Client* cptr, struct Client* sptr,
61                                   const char* nick, char* username,
62                                   struct Gline *agline);
63
64 extern void         user_count_memory(size_t* count_out, size_t* bytes_out);
65
66 extern int do_nick_name(char* nick);
67 extern int set_nick_name(struct Client* cptr, struct Client* sptr,
68                          const char* nick, int parc, char* parv[]);
69 extern void send_umode_out(struct Client* cptr, struct Client* sptr, int old,
70                            int prop);
71 extern int whisper(struct Client* source, const char* nick,
72                    const char* channel, const char* text, int is_notice);
73 extern void send_user_info(struct Client* to, char* names, int rpl,
74                            InfoFormatter fmt);
75 extern int add_silence(struct Client* sptr, const char* mask);
76
77 extern int set_user_mode(struct Client *cptr, struct Client *sptr,
78                          int parc, char *parv[]);
79 extern int is_silenced(struct Client *sptr, struct Client *acptr);
80 extern int hunt_server(int, struct Client *cptr, struct Client *sptr,
81     char *command, int server, int parc, char *parv[]);
82 extern int hunt_server_cmd(struct Client *from, const char *cmd,
83                            const char *tok, struct Client *one,
84                            int MustBeOper, const char *pattern, int server,
85                            int parc, char *parv[]);
86 extern struct Client* next_client(struct Client* next, const char* ch);
87 extern char *umode_str(struct Client *cptr);
88 extern void send_umode(struct Client *cptr, struct Client *sptr, int old, int sendmask);
89 extern int del_silence(struct Client *sptr, char *mask);
90 extern void set_snomask(struct Client *, unsigned int, int);
91 extern int is_snomask(char *);
92 extern int check_target_limit(struct Client *sptr, void *target, const char *name,
93     int created);
94 extern void add_target(struct Client *sptr, void *target);
95 extern unsigned int umode_make_snomask(unsigned int oldmask, char *arg,
96                                        int what);
97
98 #define NAMES_ALL 1 /* List all users in channel */
99 #define NAMES_VIS 2 /* List only visible users in non-secret channels */
100 #define NAMES_EON 4 /* Add an 'End Of Names' reply to the end */
101
102 void do_names(struct Client* sptr, struct Channel* chptr, int filter);
103
104 #endif /* INCLUDED_s_user_h */