00001 #ifndef ENGINE_XMPP_H__
00002 #define ENGINE_XMPP_H__
00003
00004 #include <iksemel.h>
00005 #include <openssl/BIO.h>
00006
00010 typedef struct {
00011
00012 iksparser* parser;
00013 iksid* account;
00014
00015 int features;
00016 int authorized;
00017 iks *roster;
00018
00019
00020 char* jid;
00021 char* server;
00022
00023
00024 char* password;
00025 int set_roster;
00026 } engine_xmpp_session_t;
00027
00034 typedef void (*engine_xmpp_msg_handler_t)(void* engine_xmpp, char* from, char* message);
00035
00040 typedef struct {
00041 iksfilter* filter;
00042 engine_xmpp_msg_handler_t msg_handler;
00043 engine_xmpp_session_t* session;
00044 BIO* logger;
00045 void* engine;
00046 } engine_xmpp_t;
00047
00048
00050 #define ENGINE_XMPP_SESSION(engine_xmpp) (engine_xmpp->session)
00051
00056 engine_xmpp_t* engine_xmpp_new();
00057
00062 void engine_xmpp_connect(engine_xmpp_t* engine_xmpp);
00063
00069 void engine_xmpp_set_server(engine_xmpp_t* engine_xmpp, char* server);
00070
00078 void engine_xmpp_set_account(engine_xmpp_t* engine_xmpp, char* jid, char* password, int set_roster);
00079
00084 void engine_xmpp_disconnect(engine_xmpp_t* engine_xmpp);
00085
00091 int engine_xmpp_process(engine_xmpp_t* engine_xmpp);
00092
00098 void engine_xmpp_set_logger(engine_xmpp_t* engine_xmpp, BIO* logger);
00099
00105 void engine_xmpp_add_msg_handler(engine_xmpp_t* engine_xmpp, engine_xmpp_msg_handler_t callback);
00106
00113 void engine_xmpp_send_msg(engine_xmpp_t* engine_xmpp, char* to, char* message);
00114
00115 #endif // ENGINE_XMPP_H_