aboutsummaryrefslogtreecommitdiffstats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-03-16 01:48:12 +0000
committerJames Booth <boothj5@gmail.com>2015-03-16 01:48:12 +0000
commitec57c72fb4ecf7266f16bcb53e260e0c83685c32 (patch)
tree3a236f5fa420ceb57b2292a76adb1049a36de8c4 /src/command
parentd50754aac69cccf653d8c5599d5ae1d1938944b9 (diff)
downloadprofani-tty-ec57c72fb4ecf7266f16bcb53e260e0c83685c32.tar.gz
Use static functions in cmd_msg
Diffstat (limited to 'src/command')
-rw-r--r--src/command/commands.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 07c869b8..1ecaeb6a 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -1370,20 +1370,9 @@ cmd_msg(gchar **args, struct cmd_help_t help)
if (msg != NULL) {
#ifdef HAVE_LIBOTR
if (otr_is_secure(barejid)) {
- char *encrypted = otr_encrypt_message(barejid, msg);
- if (encrypted != NULL) {
- char *id = message_send_chat_encrypted(barejid, encrypted);
- otr_free_message(encrypted);
- ui_outgoing_chat_msg(barejid, msg, id);
- chat_log_otr_msg_out(barejid, msg);
- free(id);
- } else {
- cons_show_error("Failed to encrypt and send message,");
- }
+ _send_otr_chat_message(barejid, msg);
} else {
prof_otrpolicy_t policy = otr_get_policy(barejid);
- char *id = NULL;
-
if (policy == PROF_OTRPOLICY_ALWAYS) {
cons_show_error("Failed to send message. Please check OTR policy");
return TRUE;
@@ -1391,22 +1380,20 @@ cmd_msg(gchar **args, struct cmd_help_t help)
GString *otr_message = g_string_new(msg);
g_string_append(otr_message, OTRL_MESSAGE_TAG_BASE);
g_string_append(otr_message, OTRL_MESSAGE_TAG_V2);
- id = message_send_chat_encrypted(barejid, otr_message->str);
+
+ char *id = message_send_chat_encrypted(barejid, otr_message->str);
+ ui_outgoing_chat_msg(barejid, msg, id);
+ chat_log_msg_out(barejid, msg);
+ free(id);
g_string_free(otr_message, TRUE);
} else {
- id = message_send_chat(barejid, msg);
+ _send_chat_message(barejid, msg);
}
- ui_outgoing_chat_msg(barejid, msg, id);
- chat_log_msg_out(barejid, msg);
- free(id);
}
return TRUE;
#else
- char *id = message_send_chat(barejid, msg);
- ui_outgoing_chat_msg(barejid, msg, id);
- chat_log_msg_out(barejid, msg);
- free(id);
+ _send_chat_message(barejid, msg);
return TRUE;
#endif