Fix for chat logging
This commit is contained in:
@@ -1224,23 +1224,21 @@ cmd_msg(gchar **args, struct cmd_help_t help)
|
|||||||
char *msg = args[1];
|
char *msg = args[1];
|
||||||
|
|
||||||
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
jabber_conn_status_t conn_status = jabber_get_connection_status();
|
||||||
|
win_type_t win_type = ui_current_win_type();
|
||||||
|
|
||||||
if (conn_status != JABBER_CONNECTED) {
|
if (conn_status != JABBER_CONNECTED) {
|
||||||
cons_show("You are not currently connected.");
|
cons_show("You are not currently connected.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
win_type_t win_type = ui_current_win_type();
|
if (win_type == WIN_MUC) {
|
||||||
|
|
||||||
switch (win_type) {
|
|
||||||
case WIN_MUC: {
|
|
||||||
ProfMucWin *mucwin = wins_get_current_muc();
|
ProfMucWin *mucwin = wins_get_current_muc();
|
||||||
if (muc_roster_contains_nick(mucwin->roomjid, usr)) {
|
if (muc_roster_contains_nick(mucwin->roomjid, usr)) {
|
||||||
GString *full_jid = g_string_new(mucwin->roomjid);
|
GString *full_jid = g_string_new(mucwin->roomjid);
|
||||||
g_string_append(full_jid, "/");
|
g_string_append(full_jid, "/");
|
||||||
g_string_append(full_jid, usr);
|
g_string_append(full_jid, usr);
|
||||||
|
|
||||||
if (msg) {
|
if (msg != NULL) {
|
||||||
message_send_private(full_jid->str, msg);
|
message_send_private(full_jid->str, msg);
|
||||||
ui_outgoing_private_msg(full_jid->str, msg);
|
ui_outgoing_private_msg(full_jid->str, msg);
|
||||||
} else {
|
} else {
|
||||||
@@ -1254,18 +1252,19 @@ cmd_msg(gchar **args, struct cmd_help_t help)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
|
||||||
default: {
|
} else {
|
||||||
|
// get barejid
|
||||||
char *barejid = roster_barejid_from_name(usr);
|
char *barejid = roster_barejid_from_name(usr);
|
||||||
if (barejid == NULL) {
|
if (barejid == NULL) {
|
||||||
barejid = usr;
|
barejid = usr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg) {
|
if (msg != NULL) {
|
||||||
#ifdef HAVE_LIBOTR
|
#ifdef HAVE_LIBOTR
|
||||||
if (otr_is_secure(barejid)) {
|
if (otr_is_secure(barejid)) {
|
||||||
char *encrypted = otr_encrypt_message(barejid, msg);
|
char *encrypted = otr_encrypt_message(barejid, msg);
|
||||||
if (encrypted) {
|
if (encrypted != NULL) {
|
||||||
char *id = message_send_chat_encrypted(barejid, encrypted);
|
char *id = message_send_chat_encrypted(barejid, encrypted);
|
||||||
otr_free_message(encrypted);
|
otr_free_message(encrypted);
|
||||||
ui_outgoing_chat_msg(barejid, msg, id);
|
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);
|
id = message_send_chat(barejid, msg);
|
||||||
}
|
}
|
||||||
ui_outgoing_chat_msg(barejid, msg, id);
|
ui_outgoing_chat_msg(barejid, msg, id);
|
||||||
|
|
||||||
if (win_type == WIN_CHAT || win_type == WIN_CONSOLE) {
|
if (win_type == WIN_CHAT || win_type == WIN_CONSOLE) {
|
||||||
chat_log_msg_out(barejid, msg);
|
chat_log_msg_out(barejid, msg);
|
||||||
}
|
}
|
||||||
@@ -1302,7 +1300,6 @@ cmd_msg(gchar **args, struct cmd_help_t help)
|
|||||||
#else
|
#else
|
||||||
char *id = message_send_chat(barejid, msg);
|
char *id = message_send_chat(barejid, msg);
|
||||||
ui_outgoing_chat_msg(barejid, msg, id);
|
ui_outgoing_chat_msg(barejid, msg, id);
|
||||||
|
|
||||||
if (win_type == WIN_CHAT || win_type == WIN_CONSOLE) {
|
if (win_type == WIN_CHAT || win_type == WIN_CONSOLE) {
|
||||||
chat_log_msg_out(barejid, msg);
|
chat_log_msg_out(barejid, msg);
|
||||||
}
|
}
|
||||||
@@ -1320,7 +1317,6 @@ cmd_msg(gchar **args, struct cmd_help_t help)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
cmd_group(gchar **args, struct cmd_help_t help)
|
cmd_group(gchar **args, struct cmd_help_t help)
|
||||||
|
|||||||
Reference in New Issue
Block a user