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