Added SILC Thread Queue API
[crypto.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 struct _NICK_REC {
12 #include "nick-rec.h"
13 };
14
15 /* Add new nick to list */
16 void nicklist_insert(CHANNEL_REC *channel, NICK_REC *nick);
17 /* Set host address for nick */
18 void nicklist_set_host(CHANNEL_REC *channel, NICK_REC *nick, const char *host);
19 /* Remove nick from list */
20 void nicklist_remove(CHANNEL_REC *channel, NICK_REC *nick);
21 /* Change nick */
22 void nicklist_rename(SERVER_REC *server, const char *old_nick,
23                      const char *new_nick);
24 void nicklist_rename_unique(SERVER_REC *server,
25                             void *old_nick_id, const char *old_nick,
26                             void *new_nick_id, const char *new_nick);
27
28 /* Find nick */
29 NICK_REC *nicklist_find(CHANNEL_REC *channel, const char *nick);
30 NICK_REC *nicklist_find_unique(CHANNEL_REC *channel, const char *nick,
31                                void *id);
32 /* Find nick mask, wildcards allowed */
33 NICK_REC *nicklist_find_mask(CHANNEL_REC *channel, const char *mask);
34 /* Get list of nicks that match the mask */
35 GSList *nicklist_find_multiple(CHANNEL_REC *channel, const char *mask);
36 /* Get list of nicks */
37 GSList *nicklist_getnicks(CHANNEL_REC *channel);
38 /* Get all the nick records of `nick'. Returns channel, nick, channel, ... */
39 GSList *nicklist_get_same(SERVER_REC *server, const char *nick);
40 GSList *nicklist_get_same_unique(SERVER_REC *server, void *id);
41
42 /* Update specified nick's status in server. */
43 void nicklist_update_flags(SERVER_REC *server, const char *nick,
44                            int gone, int ircop);
45 void nicklist_update_flags_unique(SERVER_REC *server, void *id,
46                            int gone, int ircop);
47
48 /* Specify which nick in channel is ours */
49 void nicklist_set_own(CHANNEL_REC *channel, NICK_REC *nick);
50
51 /* Nick record comparision for sort functions */
52 #if GLIB_MAJOR_VERSION < 2
53 int nicklist_compare_glib1(NICK_REC *p1, NICK_REC *p2);
54 #endif
55 int nicklist_compare(NICK_REC *p1, NICK_REC *p2, const char *nick_prefix);
56
57 /* Check is `msg' is meant for `nick'. */
58 int nick_match_msg(CHANNEL_REC *channel, const char *msg, const char *nick);
59
60 void nicklist_init(void);
61 void nicklist_deinit(void);
62
63 #endif