diff options
author | Timo Sirainen <cras@irssi.org> | 2000-08-26 15:39:44 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-08-26 15:39:44 +0000 |
commit | e395e87dedd9aa85f05e5c74330a76f1ef700371 (patch) | |
tree | 1184487b13038499f1771e4c553222f85b8524d2 /src/core/servers.h | |
parent | 3d124da13b8da5c0b535abfe6265fc471d9d2ebd (diff) | |
download | irssi-e395e87dedd9aa85f05e5c74330a76f1ef700371.zip |
Lots of moving stuff around - hopefully I didn't break too much :)
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@632 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/servers.h')
-rw-r--r-- | src/core/servers.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/core/servers.h b/src/core/servers.h new file mode 100644 index 00000000..169c8e88 --- /dev/null +++ b/src/core/servers.h @@ -0,0 +1,52 @@ +#ifndef __SERVERS_H +#define __SERVERS_H + +#include "modules.h" + +#ifndef __NETWORK_H +typedef struct _ipaddr IPADDR; +#endif + +#define IS_SERVER(server) \ + ((server) != NULL && module_find_id("SERVER", (server)->type) != -1) + +#define IS_SERVER_CONNECT(conn) \ + ((conn) != NULL && \ + module_find_id("SERVER CONNECT", (conn)->type) != -1) + +/* Returns SERVER_REC if it's server, NULL if it isn't. */ +#define SERVER(server) \ + (IS_SERVER(server) ? (SERVER_REC *) (server) : NULL) + +/* Returns SERVER_CONNECT_REC if it's server connection, NULL if it isn't. */ +#define SERVER_CONNECT(conn) \ + (IS_SERVER_CONNECT(conn) ? (SERVER_CONNECT_REC *) (conn) : NULL) + +/* all strings should be either NULL or dynamically allocated */ +/* address and nick are mandatory, rest are optional */ +typedef struct { +#include "server-connect-rec.h" +} SERVER_CONNECT_REC; + +#define STRUCT_SERVER_CONNECT_REC SERVER_CONNECT_REC +typedef struct { +#include "server-rec.h" +} SERVER_REC; + +extern GSList *servers, *lookup_servers; + +void servers_init(void); +void servers_deinit(void); + +/* Connect to server */ +SERVER_REC *server_connect(SERVER_CONNECT_REC *conn); +/* Disconnect from server */ +void server_disconnect(SERVER_REC *server); + +SERVER_REC *server_find_tag(const char *tag); +SERVER_REC *server_find_chatnet(const char *chatnet); + +int server_start_connect(SERVER_REC *server); +void server_connect_free(SERVER_CONNECT_REC *conn); + +#endif |