Use resource in chat sessions

This commit is contained in:
James Booth
2015-01-04 20:19:42 +00:00
parent 4898ed10a4
commit 42a5c431c7
11 changed files with 209 additions and 87 deletions

View File

@@ -1814,8 +1814,15 @@ cmd_execute_default(const char * inp)
if (otr_is_secure(chatwin->barejid)) {
char *encrypted = otr_encrypt_message(chatwin->barejid, inp);
if (encrypted != NULL) {
gboolean send_state = chat_session_on_message_send(chatwin->barejid);
message_send_chat(chatwin->barejid, chatwin->resource, encrypted, send_state);
char *resource = NULL;
gboolean send_state = FALSE;
if (chat_session_exists(chatwin->barejid)) {
resource = chat_session_get_resource(chatwin->barejid);
send_state = chat_session_on_message_send(chatwin->barejid);
} else {
send_state = TRUE;
}
message_send_chat(chatwin->barejid, resource, encrypted, send_state);
otr_free_message(encrypted);
if (prefs_get_boolean(PREF_CHLOG)) {
const char *jid = jabber_get_fulljid();
@@ -1835,8 +1842,15 @@ cmd_execute_default(const char * inp)
cons_show_error("Failed to send message.");
}
} else {
gboolean send_state = chat_session_on_message_send(chatwin->barejid);
message_send_chat(chatwin->barejid, chatwin->resource, inp, send_state);
char *resource = NULL;
gboolean send_state = FALSE;
if (chat_session_exists(chatwin->barejid)) {
resource = chat_session_get_resource(chatwin->barejid);
send_state = chat_session_on_message_send(chatwin->barejid);
} else {
send_state = TRUE;
}
message_send_chat(chatwin->barejid, resource, inp, send_state);
if (prefs_get_boolean(PREF_CHLOG)) {
const char *jid = jabber_get_fulljid();
Jid *jidp = jid_create(jid);
@@ -1847,8 +1861,15 @@ cmd_execute_default(const char * inp)
ui_outgoing_chat_msg("me", chatwin->barejid, inp);
}
#else
gboolean send_state = chat_session_on_message_send(chatwin->barejid);
message_send_chat(chatwin->barejid, chatwin->resource, inp, send_state);
char *resource = NULL;
gboolean send_state = FALSE;
if (chat_session_exists(chatwin->barejid)) {
resource = chat_session_get_resource(chatwin->barejid);
send_state = chat_session_on_message_send(chatwin->barejid);
} else {
send_state = TRUE;
}
message_send_chat(chatwin->barejid, resource, inp, send_state);
if (prefs_get_boolean(PREF_CHLOG)) {
const char *jid = jabber_get_fulljid();
Jid *jidp = jid_create(jid);