Added SILC Thread Queue API
[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 int refcount;
7
8 STRUCT_SERVER_CONNECT_REC *connrec;
9 time_t connect_time; /* connection time */
10 time_t real_connect_time; /* time when server replied that we really are connected */
11
12 char *tag; /* tag name for addressing server */
13 char *nick; /* current nick */
14
15 unsigned int connected:1; /* Connected to server */
16 unsigned int disconnected:1; /* Disconnected, waiting for refcount to drop zero */
17 unsigned int connection_lost:1; /* Connection lost unintentionally */
18 unsigned int session_reconnect:1; /* Connected to this server with /UPGRADE */
19 unsigned int no_reconnect:1; /* Don't reconnect to server */
20
21 NET_SENDBUF_REC *handle;
22 int readtag; /* input tag */
23
24 /* for net_connect_nonblock() */
25 GIOChannel *connect_pipe[2];
26 int connect_tag;
27 int connect_pid;
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 GTimeVal 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)(SERVER_REC *server, char flag);
57 /* returns true if `data' indicates a channel */
58 int (*ischannel)(SERVER_REC *server, 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)(SERVER_REC *server);
62 /* send public or private message to server */
63 void (*send_message)(SERVER_REC *server, const char *target,
64                      const char *msg, int target_type);
65
66 /* -- Default implementations are used if NULL -- */
67 CHANNEL_REC *(*channel_find_func)(SERVER_REC *server, const char *name);
68 QUERY_REC *(*query_find_func)(SERVER_REC *server, const char *nick);
69 int (*mask_match_func)(const char *mask, const char *data);
70 /* returns true if `msg' was meant for `nick' */
71 int (*nick_match_msg)(const char *nick, const char *msg);
72
73 #undef STRUCT_SERVER_CONNECT_REC