1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Subscription handler uses wins_new_chat

This commit is contained in:
James Booth 2014-12-11 00:02:51 +00:00
parent 8e46b9e75b
commit 70f7db0d91
2 changed files with 6 additions and 10 deletions

View File

@ -1321,17 +1321,15 @@ _ui_current_error_line(const char * const msg)
} }
static void static void
_ui_print_system_msg_from_recipient(const char * const from, const char *message) _ui_print_system_msg_from_recipient(const char * const barejid, const char *message)
{ {
if (from == NULL || message == NULL) if (barejid == NULL || message == NULL)
return; return;
Jid *jid = jid_create(from); ProfWin *window = wins_get_by_recipient(barejid);
ProfWin *window = wins_get_by_recipient(jid->barejid);
if (window == NULL) { if (window == NULL) {
int num = 0; int num = 0;
window = wins_new(jid->barejid, WIN_CHAT); window = wins_new_chat(barejid);
if (window != NULL) { if (window != NULL) {
num = wins_get_num(window); num = wins_get_num(window);
status_bar_active(num); status_bar_active(num);
@ -1342,9 +1340,7 @@ _ui_print_system_msg_from_recipient(const char * const from, const char *message
} }
} }
win_save_vprint(window, '-', NULL, 0, 0, "", "*%s %s", jid->barejid, message); win_save_vprint(window, '-', NULL, 0, 0, "", "*%s %s", barejid, message);
jid_destroy(jid);
} }
static void static void

View File

@ -88,7 +88,7 @@ void (*ui_smp_answer_failure)(const char * const recipient);
unsigned long (*ui_get_idle_time)(void); unsigned long (*ui_get_idle_time)(void);
void (*ui_reset_idle_time)(void); void (*ui_reset_idle_time)(void);
void (*ui_new_chat_win)(const char * const to); void (*ui_new_chat_win)(const char * const to);
void (*ui_print_system_msg_from_recipient)(const char * const from, const char *message); void (*ui_print_system_msg_from_recipient)(const char * const barejid, const char *message);
gint (*ui_unread)(void); gint (*ui_unread)(void);
void (*ui_close_connected_win)(int index); void (*ui_close_connected_win)(int index);
int (*ui_close_all_wins)(void); int (*ui_close_all_wins)(void);