diff --git a/src/command.c b/src/command.c index 52b909f5..2f94b575 100644 --- a/src/command.c +++ b/src/command.c @@ -913,7 +913,9 @@ cmd_execute_default(const char * const inp) if (win_current_is_chat() && prefs_get_chlog()) { const char *jid = jabber_get_jid(); - chat_log_chat(jid, recipient, inp, PROF_OUT_LOG, NULL); + Jid *jidp = jid_create(jid); + chat_log_chat(jidp->barejid, recipient, inp, PROF_OUT_LOG, NULL); + jid_destroy(jidp); } win_show_outgoing_msg("me", recipient, inp); @@ -1690,7 +1692,9 @@ _cmd_msg(gchar **args, struct cmd_help_t help) if (win_current_is_chat() && prefs_get_chlog()) { const char *jid = jabber_get_jid(); - chat_log_chat(jid, usr, msg, PROF_OUT_LOG, NULL); + Jid *jidp = jid_create(jid); + chat_log_chat(jidp->barejid, usr, msg, PROF_OUT_LOG, NULL); + jid_destroy(jidp); } return TRUE; @@ -1886,7 +1890,9 @@ _cmd_tiny(gchar **args, struct cmd_help_t help) if (prefs_get_chlog()) { const char *jid = jabber_get_jid(); - chat_log_chat(jid, recipient, tiny, PROF_OUT_LOG, NULL); + Jid *jidp = jid_create(jid); + chat_log_chat(jidp->barejid, recipient, tiny, PROF_OUT_LOG, NULL); + jid_destroy(jidp); } win_show_outgoing_msg("me", recipient, tiny); diff --git a/src/profanity.c b/src/profanity.c index 2e2aa456..f46ffca5 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -120,13 +120,13 @@ prof_handle_incoming_message(char *from, char *message, gboolean priv) ui_show_incoming_msg(from, message, NULL, priv); win_current_page_off(); - if (win_current_is_chat() && prefs_get_chlog()) { - char from_cpy[strlen(from) + 1]; - strcpy(from_cpy, from); - char *short_from = strtok(from_cpy, "/"); + if (prefs_get_chlog() && !priv) { + Jid *from_jid = jid_create(from); const char *jid = jabber_get_jid(); - - chat_log_chat(jid, short_from, message, PROF_IN_LOG, NULL); + Jid *jidp = jid_create(jid); + chat_log_chat(jidp->barejid, from_jid->barejid, message, PROF_IN_LOG, NULL); + jid_destroy(jidp); + jid_destroy(from_jid); } } @@ -137,13 +137,13 @@ prof_handle_delayed_message(char *from, char *message, GTimeVal tv_stamp, ui_show_incoming_msg(from, message, &tv_stamp, priv); win_current_page_off(); - if (win_current_is_chat() && prefs_get_chlog()) { - char from_cpy[strlen(from) + 1]; - strcpy(from_cpy, from); - char *short_from = strtok(from_cpy, "/"); + if (prefs_get_chlog() && !priv) { + Jid *from_jid = jid_create(from); const char *jid = jabber_get_jid(); - - chat_log_chat(jid, short_from, message, PROF_IN_LOG, &tv_stamp); + Jid *jidp = jid_create(jid); + chat_log_chat(jidp->barejid, from_jid->barejid, message, PROF_IN_LOG, &tv_stamp); + jid_destroy(jidp); + jid_destroy(from_jid); } } diff --git a/src/ui_windows.c b/src/ui_windows.c index cb92bfaf..e6b343d3 100644 --- a/src/ui_windows.c +++ b/src/ui_windows.c @@ -2327,7 +2327,9 @@ _win_show_history(WINDOW *win, int win_index, const char * const contact) { if (!windows[win_index]->history_shown) { GSList *history = NULL; - history = chat_log_get_previous(jabber_get_jid(), contact, history); + Jid *jid = jid_create(jabber_get_jid()); + history = chat_log_get_previous(jid->barejid, contact, history); + jid_destroy(jid); while (history != NULL) { wprintw(win, "%s\n", history->data); history = g_slist_next(history);