Moved chat states out of xmpp module for message send chat

This commit is contained in:
James Booth
2014-12-27 00:52:34 +00:00
parent 676ed1cbae
commit e602c2909e
8 changed files with 214 additions and 87 deletions

View File

@@ -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