1 #ifndef __CHAT_PROTOCOLS_H
2 #define __CHAT_PROTOCOLS_H
4 struct _CHAT_PROTOCOL_REC {
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_init_connect) (SERVER_CONNECT_REC *);
21 void (*server_connect) (SERVER_REC *);
22 CHANNEL_REC *(*channel_create) (SERVER_REC *, const char *,
24 QUERY_REC *(*query_create) (const char *, const char *, int);
27 extern GSList *chat_protocols;
29 #define PROTO_CHECK_CAST(object, cast, type_field, id) \
30 ((cast *) chat_protocol_check_cast(object, \
31 offsetof(cast, type_field), id))
32 void *chat_protocol_check_cast(void *object, int type_pos, const char *id);
34 #define CHAT_PROTOCOL(object) \
35 ((object) == NULL ? chat_protocol_get_default() : \
36 chat_protocol_find_id((object)->chat_type))
38 /* Register new chat protocol. */
39 CHAT_PROTOCOL_REC *chat_protocol_register(CHAT_PROTOCOL_REC *rec);
41 /* Unregister chat protocol. */
42 void chat_protocol_unregister(const char *name);
45 int chat_protocol_lookup(const char *name);
46 CHAT_PROTOCOL_REC *chat_protocol_find(const char *name);
47 CHAT_PROTOCOL_REC *chat_protocol_find_id(int id);
48 CHAT_PROTOCOL_REC *chat_protocol_find_net(GHashTable *optlist);
50 /* Default chat protocol to use */
51 void chat_protocol_set_default(CHAT_PROTOCOL_REC *rec);
52 CHAT_PROTOCOL_REC *chat_protocol_get_default(void);
54 /* Return "unknown chat protocol" record. Used when protocol name is
55 specified but it isn't registered yet. */
56 CHAT_PROTOCOL_REC *chat_protocol_get_unknown(const char *name);
58 void chat_protocols_init(void);
59 void chat_protocols_deinit(void);