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 GHashTable *module_data;
31 
32 char *version; /* server version */
33 char *away_reason;
34 char *last_invite; /* channel where you were last invited */
35 unsigned int server_operator:1;
36 unsigned int usermode_away:1;
37 unsigned int banned:1; /* not allowed to connect to this server */
38 unsigned int dns_error:1; /* DNS said the host doesn't exist */
39 
40 GTimeVal lag_sent; /* 0 or time when last lag query was sent to server */
41 time_t lag_last_check; /* last time we checked lag */
42 int lag; /* server lag in milliseconds */
43 
44 GSList *channels;
45 GSList *queries;
46 
47 /* -- support for multiple server types -- */
48 
49 /* -- must not be NULL: -- */
50 /* join to a number of channels, channels are specified in `data' separated
51    with commas. there can exist other information after first space like
52    channel keys etc. */
53 void (*channels_join)(SERVER_REC *server, const char *data, int automatic);
54 /* returns true if `flag' indicates a nick flag (op/voice/halfop) */
55 int (*isnickflag)(SERVER_REC *server, char flag);
56 /* returns true if `data' indicates a channel */
57 int (*ischannel)(SERVER_REC *server, const char *data);
58 /* returns all nick flag characters in order op, voice, halfop. If some
59    of them aren't supported '\0' can be used. */
60 const char *(*get_nick_flags)(SERVER_REC *server);
61 /* send public or private message to server */
62 void (*send_message)(SERVER_REC *server, const char *target,
63 		     const char *msg, int target_type);
64 /* split message in case it is too long for the server to receive */
65 char **(*split_message)(SERVER_REC *server, const char *target,
66 			const char *msg);
67 
68 /* -- Default implementations are used if NULL -- */
69 CHANNEL_REC *(*channel_find_func)(SERVER_REC *server, const char *name);
70 QUERY_REC *(*query_find_func)(SERVER_REC *server, const char *nick);
71 int (*mask_match_func)(const char *mask, const char *data);
72 /* returns true if `msg' was meant for `nick' */
73 int (*nick_match_msg)(const char *nick, const char *msg);
74 
75 #undef STRUCT_SERVER_CONNECT_REC
76