summaryrefslogtreecommitdiffstats
path: root/ircxmpp.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--ircxmpp.h37
1 files changed, 30 insertions, 7 deletions
diff --git a/ircxmpp.h b/ircxmpp.h
index 89f23a8..3ca5e03 100644
--- a/ircxmpp.h
+++ b/ircxmpp.h
@@ -1,4 +1,12 @@
-#ifdef IX_LIB /* do not use functions until #else in programs that use libircxmpp. */
+enum ircxmpp_loglevel {
+ IRCXMPP_DEBUG,
+ IRCXMPP_INFO,
+ IRCXMPP_WARN,
+ IRCXMPP_ERROR
+};
+typedef void (*ircxmpp_logger)
+ (void * const, const enum ircxmpp_loglevel, const char * const, const char * const);
+#ifdef IX_LIB /* do not use functions until #endif in programs that use libircxmpp. */
#include <libircclient.h> /* do not use members of struct ircxmpp, use opaque ircxmpp type! */
#include <strophe.h>
enum irc_numeric { /* numerics from rfc 1459 */
@@ -143,8 +151,6 @@ enum side {
};
struct bridge { // xmpp connection is the same for every user, only IRC connection differs
struct ircxmpp * ircxmpp;
- struct bridge * next;
- struct bridge * prev;
char * identifier; /* jid if side is XMPP or nickname if side is IRC */
irc_session_t * irc;
xmpp_conn_t * conn; /* isti xmpp_ctx_t ima lahko več connov */
@@ -153,7 +159,7 @@ struct bridge { // xmpp connection is the same for every user, only IRC connecti
char ** messages;
};
struct ircxmpp {
- struct bridge * bridges;
+ void * bridges;
irc_session_t * irc;
char * ircnick;
char * irchost;
@@ -166,10 +172,19 @@ struct ircxmpp {
char * channel;
char * muc;
char * channel_password;
+ void * log_userdata;
+ ircxmpp_logger log_handler;
+ xmpp_log_t xmpp_logger;
};
-static void free_bridge (struct bridge **, const char *);
-static void free_bridges (struct bridge **);
-static struct bridge ** find_bridge (struct bridge **, const char *, enum side);
+static void send_xmpp_logs_to_me (
+ void * const, const xmpp_log_level_t, const char * const, const char * const);
+static void logwrite (struct ircxmpp *, enum ircxmpp_loglevel, const char *, int,
+ const char *, const char *, ...);
+static int bridge_compare (const void *, const void *);
+static void free_bridge (struct bridge *, const char *);
+static void free_bridges (void **);
+static void free_bridge_global_reason (void *);
+static struct bridge * find_bridge (void **, const char *, enum side);
static void jid2ircnick (char *);
static void jid2ircuser (char *);
static void bridge_forward (const char *, const char *, struct ircxmpp *, enum side);
@@ -180,6 +195,8 @@ static void conn_handler (xmpp_conn_t * const, const xmpp_conn_event_t, const in
static void conn_handler_bridge (xmpp_conn_t * const, const xmpp_conn_event_t, const int,
xmpp_stream_error_t * const, void * const);
// IRC
+static void dump_event_control (
+ irc_session_t *, const char *, const char *, const char **, unsigned);
static void dump_event (irc_session_t *, const char *, const char *, const char **, unsigned);
static void event_connect (irc_session_t *, const char *, const char *, const char **, unsigned);
static void event_connect_control (
@@ -201,11 +218,16 @@ static void event_numeric_control (
static int irc_run_once (struct bridge *);
static void init_irc (struct bridge *);
static void init_irc_control (struct ircxmpp *);
+static void obdelaj_bridge (const void *, VISIT, int);
+static void ircxmpp_default_logger (
+ void * const, const enum ircxmpp_loglevel, const char * const, const char * const);
// /IRC
#endif // IX_LIB
// ZUNANJE
typedef struct ircxmpp ircxmpp; /* opaque handle */
ircxmpp * ircxmpp_init (void);
+void ircxmpp_set_log_handler (ircxmpp *, ircxmpp_logger);
+void ircxmpp_set_log_userdata (ircxmpp *, void *);
void ircxmpp_set_jid (ircxmpp *, const char *);
void ircxmpp_set_password (ircxmpp *, const char *);
void ircxmpp_set_hostname (ircxmpp *, const char *);
@@ -215,4 +237,5 @@ void ircxmpp_set_muc (ircxmpp *, const char *);
void ircxmpp_set_channel_password (ircxmpp *, const char *);
void ircxmpp_run_once (struct ircxmpp *);
void ircxmpp_free (struct ircxmpp *);
+int ircxmpp_version = 0;
// /ZUNANJE