1 #ifndef __CHAT_PROTOCOLS_H
2 #define __CHAT_PROTOCOLS_H
7 unsigned int not_initialized:1;
13 CHATNET_REC *(*create_chatnet) (void);
14 SERVER_SETUP_REC *(*create_server_setup) (void);
15 CHANNEL_SETUP_REC *(*create_channel_setup) (void);
16 SERVER_CONNECT_REC *(*create_server_connect) (void);
18 SERVER_REC *(*server_connect) (SERVER_CONNECT_REC *);
19 CHANNEL_REC *(*channel_create) (SERVER_REC *, const char *, int);
20 QUERY_REC *(*query_create) (const char *, const char *, int);
23 extern GSList *chat_protocols;
25 #define PROTO_CHECK_CAST(object, cast, type_field, id) \
26 ((cast *) chat_protocol_check_cast(object, \
27 offsetof(cast, type_field), id))
28 void *chat_protocol_check_cast(void *object, int type_pos, const char *id);
30 #define CHAT_PROTOCOL(object) \
31 ((object) == NULL ? chat_protocol_get_default() : \
32 chat_protocol_find_id((object)->chat_type))
34 /* Register new chat protocol. */
35 CHAT_PROTOCOL_REC *chat_protocol_register(CHAT_PROTOCOL_REC *rec);
37 /* Unregister chat protocol. */
38 void chat_protocol_unregister(const char *name);
41 int chat_protocol_lookup(const char *name);
42 CHAT_PROTOCOL_REC *chat_protocol_find(const char *name);
43 CHAT_PROTOCOL_REC *chat_protocol_find_id(int id);
44 CHAT_PROTOCOL_REC *chat_protocol_find_net(GHashTable *optlist);
46 /* Default chat protocol to use */
47 void chat_protocol_set_default(CHAT_PROTOCOL_REC *rec);
48 CHAT_PROTOCOL_REC *chat_protocol_get_default(void);
50 /* Return "unknown chat protocol" record. Used when protocol name is
51 specified but it isn't registered yet. */
52 CHAT_PROTOCOL_REC *chat_protocol_get_unknown(const char *name);
54 void chat_protocols_init(void);
55 void chat_protocols_deinit(void);