Author: Bleep <tomh@inxpress.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
16 /*
17  * Macros
18  */
19
20 /*
21  * Nick flood limit
22  * Minimum time between nick changes.
23  * (The first two changes are allowed quickly after another however).
24  */
25 #define NICK_DELAY 30
26
27 /*
28  * Target flood time.
29  * Minimum time between target changes.
30  * (MAXTARGETS are allowed simultaneously however).
31  * Its set to a power of 2 because we devide through it quite a lot.
32  */
33 #define TARGET_DELAY 128
34
35 /* return values for hunt_server() */
36
37 #define HUNTED_NOSUCH   (-1)    /* if the hunted server is not found */
38 #define HUNTED_ISME     0       /* if this server should execute the command */
39 #define HUNTED_PASS     1       /* if message passed onwards successfully */
40
41 /* used when sending to #mask or $mask */
42
43 #define MATCH_SERVER  1
44 #define MATCH_HOST    2
45
46 #define COOKIE_VERIFIED 0xffffffff
47
48 extern struct SLink *opsarray[];
49
50 typedef char* (*InfoFormatter)(struct Client* who, char* buf);
51
52 /*
53  * Prototypes
54  */
55 extern struct User* make_user(struct Client *cptr);
56 extern void         free_user(struct User *user);
57 extern int          register_user(struct Client* cptr, struct Client* sptr,
58                                   const char* nick, char* username);
59
60 extern void         user_count_memory(size_t* count_out, size_t* bytes_out);
61
62 extern int user_set_away(struct User* user, char* message);
63 extern int do_nick_name(char* nick);
64 extern int set_nick_name(struct Client* cptr, struct Client* sptr,
65                          const char* nick, int parc, char* parv[]);
66 extern void send_umode_out(struct Client* cptr, struct Client* sptr, int old);
67 extern int whisper(struct Client* source, const char* nick,
68                    const char* channel, const char* text, int is_notice);
69 extern void send_user_info(struct Client* to, char* names, int rpl,
70                            InfoFormatter fmt);
71 extern int add_silence(struct Client* sptr, const char* mask);
72
73 extern int set_user_mode(struct Client *cptr, struct Client *sptr,
74                          int parc, char *parv[]);
75 extern int is_silenced(struct Client *sptr, struct Client *acptr);
76 extern int hunt_server(int, struct Client *cptr, struct Client *sptr,
77     char *command, int server, int parc, char *parv[]);
78 extern struct Client* next_client(struct Client* next, const char* ch);
79 extern char *umode_str(struct Client *cptr);
80 extern void send_umode(struct Client *cptr, struct Client *sptr, int old, int sendmask);
81 extern int del_silence(struct Client *sptr, char *mask);
82 extern void set_snomask(struct Client *, unsigned int, int);
83 extern int is_snomask(char *);
84 extern int check_target_limit(struct Client *sptr, void *target, const char *name,
85     int created);
86 extern void add_target(struct Client *sptr, void *target);
87 extern unsigned int umode_make_snomask(unsigned int oldmask, char *arg,
88                                        int what);
89
90
91 #endif /* INCLUDED_s_user_h */