2000-08-31 20:26:46 -04:00
|
|
|
#ifndef __CHAT_PROTOCOLS_H
|
|
|
|
#define __CHAT_PROTOCOLS_H
|
|
|
|
|
2002-05-10 18:41:22 -04:00
|
|
|
struct _CHAT_PROTOCOL_REC {
|
2000-10-01 16:48:10 -04:00
|
|
|
int id;
|
|
|
|
|
2001-02-18 21:50:08 -05:00
|
|
|
unsigned int not_initialized:1;
|
2001-09-11 13:47:31 -04:00
|
|
|
unsigned int case_insensitive:1;
|
2001-02-18 21:50:08 -05:00
|
|
|
|
2000-09-30 18:49:48 -04:00
|
|
|
char *name;
|
|
|
|
char *fullname;
|
|
|
|
char *chatnet;
|
2001-02-17 14:44:22 -05:00
|
|
|
|
|
|
|
CHATNET_REC *(*create_chatnet) (void);
|
|
|
|
SERVER_SETUP_REC *(*create_server_setup) (void);
|
|
|
|
CHANNEL_SETUP_REC *(*create_channel_setup) (void);
|
|
|
|
SERVER_CONNECT_REC *(*create_server_connect) (void);
|
2001-10-21 09:59:07 -04:00
|
|
|
void (*destroy_server_connect) (SERVER_CONNECT_REC *);
|
2001-02-17 14:44:22 -05:00
|
|
|
|
2002-05-20 00:12:12 -04:00
|
|
|
SERVER_REC *(*server_init_connect) (SERVER_CONNECT_REC *);
|
|
|
|
void (*server_connect) (SERVER_REC *);
|
2002-05-15 20:34:37 -04:00
|
|
|
CHANNEL_REC *(*channel_create) (SERVER_REC *, const char *,
|
|
|
|
const char *, int);
|
2001-02-17 14:44:22 -05:00
|
|
|
QUERY_REC *(*query_create) (const char *, const char *, int);
|
2002-05-10 18:41:22 -04:00
|
|
|
};
|
2000-09-30 18:49:48 -04:00
|
|
|
|
2000-10-01 16:48:10 -04:00
|
|
|
extern GSList *chat_protocols;
|
|
|
|
|
2000-08-31 20:26:46 -04:00
|
|
|
#define PROTO_CHECK_CAST(object, cast, type_field, id) \
|
|
|
|
((cast *) chat_protocol_check_cast(object, \
|
|
|
|
offsetof(cast, type_field), id))
|
|
|
|
void *chat_protocol_check_cast(void *object, int type_pos, const char *id);
|
|
|
|
|
2001-02-17 14:44:22 -05:00
|
|
|
#define CHAT_PROTOCOL(object) \
|
|
|
|
((object) == NULL ? chat_protocol_get_default() : \
|
|
|
|
chat_protocol_find_id((object)->chat_type))
|
|
|
|
|
2000-08-31 20:26:46 -04:00
|
|
|
/* Register new chat protocol. */
|
2001-02-17 14:44:22 -05:00
|
|
|
CHAT_PROTOCOL_REC *chat_protocol_register(CHAT_PROTOCOL_REC *rec);
|
2000-08-31 20:26:46 -04:00
|
|
|
|
|
|
|
/* Unregister chat protocol. */
|
|
|
|
void chat_protocol_unregister(const char *name);
|
|
|
|
|
2000-10-01 16:48:10 -04:00
|
|
|
/* Find functions */
|
2000-08-31 20:26:46 -04:00
|
|
|
int chat_protocol_lookup(const char *name);
|
2000-10-01 16:48:10 -04:00
|
|
|
CHAT_PROTOCOL_REC *chat_protocol_find(const char *name);
|
|
|
|
CHAT_PROTOCOL_REC *chat_protocol_find_id(int id);
|
2001-02-17 14:44:22 -05:00
|
|
|
CHAT_PROTOCOL_REC *chat_protocol_find_net(GHashTable *optlist);
|
|
|
|
|
|
|
|
/* Default chat protocol to use */
|
|
|
|
void chat_protocol_set_default(CHAT_PROTOCOL_REC *rec);
|
|
|
|
CHAT_PROTOCOL_REC *chat_protocol_get_default(void);
|
|
|
|
|
|
|
|
/* Return "unknown chat protocol" record. Used when protocol name is
|
|
|
|
specified but it isn't registered yet. */
|
|
|
|
CHAT_PROTOCOL_REC *chat_protocol_get_unknown(const char *name);
|
2000-08-31 20:26:46 -04:00
|
|
|
|
|
|
|
void chat_protocols_init(void);
|
|
|
|
void chat_protocols_deinit(void);
|
|
|
|
|
|
|
|
#endif
|