updates.
[silc.git] / apps / irssi / src / silc / core / silc-servers.h
1 #ifndef __SILC_SERVER_H
2 #define __SILC_SERVER_H
3
4 #include "chat-protocols.h"
5 #include "servers.h"
6
7 /* returns SILC_SERVER_REC if it's SILC server, NULL if it isn't */
8 #define SILC_SERVER(server) \
9         PROTO_CHECK_CAST(SERVER(server), SILC_SERVER_REC, chat_type, "SILC")
10
11 #define SILC_SERVER_CONNECT(conn) \
12         PROTO_CHECK_CAST(SERVER_CONNECT(conn), SILC_SERVER_CONNECT_REC, \
13                          chat_type, "SILC")
14
15 #define IS_SILC_SERVER(server) \
16         (SILC_SERVER(server) ? TRUE : FALSE)
17
18 #define IS_SILC_SERVER_CONNECT(conn) \
19         (SILC_SERVER_CONNECT(conn) ? TRUE : FALSE)
20
21 /* all strings should be either NULL or dynamically allocated */
22 /* address and nick are mandatory, rest are optional */
23 typedef struct {
24 #include "server-connect-rec.h"
25 } SILC_SERVER_CONNECT_REC;
26
27 #define STRUCT_SERVER_CONNECT_REC SILC_SERVER_CONNECT_REC
28 typedef struct {
29 #include "server-rec.h"
30   /* Command sending queue */
31   int cmdcount;         /* number of commands in `cmdqueue'. Can be more than
32                            there actually is, to make flood control remember
33                            how many messages can be sent before starting the
34                            flood control */
35   int cmd_last_split;   /* Last command wasn't sent entirely to server.
36                            First item in `cmdqueue' should be re-sent. */
37   GSList *cmdqueue;
38   GTimeVal last_cmd;    /* last time command was sent to server */
39   
40   GSList *idles;        /* Idle queue - send these commands to server
41                            if there's nothing else to do */
42   
43   gpointer chanqueries;
44   SilcClientConnection conn;
45 } SILC_SERVER_REC;
46
47 SILC_SERVER_REC *silc_server_connect(SILC_SERVER_CONNECT_REC *conn);
48
49 /* Return a string of all channels in server in server->channels_join() 
50    format */
51 char *silc_server_get_channels(SILC_SERVER_REC *server);
52 void silc_command_exec(SILC_SERVER_REC *server,
53                        const char *command, const char *args);
54 void silc_server_init(void);
55 void silc_server_deinit(void);
56
57 #endif