diff --git a/src/jabber.c b/src/jabber.c index d294ba0a..5ec61665 100644 --- a/src/jabber.c +++ b/src/jabber.c @@ -34,9 +34,6 @@ #include "profanity.h" #include "room_chat.h" -// TODO REMOVE -#include "ui.h" - #define PING_INTERVAL 120000 // 2 minutes static struct _jabber_conn_t { @@ -461,7 +458,8 @@ _message_handler(xmpp_conn_t * const conn, char **tokens = g_strsplit(from, "/", 0); char *room_jid = tokens[0]; char *nick = tokens[1]; - win_show_room_history(room_jid, nick, tv_stamp, message); + prof_handle_room_history(room_jid, nick, tv_stamp, message); + g_strfreev(tokens); } } else { log_error("Couldn't parse datetime string receiving room history: %s", utc_stamp); @@ -473,7 +471,8 @@ _message_handler(xmpp_conn_t * const conn, char **tokens = g_strsplit(from, "/", 0); char *room_jid = tokens[0]; char *nick = tokens[1]; - win_show_room_message(room_jid, nick, message); + prof_handle_room_message(room_jid, nick, message); + g_strfreev(tokens); } } @@ -684,7 +683,7 @@ _presence_handler(xmpp_conn_t * const conn, char *room_jid = tokens[0]; char *nick = tokens[1]; if (strcmp(room_get_nick_for_room(room_jid), nick) != 0) { - win_show_chat_room_member(room_jid, nick); + prof_handle_chat_room_member(room_jid, nick); } } else { char *short_from = strtok(from, "/"); diff --git a/src/profanity.c b/src/profanity.c index 41a89956..0e0c1fcd 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -171,6 +171,27 @@ prof_handle_failed_login(void) log_info("disconnected"); } +void +prof_handle_room_history(const char * const room_jid, const char * const nick, + GTimeVal tv_stamp, const char * const message) +{ + win_show_room_history(room_jid, nick, tv_stamp, message); +} + +void +prof_handle_room_message(const char * const room_jid, const char * const nick, + const char * const message) +{ + win_show_room_message(room_jid, nick, message); +} + +void +prof_handle_chat_room_member(const char * const room_jid, + const char * const nick) +{ + win_show_chat_room_member(room_jid, nick); +} + void prof_handle_contact_online(char *contact, char *show, char *status) { diff --git a/src/profanity.h b/src/profanity.h index dc56b775..e8bd19c0 100644 --- a/src/profanity.h +++ b/src/profanity.h @@ -35,5 +35,12 @@ void prof_handle_incoming_message(char *from, char *message); void prof_handle_error_message(const char *from, const char *err_msg); void prof_handle_roster(GSList *roster); void prof_handle_gone(const char * const from); +void prof_handle_room_history(const char * const room_jid, + const char * const nick, GTimeVal tv_stamp, const char * const message); +void prof_handle_room_message(const char * const room_jid, const char * const nick, + const char * const message); +void +prof_handle_chat_room_member(const char * const room_jid, + const char * const nick); #endif