1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Merge branch 'master' into osx-functional

This commit is contained in:
James Booth 2015-09-25 00:37:49 +01:00
commit 95195fceee
4 changed files with 20 additions and 0 deletions

View File

@ -761,6 +761,23 @@ accounts_set_last_presence(const char * const account_name, const char * const v
} }
} }
void
accounts_set_last_activity(const char * const account_name)
{
if (accounts_account_exists(account_name)) {
GDateTime *nowdt = g_date_time_new_now_utc();
GTimeVal nowtv;
gboolean res = g_date_time_to_timeval(nowdt, &nowtv);
g_date_time_unref(nowdt);
if (res) {
char *timestr = g_time_val_to_iso8601(&nowtv);
g_key_file_set_string(accounts, account_name, "last.activity", timestr);
_save_accounts();
}
}
}
void void
accounts_set_login_presence(const char * const account_name, const char * const value) accounts_set_login_presence(const char * const account_name, const char * const value)
{ {

View File

@ -66,6 +66,7 @@ void accounts_set_muc_service(const char * const account_name, const char * cons
void accounts_set_muc_nick(const char * const account_name, const char * const value); void accounts_set_muc_nick(const char * const account_name, const char * const value);
void accounts_set_otr_policy(const char * const account_name, const char * const value); void accounts_set_otr_policy(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_last_presence(const char * const account_name, const char * const value);
void accounts_set_last_activity(const char * const account_name);
void accounts_set_login_presence(const char * const account_name, const char * const value); void accounts_set_login_presence(const char * const account_name, const char * const value);
resource_presence_t accounts_get_login_presence(const char * const account_name); resource_presence_t accounts_get_login_presence(const char * const account_name);
resource_presence_t accounts_get_last_presence(const char * const account_name); resource_presence_t accounts_get_last_presence(const char * const account_name);

View File

@ -200,6 +200,7 @@ jabber_disconnect(void)
// if connected, send end stream and wait for response // if connected, send end stream and wait for response
if (jabber_conn.conn_status == JABBER_CONNECTED) { if (jabber_conn.conn_status == JABBER_CONNECTED) {
log_info("Closing connection"); log_info("Closing connection");
accounts_set_last_activity(jabber_get_account_name());
jabber_conn.conn_status = JABBER_DISCONNECTING; jabber_conn.conn_status = JABBER_DISCONNECTING;
xmpp_disconnect(jabber_conn.conn); xmpp_disconnect(jabber_conn.conn);

View File

@ -122,6 +122,7 @@ void accounts_set_otr_policy(const char * const account_name, const char * const
} }
void accounts_set_last_presence(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_last_activity(const char * const account_name) {}
void accounts_set_pgp_keyid(const char * const account_name, const char * const value) {} void accounts_set_pgp_keyid(const char * const account_name, const char * const value) {}
void accounts_set_login_presence(const char * const account_name, const char * const value) void accounts_set_login_presence(const char * const account_name, const char * const value)