mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Moved chat states out of xmpp module for message send chat
This commit is contained in:
parent
676ed1cbae
commit
e602c2909e
@ -1793,12 +1793,7 @@ cmd_execute_default(const char * inp)
|
||||
} else {
|
||||
ProfWin *current = wins_get_current();
|
||||
ProfChatWin *chatwin = (ProfChatWin*)current;
|
||||
GString *send_recipient = g_string_new(chatwin->barejid);
|
||||
if (current && chatwin->resource) {
|
||||
g_string_append(send_recipient, "/");
|
||||
g_string_append(send_recipient, chatwin->resource);
|
||||
}
|
||||
|
||||
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||
#ifdef HAVE_LIBOTR
|
||||
prof_otrpolicy_t policy = otr_get_policy(chatwin->barejid);
|
||||
if (policy == PROF_OTRPOLICY_ALWAYS && !otr_is_secure(chatwin->barejid)) {
|
||||
@ -1808,7 +1803,18 @@ cmd_execute_default(const char * inp)
|
||||
if (otr_is_secure(chatwin->barejid)) {
|
||||
char *encrypted = otr_encrypt_message(chatwin->barejid, inp);
|
||||
if (encrypted != NULL) {
|
||||
message_send_chat(chatwin->barejid, encrypted);
|
||||
gboolean send_state = FALSE;
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
if (!chat_session_exists(chatwin->barejid)) {
|
||||
chat_session_start(chatwin->barejid, TRUE);
|
||||
}
|
||||
if (chat_session_get_recipient_supports(chatwin->barejid)) {
|
||||
chat_session_set_active(chatwin->barejid);
|
||||
send_state = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
message_send_chat(chatwin->barejid, chatwin->barejid, encrypted, send_state);
|
||||
otr_free_message(encrypted);
|
||||
if (prefs_get_boolean(PREF_CHLOG)) {
|
||||
const char *jid = jabber_get_fulljid();
|
||||
@ -1828,7 +1834,17 @@ cmd_execute_default(const char * inp)
|
||||
cons_show_error("Failed to send message.");
|
||||
}
|
||||
} else {
|
||||
message_send_chat(send_recipient->str, inp);
|
||||
gboolean send_state = FALSE;
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
if (!chat_session_exists(chatwin->barejid)) {
|
||||
chat_session_start(chatwin->barejid, TRUE);
|
||||
}
|
||||
if (chat_session_get_recipient_supports(chatwin->barejid)) {
|
||||
chat_session_set_active(chatwin->barejid);
|
||||
send_state = TRUE;
|
||||
}
|
||||
}
|
||||
message_send_chat(chatwin->barejid, chatwin->resource, inp, send_state);
|
||||
if (prefs_get_boolean(PREF_CHLOG)) {
|
||||
const char *jid = jabber_get_fulljid();
|
||||
Jid *jidp = jid_create(jid);
|
||||
@ -1839,7 +1855,17 @@ cmd_execute_default(const char * inp)
|
||||
ui_outgoing_chat_msg("me", chatwin->barejid, inp);
|
||||
}
|
||||
#else
|
||||
message_send_chat(send_recipient->str, inp);
|
||||
gboolean send_state = FALSE;
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
if (!chat_session_exists(chatwin->barejid)) {
|
||||
chat_session_start(chatwin->barejid, TRUE);
|
||||
}
|
||||
if (chat_session_get_recipient_supports(chatwin->barejid)) {
|
||||
chat_session_set_active(chatwin->barejid);
|
||||
send_state = TRUE;
|
||||
}
|
||||
}
|
||||
message_send_chat(chatwin->barejid, chatwin->resource, inp, send_state);
|
||||
if (prefs_get_boolean(PREF_CHLOG)) {
|
||||
const char *jid = jabber_get_fulljid();
|
||||
Jid *jidp = jid_create(jid);
|
||||
@ -1849,7 +1875,6 @@ cmd_execute_default(const char * inp)
|
||||
|
||||
ui_outgoing_chat_msg("me", chatwin->barejid, inp);
|
||||
#endif
|
||||
g_string_free(send_recipient, TRUE);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1146,40 +1146,50 @@ cmd_msg(gchar **args, struct cmd_help_t help)
|
||||
return TRUE;
|
||||
|
||||
} else {
|
||||
char *usr_jid = roster_barejid_from_name(usr);
|
||||
if (usr_jid == NULL) {
|
||||
usr_jid = usr;
|
||||
// get barejid
|
||||
char *barejid = roster_barejid_from_name(usr);
|
||||
if (barejid == NULL) {
|
||||
barejid = usr;
|
||||
}
|
||||
GString *send_jid = g_string_new(usr_jid);
|
||||
ProfWin *current = wins_get_current();
|
||||
|
||||
// if msg to current recipient, attach resource if set
|
||||
// if msg to current recipient, and resource specified, set resource
|
||||
char *resource = NULL;
|
||||
ProfWin *current = wins_get_current();
|
||||
if (current->type == WIN_CHAT) {
|
||||
ProfChatWin *chatwin = (ProfChatWin*)current;
|
||||
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||
if ((g_strcmp0(chatwin->barejid, usr_jid) == 0) && (chatwin->resource)) {
|
||||
g_string_append(send_jid, "/");
|
||||
g_string_append(send_jid, chatwin->resource);
|
||||
if ((g_strcmp0(chatwin->barejid, barejid) == 0) && (chatwin->resource)) {
|
||||
resource = chatwin->resource;
|
||||
}
|
||||
}
|
||||
|
||||
if (msg != NULL) {
|
||||
#ifdef HAVE_LIBOTR
|
||||
if (otr_is_secure(usr_jid)) {
|
||||
char *encrypted = otr_encrypt_message(usr_jid, msg);
|
||||
if (otr_is_secure(barejid)) {
|
||||
char *encrypted = otr_encrypt_message(barejid, msg);
|
||||
if (encrypted != NULL) {
|
||||
message_send_chat(usr_jid, encrypted);
|
||||
gboolean send_state = FALSE;
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
if (!chat_session_exists(barejid)) {
|
||||
chat_session_start(barejid, TRUE);
|
||||
}
|
||||
if (chat_session_get_recipient_supports(barejid)) {
|
||||
chat_session_set_active(barejid);
|
||||
send_state = TRUE;
|
||||
}
|
||||
}
|
||||
message_send_chat(barejid, resource, encrypted, send_state);
|
||||
otr_free_message(encrypted);
|
||||
ui_outgoing_chat_msg("me", usr_jid, msg);
|
||||
ui_outgoing_chat_msg("me", barejid, msg);
|
||||
|
||||
if (((win_type == WIN_CHAT) || (win_type == WIN_CONSOLE)) && prefs_get_boolean(PREF_CHLOG)) {
|
||||
const char *jid = jabber_get_fulljid();
|
||||
Jid *jidp = jid_create(jid);
|
||||
char *pref_otr_log = prefs_get_string(PREF_OTR_LOG);
|
||||
if (strcmp(pref_otr_log, "on") == 0) {
|
||||
chat_log_chat(jidp->barejid, usr_jid, msg, PROF_OUT_LOG, NULL);
|
||||
chat_log_chat(jidp->barejid, barejid, msg, PROF_OUT_LOG, NULL);
|
||||
} else if (strcmp(pref_otr_log, "redact") == 0) {
|
||||
chat_log_chat(jidp->barejid, usr_jid, "[redacted]", PROF_OUT_LOG, NULL);
|
||||
chat_log_chat(jidp->barejid, barejid, "[redacted]", PROF_OUT_LOG, NULL);
|
||||
}
|
||||
prefs_free_string(pref_otr_log);
|
||||
jid_destroy(jidp);
|
||||
@ -1188,7 +1198,7 @@ cmd_msg(gchar **args, struct cmd_help_t help)
|
||||
cons_show_error("Failed to encrypt and send message,");
|
||||
}
|
||||
} else {
|
||||
prof_otrpolicy_t policy = otr_get_policy(usr_jid);
|
||||
prof_otrpolicy_t policy = otr_get_policy(barejid);
|
||||
|
||||
if (policy == PROF_OTRPOLICY_ALWAYS) {
|
||||
cons_show_error("Failed to send message. Please check OTR policy");
|
||||
@ -1197,59 +1207,81 @@ 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);
|
||||
message_send_chat(usr_jid, otr_message->str);
|
||||
|
||||
gboolean send_state = FALSE;
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
if (!chat_session_exists(barejid)) {
|
||||
chat_session_start(barejid, TRUE);
|
||||
}
|
||||
if (chat_session_get_recipient_supports(barejid)) {
|
||||
chat_session_set_active(barejid);
|
||||
send_state = TRUE;
|
||||
}
|
||||
}
|
||||
message_send_chat(barejid, resource, otr_message->str, send_state);
|
||||
|
||||
g_string_free(otr_message, TRUE);
|
||||
} else {
|
||||
message_send_chat(send_jid->str, msg);
|
||||
gboolean send_state = FALSE;
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
if (!chat_session_exists(barejid)) {
|
||||
chat_session_start(barejid, TRUE);
|
||||
}
|
||||
if (chat_session_get_recipient_supports(barejid)) {
|
||||
chat_session_set_active(barejid);
|
||||
send_state = TRUE;
|
||||
}
|
||||
}
|
||||
message_send_chat(barejid, resource, msg, send_state);
|
||||
}
|
||||
ui_outgoing_chat_msg("me", usr_jid, msg);
|
||||
ui_outgoing_chat_msg("me", barejid, msg);
|
||||
|
||||
if (((win_type == WIN_CHAT) || (win_type == WIN_CONSOLE)) && prefs_get_boolean(PREF_CHLOG)) {
|
||||
const char *jid = jabber_get_fulljid();
|
||||
Jid *jidp = jid_create(jid);
|
||||
chat_log_chat(jidp->barejid, usr_jid, msg, PROF_OUT_LOG, NULL);
|
||||
chat_log_chat(jidp->barejid, barejid, msg, PROF_OUT_LOG, NULL);
|
||||
jid_destroy(jidp);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
#else
|
||||
message_send_chat(send_jid->str, msg);
|
||||
ui_outgoing_chat_msg("me", usr_jid, msg);
|
||||
gboolean send_state = FALSE;
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
if (!chat_session_exists(barejid)) {
|
||||
chat_session_start(barejid, TRUE);
|
||||
}
|
||||
if (chat_session_get_recipient_supports(barejid)) {
|
||||
chat_session_set_active(barejid);
|
||||
send_state = TRUE;
|
||||
}
|
||||
}
|
||||
message_send_chat(barejid, resource, msg, send_state);
|
||||
ui_outgoing_chat_msg("me", barejid, msg);
|
||||
|
||||
if (((win_type == WIN_CHAT) || (win_type == WIN_CONSOLE)) && prefs_get_boolean(PREF_CHLOG)) {
|
||||
const char *jid = jabber_get_fulljid();
|
||||
Jid *jidp = jid_create(jid);
|
||||
chat_log_chat(jidp->barejid, usr_jid, msg, PROF_OUT_LOG, NULL);
|
||||
chat_log_chat(jidp->barejid, barejid, msg, PROF_OUT_LOG, NULL);
|
||||
jid_destroy(jidp);
|
||||
}
|
||||
return TRUE;
|
||||
#endif
|
||||
|
||||
} else { // msg == NULL
|
||||
const char * jid = NULL;
|
||||
|
||||
if (roster_barejid_from_name(usr_jid) != NULL) {
|
||||
jid = roster_barejid_from_name(usr_jid);
|
||||
} else {
|
||||
jid = usr_jid;
|
||||
}
|
||||
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
if (!chat_session_exists(jid)) {
|
||||
chat_session_start(jid, TRUE);
|
||||
if (!chat_session_exists(barejid)) {
|
||||
chat_session_start(barejid, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
ui_new_chat_win(usr_jid);
|
||||
ui_new_chat_win(barejid);
|
||||
#ifdef HAVE_LIBOTR
|
||||
if (otr_is_secure(jid)) {
|
||||
ui_gone_secure(jid, otr_is_trusted(jid));
|
||||
if (otr_is_secure(barejid)) {
|
||||
ui_gone_secure(barejid, otr_is_trusted(barejid));
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
g_string_free(send_jid, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2965,17 +2997,21 @@ cmd_tiny(gchar **args, struct cmd_help_t help)
|
||||
if (tiny != NULL) {
|
||||
if (win_type == WIN_CHAT) {
|
||||
ProfChatWin *chatwin = wins_get_current_chat();
|
||||
GString *send_recipient = g_string_new(chatwin->barejid);
|
||||
if (chatwin->resource) {
|
||||
g_string_append(send_recipient, "/");
|
||||
g_string_append(send_recipient, chatwin->resource);
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBOTR
|
||||
if (otr_is_secure(chatwin->barejid)) {
|
||||
char *encrypted = otr_encrypt_message(chatwin->barejid, tiny);
|
||||
if (encrypted != NULL) {
|
||||
message_send_chat(chatwin->barejid, encrypted);
|
||||
gboolean send_state = FALSE;
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
if (!chat_session_exists(chatwin->barejid)) {
|
||||
chat_session_start(chatwin->barejid, TRUE);
|
||||
}
|
||||
if (chat_session_get_recipient_supports(chatwin->barejid)) {
|
||||
chat_session_set_active(chatwin->barejid);
|
||||
send_state = TRUE;
|
||||
}
|
||||
}
|
||||
message_send_chat(chatwin->barejid, chatwin->resource, encrypted, send_state);
|
||||
otr_free_message(encrypted);
|
||||
if (prefs_get_boolean(PREF_CHLOG)) {
|
||||
const char *jid = jabber_get_fulljid();
|
||||
@ -2995,7 +3031,17 @@ cmd_tiny(gchar **args, struct cmd_help_t help)
|
||||
cons_show_error("Failed to send message.");
|
||||
}
|
||||
} else {
|
||||
message_send_chat(send_recipient->str, tiny);
|
||||
gboolean send_state = FALSE;
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
if (!chat_session_exists(chatwin->barejid)) {
|
||||
chat_session_start(chatwin->barejid, TRUE);
|
||||
}
|
||||
if (chat_session_get_recipient_supports(chatwin->barejid)) {
|
||||
chat_session_set_active(chatwin->barejid);
|
||||
send_state = TRUE;
|
||||
}
|
||||
}
|
||||
message_send_chat(chatwin->barejid, chatwin->resource, tiny, send_state);
|
||||
if (prefs_get_boolean(PREF_CHLOG)) {
|
||||
const char *jid = jabber_get_fulljid();
|
||||
Jid *jidp = jid_create(jid);
|
||||
@ -3006,7 +3052,17 @@ cmd_tiny(gchar **args, struct cmd_help_t help)
|
||||
ui_outgoing_chat_msg("me", chatwin->barejid, tiny);
|
||||
}
|
||||
#else
|
||||
message_send_chat(send_recipient->str, tiny);
|
||||
gboolean send_state = FALSE;
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
if (!chat_session_exists(chatwin->barejid)) {
|
||||
chat_session_start(chatwin->barejid, TRUE);
|
||||
}
|
||||
if (chat_session_get_recipient_supports(chatwin->barejid)) {
|
||||
chat_session_set_active(chatwin->barejid);
|
||||
send_state = TRUE;
|
||||
}
|
||||
}
|
||||
message_send_chat(chatwin->barejid, chatwin->resource, tiny);
|
||||
if (prefs_get_boolean(PREF_CHLOG)) {
|
||||
const char *jid = jabber_get_fulljid();
|
||||
Jid *jidp = jid_create(jid);
|
||||
@ -3016,8 +3072,6 @@ cmd_tiny(gchar **args, struct cmd_help_t help)
|
||||
|
||||
ui_outgoing_chat_msg("me", chatwin->barejid, tiny);
|
||||
#endif
|
||||
g_string_free(send_recipient, TRUE);
|
||||
|
||||
} else if (win_type == WIN_PRIVATE) {
|
||||
ProfPrivateWin *privatewin = wins_get_current_private();
|
||||
message_send_private(tiny, privatewin->fulljid);
|
||||
@ -3931,7 +3985,17 @@ cmd_otr(gchar **args, struct cmd_help_t help)
|
||||
ui_current_print_formatted_line('!', 0, "You have not generated or loaded a private key, use '/otr gen'");
|
||||
} else if (!otr_is_secure(barejid)) {
|
||||
char *otr_query_message = otr_start_query();
|
||||
message_send_chat(barejid, otr_query_message);
|
||||
gboolean send_state = FALSE;
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
if (!chat_session_exists(barejid)) {
|
||||
chat_session_start(barejid, TRUE);
|
||||
}
|
||||
if (chat_session_get_recipient_supports(barejid)) {
|
||||
chat_session_set_active(barejid);
|
||||
send_state = TRUE;
|
||||
}
|
||||
}
|
||||
message_send_chat(barejid, NULL, otr_query_message, send_state);
|
||||
} else {
|
||||
ui_gone_secure(barejid, otr_is_trusted(barejid));
|
||||
}
|
||||
@ -3949,7 +4013,17 @@ cmd_otr(gchar **args, struct cmd_help_t help)
|
||||
} else {
|
||||
ProfChatWin *chatwin = ui_get_current_chat();
|
||||
char *otr_query_message = otr_start_query();
|
||||
message_send_chat(chatwin->barejid, otr_query_message);
|
||||
gboolean send_state = FALSE;
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
if (!chat_session_exists(chatwin->barejid)) {
|
||||
chat_session_start(chatwin->barejid, TRUE);
|
||||
}
|
||||
if (chat_session_get_recipient_supports(chatwin->barejid)) {
|
||||
chat_session_set_active(chatwin->barejid);
|
||||
send_state = TRUE;
|
||||
}
|
||||
}
|
||||
message_send_chat(chatwin->barejid, NULL, otr_query_message, send_state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "contact.h"
|
||||
#include "ui/ui.h"
|
||||
#include "config/preferences.h"
|
||||
#include "chat_session.h"
|
||||
|
||||
#define PRESENCE_ONLINE 1
|
||||
#define PRESENCE_OFFLINE 0
|
||||
@ -109,7 +110,17 @@ static void
|
||||
cb_inject_message(void *opdata, const char *accountname,
|
||||
const char *protocol, const char *recipient, const char *message)
|
||||
{
|
||||
message_send_chat(recipient, message);
|
||||
gboolean send_state = FALSE;
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
if (!chat_session_exists(recipient)) {
|
||||
chat_session_start(recipient, TRUE);
|
||||
}
|
||||
if (chat_session_get_recipient_supports(recipient)) {
|
||||
chat_session_set_active(recipient);
|
||||
send_state = TRUE;
|
||||
}
|
||||
}
|
||||
message_send_chat(recipient, NULL, message, send_state);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -320,7 +320,17 @@ handle_incoming_message(char *barejid, char *message)
|
||||
memmove(whitespace_base, whitespace_base+tag_length, tag_length);
|
||||
char *otr_query_message = otr_start_query();
|
||||
cons_show("OTR Whitespace pattern detected. Attempting to start OTR session...");
|
||||
message_send_chat(barejid, otr_query_message);
|
||||
gboolean send_state = FALSE;
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
if (!chat_session_exists(barejid)) {
|
||||
chat_session_start(barejid, TRUE);
|
||||
}
|
||||
if (chat_session_get_recipient_supports(barejid)) {
|
||||
chat_session_set_active(barejid);
|
||||
send_state = TRUE;
|
||||
}
|
||||
}
|
||||
message_send_chat(barejid, NULL, otr_query_message, send_state);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -334,7 +344,17 @@ handle_incoming_message(char *barejid, char *message)
|
||||
if (policy == PROF_OTRPOLICY_ALWAYS && !was_decrypted && !whitespace_base) {
|
||||
char *otr_query_message = otr_start_query();
|
||||
cons_show("Attempting to start OTR session...");
|
||||
message_send_chat(barejid, otr_query_message);
|
||||
gboolean send_state = FALSE;
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
if (!chat_session_exists(barejid)) {
|
||||
chat_session_start(barejid, TRUE);
|
||||
}
|
||||
if (chat_session_get_recipient_supports(barejid)) {
|
||||
chat_session_set_active(barejid);
|
||||
send_state = TRUE;
|
||||
}
|
||||
}
|
||||
message_send_chat(barejid, NULL, otr_query_message, send_state);
|
||||
}
|
||||
|
||||
ui_incoming_msg(barejid, newmessage, NULL);
|
||||
|
@ -80,36 +80,27 @@ message_add_handlers(void)
|
||||
}
|
||||
|
||||
void
|
||||
message_send_chat(const char * const barejid, const char * const msg)
|
||||
message_send_chat(const char * const barejid, const char * const resource, const char * const msg, gboolean send_state)
|
||||
{
|
||||
const char * jid = NULL;
|
||||
|
||||
if (roster_barejid_from_name(barejid) != NULL) {
|
||||
jid = roster_barejid_from_name(barejid);
|
||||
} else {
|
||||
jid = barejid;
|
||||
}
|
||||
|
||||
if (prefs_get_boolean(PREF_STATES)) {
|
||||
if (!chat_session_exists(jid)) {
|
||||
chat_session_start(jid, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
xmpp_stanza_t *message;
|
||||
xmpp_conn_t * const conn = connection_get_conn();
|
||||
xmpp_ctx_t * const ctx = connection_get_ctx();
|
||||
if (prefs_get_boolean(PREF_STATES) && chat_session_get_recipient_supports(jid)) {
|
||||
chat_session_set_active(jid);
|
||||
message = stanza_create_message(ctx, jid, STANZA_TYPE_CHAT,
|
||||
msg, STANZA_NAME_ACTIVE);
|
||||
|
||||
GString *jid = g_string_new(barejid);
|
||||
if (resource) {
|
||||
g_string_append(jid, "/");
|
||||
g_string_append(jid, resource);
|
||||
}
|
||||
|
||||
if (send_state) {
|
||||
message = stanza_create_message(ctx, jid->str, STANZA_TYPE_CHAT, msg, STANZA_NAME_ACTIVE);
|
||||
} else {
|
||||
message = stanza_create_message(ctx, jid, STANZA_TYPE_CHAT,
|
||||
msg, NULL);
|
||||
message = stanza_create_message(ctx, jid->str, STANZA_TYPE_CHAT, msg, NULL);
|
||||
}
|
||||
|
||||
xmpp_send(conn, message);
|
||||
xmpp_stanza_release(message);
|
||||
g_string_free(jid, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -145,7 +145,8 @@ char* jabber_get_account_name(void);
|
||||
GList * jabber_get_available_resources(void);
|
||||
|
||||
// message functions
|
||||
void message_send_chat(const char * const barejid, const char * const msg);
|
||||
void message_send_chat(const char * const barejid, const char * const resource, const char * const msg,
|
||||
gboolean send_state);
|
||||
void message_send_private(const char * const fulljid, const char * const msg);
|
||||
void message_send_groupchat(const char * const roomjid, const char * const msg);
|
||||
void message_send_groupchat_subject(const char * const roomjid, const char * const subject);
|
||||
|
@ -552,7 +552,9 @@ cmd_otr_start_sends_otr_query_message_to_current_recipeint(void **state)
|
||||
will_return(otr_start_query, query_message);
|
||||
|
||||
expect_string(message_send_chat, barejid, chatwin->barejid);
|
||||
expect_value(message_send_chat, resource, NULL);
|
||||
expect_string(message_send_chat, msg, query_message);
|
||||
expect_any(message_send_chat, send_state);
|
||||
|
||||
gboolean result = cmd_otr(args, *help);
|
||||
assert_true(result);
|
||||
|
@ -58,10 +58,13 @@ GList * jabber_get_available_resources(void)
|
||||
}
|
||||
|
||||
// message functions
|
||||
void message_send_chat(const char * const barejid, const char * const msg)
|
||||
void message_send_chat(const char * const barejid, const char * const resource, const char * const msg,
|
||||
gboolean send_state)
|
||||
{
|
||||
check_expected(barejid);
|
||||
check_expected(resource);
|
||||
check_expected(msg);
|
||||
check_expected(send_state);
|
||||
}
|
||||
|
||||
void message_send_private(const char * const fulljid, const char * const msg) {}
|
||||
|
Loading…
Reference in New Issue
Block a user