0
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-07-26 12:14:28 -04:00

Fix for chat logging

This commit is contained in:
James Booth 2015-03-15 23:31:39 +00:00
parent 8944a3b5bb
commit eeabbc9bb3

View File

@ -1224,23 +1224,21 @@ cmd_msg(gchar **args, struct cmd_help_t help)
char *msg = args[1];
jabber_conn_status_t conn_status = jabber_get_connection_status();
win_type_t win_type = ui_current_win_type();
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
return TRUE;
}
win_type_t win_type = ui_current_win_type();
switch (win_type) {
case WIN_MUC: {
if (win_type == WIN_MUC) {
ProfMucWin *mucwin = wins_get_current_muc();
if (muc_roster_contains_nick(mucwin->roomjid, usr)) {
GString *full_jid = g_string_new(mucwin->roomjid);
g_string_append(full_jid, "/");
g_string_append(full_jid, usr);
if (msg) {
if (msg != NULL) {
message_send_private(full_jid->str, msg);
ui_outgoing_private_msg(full_jid->str, msg);
} else {
@ -1254,18 +1252,19 @@ cmd_msg(gchar **args, struct cmd_help_t help)
}
return TRUE;
}
default: {
} else {
// get barejid
char *barejid = roster_barejid_from_name(usr);
if (barejid == NULL) {
barejid = usr;
}
if (msg) {
if (msg != NULL) {
#ifdef HAVE_LIBOTR
if (otr_is_secure(barejid)) {
char *encrypted = otr_encrypt_message(barejid, msg);
if (encrypted) {
if (encrypted != NULL) {
char *id = message_send_chat_encrypted(barejid, encrypted);
otr_free_message(encrypted);
ui_outgoing_chat_msg(barejid, msg, id);
@ -1293,7 +1292,6 @@ cmd_msg(gchar **args, struct cmd_help_t help)
id = message_send_chat(barejid, msg);
}
ui_outgoing_chat_msg(barejid, msg, id);
if (win_type == WIN_CHAT || win_type == WIN_CONSOLE) {
chat_log_msg_out(barejid, msg);
}
@ -1302,7 +1300,6 @@ cmd_msg(gchar **args, struct cmd_help_t help)
#else
char *id = message_send_chat(barejid, msg);
ui_outgoing_chat_msg(barejid, msg, id);
if (win_type == WIN_CHAT || win_type == WIN_CONSOLE) {
chat_log_msg_out(barejid, msg);
}
@ -1319,7 +1316,6 @@ cmd_msg(gchar **args, struct cmd_help_t help)
return TRUE;
}
}
}
}
gboolean