imported.
[crypto.git] / apps / irssi / src / core / server-rec.h
1 /* SERVER_REC definition, used for inheritance */
2
3 int type; /* module_get_uniq_id("SERVER", 0) */
4 int chat_type; /* chat_protocol_lookup(xx) */
5
6 STRUCT_SERVER_CONNECT_REC *connrec;
7 time_t connect_time; /* connection time */
8 time_t real_connect_time; /* time when server replied that we really are connected */
9
10 char *tag; /* tag name for addressing server */
11 char *nick; /* current nick */
12
13 unsigned int connected:1; /* connected to server */
14 unsigned int connection_lost:1; /* Connection lost unintentionally */
15
16 NET_SENDBUF_REC *handle;
17 int readtag; /* input tag */
18
19 /* for net_connect_nonblock() */
20 GIOChannel *connect_pipe[2];
21 int connect_tag;
22 int connect_pid;
23
24 /* For deciding if event should be handled internally */
25 GHashTable *eventtable; /* "event xxx" : GSList* of REDIRECT_RECs */
26 GHashTable *eventgrouptable; /* event group : GSList* of REDIRECT_RECs */
27 GHashTable *cmdtable; /* "command xxx" : REDIRECT_CMD_REC* */
28
29 RAWLOG_REC *rawlog;
30 LINEBUF_REC *buffer; /* receive buffer */
31 GHashTable *module_data;
32
33 char *version; /* server version */
34 char *away_reason;
35 char *last_invite; /* channel where you were last invited */
36 unsigned int server_operator:1;
37 unsigned int usermode_away:1;
38 unsigned int banned:1; /* not allowed to connect to this server */
39 unsigned int dns_error:1; /* DNS said the host doesn't exist */
40
41 time_t lag_sent; /* 0 or time when last lag query was sent to server */
42 time_t lag_last_check; /* last time we checked lag */
43 int lag; /* server lag in milliseconds */
44
45 GSList *channels;
46 GSList *queries;
47
48 /* -- support for multiple server types -- */
49
50 /* -- must not be NULL: -- */
51 /* join to a number of channels, channels are specified in `data' separated
52    with commas. there can exist other information after first space like
53    channel keys etc. */
54 void (*channels_join)(SERVER_REC *server, const char *data, int automatic);
55 /* returns true if `flag' indicates a nick flag (op/voice/halfop) */
56 int (*isnickflag)(char flag);
57 /* returns true if `data' indicates a channel */
58 int (*ischannel)(const char *data);
59 /* returns all nick flag characters in order op, voice, halfop. If some
60    of them aren't supported '\0' can be used. */
61 const char *(*get_nick_flags)(void);
62 /* send public or private message to server */
63 void (*send_message)(SERVER_REC *server, const char *target, const char *msg);
64
65 /* -- Default implementations are used if NULL -- */
66 CHANNEL_REC *(*channel_find_func)(SERVER_REC *server, const char *name);
67 QUERY_REC *(*query_find_func)(SERVER_REC *server, const char *nick);
68 int (*mask_match_func)(const char *mask, const char *data);
69 /* returns true if `msg' was meant for `nick' */
70 int (*nick_match_msg)(const char *nick, const char *msg);
71
72 #undef STRUCT_SERVER_CONNECT_REC