mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Set last presence for account
This commit is contained in:
parent
dba48f18b5
commit
a9c629dd9e
@ -300,6 +300,24 @@ accounts_set_resource(const char * const account_name, const char * const value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
accounts_set_last_presence(const char * const account_name, const char * const value)
|
||||||
|
{
|
||||||
|
if (accounts_account_exists(account_name)) {
|
||||||
|
g_key_file_set_string(accounts, account_name, "presence.last", value);
|
||||||
|
_save_accounts();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
accounts_set_login_presence(const char * const account_name, const char * const value)
|
||||||
|
{
|
||||||
|
if (accounts_account_exists(account_name)) {
|
||||||
|
g_key_file_set_string(accounts, account_name, "presence.login", value);
|
||||||
|
_save_accounts();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_fix_legacy_accounts(const char * const account_name)
|
_fix_legacy_accounts(const char * const account_name)
|
||||||
{
|
{
|
||||||
|
@ -50,5 +50,7 @@ gboolean accounts_account_exists(const char * const account_name);
|
|||||||
void accounts_set_jid(const char * const account_name, const char * const value);
|
void accounts_set_jid(const char * const account_name, const char * const value);
|
||||||
void accounts_set_server(const char * const account_name, const char * const value);
|
void accounts_set_server(const char * const account_name, const char * const value);
|
||||||
void accounts_set_resource(const char * const account_name, const char * const value);
|
void accounts_set_resource(const char * const account_name, const char * const value);
|
||||||
|
void accounts_set_last_presence(const char * const account_name, const char * const value);
|
||||||
|
void accounts_set_login_presence(const char * const account_name, const char * const value);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -402,7 +402,7 @@ jabber_update_presence(jabber_presence_t status, const char * const msg,
|
|||||||
int idle)
|
int idle)
|
||||||
{
|
{
|
||||||
int pri;
|
int pri;
|
||||||
char *show;
|
char *show, *last;
|
||||||
|
|
||||||
// don't send presence when disconnected
|
// don't send presence when disconnected
|
||||||
if (jabber_conn.conn_status != JABBER_CONNECTED)
|
if (jabber_conn.conn_status != JABBER_CONNECTED)
|
||||||
@ -419,18 +419,23 @@ jabber_update_presence(jabber_presence_t status, const char * const msg,
|
|||||||
{
|
{
|
||||||
case PRESENCE_AWAY:
|
case PRESENCE_AWAY:
|
||||||
show = STANZA_TEXT_AWAY;
|
show = STANZA_TEXT_AWAY;
|
||||||
|
last = STANZA_TEXT_AWAY;
|
||||||
break;
|
break;
|
||||||
case PRESENCE_DND:
|
case PRESENCE_DND:
|
||||||
show = STANZA_TEXT_DND;
|
show = STANZA_TEXT_DND;
|
||||||
|
last = STANZA_TEXT_DND;
|
||||||
break;
|
break;
|
||||||
case PRESENCE_CHAT:
|
case PRESENCE_CHAT:
|
||||||
show = STANZA_TEXT_CHAT;
|
show = STANZA_TEXT_CHAT;
|
||||||
|
last = STANZA_TEXT_CHAT;
|
||||||
break;
|
break;
|
||||||
case PRESENCE_XA:
|
case PRESENCE_XA:
|
||||||
show = STANZA_TEXT_XA;
|
show = STANZA_TEXT_XA;
|
||||||
|
last = STANZA_TEXT_XA;
|
||||||
break;
|
break;
|
||||||
default: // PRESENCE_ONLINE
|
default: // PRESENCE_ONLINE
|
||||||
show = NULL;
|
show = NULL;
|
||||||
|
last = STANZA_TEXT_ONLINE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -496,6 +501,9 @@ jabber_update_presence(jabber_presence_t status, const char * const msg,
|
|||||||
xmpp_stanza_release(presence);
|
xmpp_stanza_release(presence);
|
||||||
|
|
||||||
FREE_SET_NULL(sha1);
|
FREE_SET_NULL(sha1);
|
||||||
|
|
||||||
|
// set last presence for account
|
||||||
|
accounts_set_last_presence(saved_account.name, last);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user