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