Merge Irssi 0.8.16-rc1
[silc.git] / apps / irssi / src / core / nicklist.h
1 #ifndef __NICKLIST_H
2 #define __NICKLIST_H
3
4 /* Returns NICK_REC if it's nick, NULL if it isn't. */
5 #define NICK(server) \
6         MODULE_CHECK_CAST(server, NICK_REC, type, "NICK")
7
8 #define IS_NICK(server) \
9         (NICK(server) ? TRUE : FALSE)
10
11 #define MAX_USER_PREFIXES 7 /* Max prefixes kept for any user-in-chan. 7+1 is a memory unit */
12
13 struct _NICK_REC {
14 #include "nick-rec.h"
15 };
16
17 /* Add new nick to list */
18 void nicklist_insert(CHANNEL_REC *channel, NICK_REC *nick);
19 /* Set host address for nick */
20 void nicklist_set_host(CHANNEL_REC *channel, NICK_REC *nick, const char *host);
21 /* Remove nick from list */
22 void nicklist_remove(CHANNEL_REC *channel, NICK_REC *nick);
23 /* Change nick */
24 void nicklist_rename(SERVER_REC *server, const char *old_nick,
25                      const char *new_nick);
26 void nicklist_rename_unique(SERVER_REC *server,
27                             void *old_nick_id, const char *old_nick,
28                             void *new_nick_id, const char *new_nick);
29
30 /* Find nick */
31 NICK_REC *nicklist_find(CHANNEL_REC *channel, const char *nick);
32 NICK_REC *nicklist_find_unique(CHANNEL_REC *channel, const char *nick,
33                                void *id);
34 /* Find nick mask, wildcards allowed */
35 NICK_REC *nicklist_find_mask(CHANNEL_REC *channel, const char *mask);
36 /* Get list of nicks that match the mask */
37 GSList *nicklist_find_multiple(CHANNEL_REC *channel, const char *mask);
38 /* Get list of nicks */
39 GSList *nicklist_getnicks(CHANNEL_REC *channel);
40 /* Get all the nick records of `nick'. Returns channel, nick, channel, ... */
41 GSList *nicklist_get_same(SERVER_REC *server, const char *nick);
42 GSList *nicklist_get_same_unique(SERVER_REC *server, void *id);
43
44 /* Update specified nick's status in server. */
45 void nicklist_update_flags(SERVER_REC *server, const char *nick,
46                            int gone, int ircop);
47 void nicklist_update_flags_unique(SERVER_REC *server, void *id,
48                            int gone, int ircop);
49
50 /* Specify which nick in channel is ours */
51 void nicklist_set_own(CHANNEL_REC *channel, NICK_REC *nick);
52
53 /* Nick record comparison for sort functions */
54 int nicklist_compare(NICK_REC *p1, NICK_REC *p2, const char *nick_prefix);
55
56 /* Check is `msg' is meant for `nick'. */
57 int nick_match_msg(CHANNEL_REC *channel, const char *msg, const char *nick);
58
59 void nicklist_init(void);
60 void nicklist_deinit(void);
61
62 #endif