mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Added simple stanza logging to main console
This commit is contained in:
parent
40759eddbf
commit
bf185d9907
@ -505,3 +505,9 @@ handle_bookmark_autojoin(char *jid)
|
||||
ui_room_join(jid, FALSE);
|
||||
muc_remove_invite(jid);
|
||||
}
|
||||
|
||||
void
|
||||
handle_xmpp_stanza(const char * const msg)
|
||||
{
|
||||
ui_handle_stanza(msg);
|
||||
}
|
||||
|
@ -79,5 +79,6 @@ void handle_message_error(const char * const from, const char * const type,
|
||||
void handle_presence_error(const char *from, const char * const type,
|
||||
const char *err_msg);
|
||||
void handle_bookmark_autojoin(char *jid);
|
||||
void handle_xmpp_stanza(const char * const msg);
|
||||
|
||||
#endif
|
||||
|
@ -219,6 +219,21 @@ _ui_duck_exists(void)
|
||||
return wins_duck_exists();
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_handle_stanza(const char * const msg)
|
||||
{
|
||||
ProfWin *console = wins_get_console();
|
||||
if (g_str_has_prefix(msg, "SENT:")) {
|
||||
win_vprint_line(console, '!', COLOUR_ONLINE, "<- %s", &msg[6]);
|
||||
} else if (g_str_has_prefix(msg, "RECV:")) {
|
||||
win_vprint_line(console, '!', COLOUR_AWAY, "-> %s", &msg[6]);
|
||||
}
|
||||
win_update_virtual(console);
|
||||
if (wins_is_current(console)) {
|
||||
ui_current_page_off();
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_contact_typing(const char * const barejid)
|
||||
{
|
||||
@ -1923,4 +1938,5 @@ ui_init_module(void)
|
||||
ui_input_nonblocking = _ui_input_nonblocking;
|
||||
ui_replace_input = _ui_replace_input;
|
||||
ui_invalid_command_usage = _ui_invalid_command_usage;
|
||||
ui_handle_stanza = _ui_handle_stanza;
|
||||
}
|
||||
|
@ -92,6 +92,8 @@ gboolean (*ui_win_exists)(int index);
|
||||
int (*ui_win_unread)(int index);
|
||||
char * (*ui_ask_password)(void);
|
||||
|
||||
void (*ui_handle_stanza)(const char * const msg);
|
||||
|
||||
// ui events
|
||||
void (*ui_contact_typing)(const char * const from);
|
||||
void (*ui_incoming_msg)(const char * const from, const char * const message,
|
||||
|
@ -527,6 +527,9 @@ _xmpp_file_logger(void * const userdata, const xmpp_log_level_t level,
|
||||
{
|
||||
log_level_t prof_level = _get_log_level(level);
|
||||
log_msg(prof_level, area, msg);
|
||||
if ((g_strcmp0(area, "xmpp") == 0) || (g_strcmp0(area, "conn")) == 0) {
|
||||
handle_xmpp_stanza(msg);
|
||||
}
|
||||
}
|
||||
|
||||
static xmpp_log_t *
|
||||
|
Loading…
Reference in New Issue
Block a user