1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Removed presence from jabber_conn

This commit is contained in:
James Booth 2013-02-10 13:36:11 +00:00
parent 4cb77272f3
commit 59e9b10d19
4 changed files with 7 additions and 26 deletions

View File

@ -1198,8 +1198,9 @@ _cmd_account(gchar **args, struct cmd_help_t help)
break;
}
jabber_conn_status_t conn_status = jabber_get_connection_status();
if (conn_status == JABBER_CONNECTED && presence_type == jabber_get_presence_type()) {
presence_update(jabber_get_presence_type(), jabber_get_presence_message(), 0);
presence_t last_presence = accounts_get_last_presence(jabber_get_account_name());
if (conn_status == JABBER_CONNECTED && presence_type == last_presence) {
presence_update(last_presence, jabber_get_presence_message(), 0);
}
cons_show("Updated %s priority for account %s: %s", property, account_name, value);
cons_show("");
@ -2238,9 +2239,8 @@ _cmd_set_priority(gchar **args, struct cmd_help_t help)
if (_strtoi(value, &intval, -128, 127) == 0) {
accounts_set_priority_all(jabber_get_account_name(), intval);
//prefs_set_priority((int)intval);
// update presence with new priority
presence_update(jabber_get_presence_type(), jabber_get_presence_message(), 0);
presence_t last_presence = accounts_get_last_presence(jabber_get_account_name());
presence_update(last_presence, jabber_get_presence_message(), 0);
cons_show("Priority set to %d.", intval);
}

View File

@ -47,7 +47,6 @@ static struct _jabber_conn_t {
xmpp_ctx_t *ctx;
xmpp_conn_t *conn;
jabber_conn_status_t conn_status;
presence_t presence_type;
char *presence_message;
int priority;
int tls_disabled;
@ -89,7 +88,6 @@ jabber_init(const int disable_tls)
{
log_info("Initialising XMPP");
jabber_conn.conn_status = JABBER_STARTED;
jabber_conn.presence_type = PRESENCE_OFFLINE;
jabber_conn.presence_message = NULL;
jabber_conn.tls_disabled = disable_tls;
presence_init();
@ -165,7 +163,6 @@ jabber_disconnect(void)
}
jabber_conn.conn_status = JABBER_STARTED;
jabber_conn.presence_type = PRESENCE_OFFLINE;
FREE_SET_NULL(jabber_conn.presence_message);
}
@ -228,12 +225,6 @@ jabber_get_jid(void)
return xmpp_conn_get_jid(jabber_conn.conn);
}
presence_t
jabber_get_presence_type(void)
{
return jabber_conn.presence_type;
}
char *
jabber_get_presence_message(void)
{
@ -246,12 +237,6 @@ jabber_get_account_name(void)
return saved_account.name;
}
void
connection_set_presence_type(const presence_t presence_type)
{
jabber_conn.presence_type = presence_type;
}
void
connection_set_presence_message(const char * const message)
{
@ -424,7 +409,6 @@ _connection_handler(xmpp_conn_t * const conn,
iq_roster_request();
jabber_conn.conn_status = JABBER_CONNECTED;
jabber_conn.presence_type = PRESENCE_ONLINE;
if (prefs_get_reconnect() != 0) {
if (reconnect_timer != NULL) {
@ -461,7 +445,6 @@ _connection_handler(xmpp_conn_t * const conn,
// close stream response from server after disconnect is handled too
jabber_conn.conn_status = JABBER_DISCONNECTED;
jabber_conn.presence_type = PRESENCE_OFFLINE;
}
}

View File

@ -119,7 +119,6 @@ presence_update(presence_t presence_type, const char * const msg,
if (jabber_get_connection_status() != JABBER_CONNECTED)
return;
connection_set_presence_type(presence_type);
connection_set_presence_message(msg);
connection_set_priority(pri);
@ -161,7 +160,7 @@ presence_join_room(Jid *jid)
{
xmpp_ctx_t *ctx = connection_get_ctx();
xmpp_conn_t *conn = connection_get_conn();
presence_t presence_type = jabber_get_presence_type();
presence_t presence_type = accounts_get_last_presence(jabber_get_account_name());
const char *show = stanza_get_presence_string_from_type(presence_type);
char *status = jabber_get_presence_message();
int pri = accounts_get_priority_for_presence_type(jabber_get_account_name(),
@ -184,7 +183,7 @@ presence_change_room_nick(const char * const room, const char * const nick)
{
xmpp_ctx_t *ctx = connection_get_ctx();
xmpp_conn_t *conn = connection_get_conn();
presence_t presence_type = jabber_get_presence_type();
presence_t presence_type = accounts_get_last_presence(jabber_get_account_name());
const char *show = stanza_get_presence_string_from_type(presence_type);
char *status = jabber_get_presence_message();
int pri = accounts_get_priority_for_presence_type(jabber_get_account_name(),

View File

@ -66,7 +66,6 @@ void jabber_disconnect(void);
void jabber_process_events(void);
const char * jabber_get_jid(void);
jabber_conn_status_t jabber_get_connection_status(void);
presence_t jabber_get_presence_type(void);
char * jabber_get_presence_message(void);
void jabber_set_autoping(int seconds);
char* jabber_get_account_name(void);