mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
parent
070c3ae6cc
commit
e02ab52a4e
@ -482,37 +482,40 @@ static void
|
||||
_handle_idle_time()
|
||||
{
|
||||
gint prefs_time = prefs_get_autoaway_time() * 60000;
|
||||
|
||||
resource_presence_t current_presence = accounts_get_last_presence(jabber_get_account_name());
|
||||
unsigned long idle_ms = ui_get_idle_time();
|
||||
|
||||
if (!idle) {
|
||||
if (idle_ms >= prefs_time) {
|
||||
idle = TRUE;
|
||||
if ((current_presence == RESOURCE_ONLINE) || (current_presence == RESOURCE_CHAT)) {
|
||||
if (idle_ms >= prefs_time) {
|
||||
idle = TRUE;
|
||||
|
||||
// handle away mode
|
||||
if (strcmp(prefs_get_string(PREF_AUTOAWAY_MODE), "away") == 0) {
|
||||
presence_update(RESOURCE_AWAY, prefs_get_string(PREF_AUTOAWAY_MESSAGE), 0);
|
||||
if (prefs_get_string(PREF_AUTOAWAY_MESSAGE) != NULL) {
|
||||
int pri =
|
||||
accounts_get_priority_for_presence_type(jabber_get_account_name(),
|
||||
RESOURCE_AWAY);
|
||||
cons_show("Idle for %d minutes, status set to away (priority %d), \"%s\".",
|
||||
prefs_get_autoaway_time(), pri, prefs_get_string(PREF_AUTOAWAY_MESSAGE));
|
||||
title_bar_set_status(CONTACT_AWAY);
|
||||
ui_current_page_off();
|
||||
} else {
|
||||
int pri =
|
||||
accounts_get_priority_for_presence_type(jabber_get_account_name(),
|
||||
RESOURCE_AWAY);
|
||||
cons_show("Idle for %d minutes, status set to away (priority %d).",
|
||||
prefs_get_autoaway_time(), pri);
|
||||
title_bar_set_status(CONTACT_AWAY);
|
||||
ui_current_page_off();
|
||||
// handle away mode
|
||||
if (strcmp(prefs_get_string(PREF_AUTOAWAY_MODE), "away") == 0) {
|
||||
presence_update(RESOURCE_AWAY, prefs_get_string(PREF_AUTOAWAY_MESSAGE), 0);
|
||||
if (prefs_get_string(PREF_AUTOAWAY_MESSAGE) != NULL) {
|
||||
int pri =
|
||||
accounts_get_priority_for_presence_type(jabber_get_account_name(),
|
||||
RESOURCE_AWAY);
|
||||
cons_show("Idle for %d minutes, status set to away (priority %d), \"%s\".",
|
||||
prefs_get_autoaway_time(), pri, prefs_get_string(PREF_AUTOAWAY_MESSAGE));
|
||||
title_bar_set_status(CONTACT_AWAY);
|
||||
ui_current_page_off();
|
||||
} else {
|
||||
int pri =
|
||||
accounts_get_priority_for_presence_type(jabber_get_account_name(),
|
||||
RESOURCE_AWAY);
|
||||
cons_show("Idle for %d minutes, status set to away (priority %d).",
|
||||
prefs_get_autoaway_time(), pri);
|
||||
title_bar_set_status(CONTACT_AWAY);
|
||||
ui_current_page_off();
|
||||
}
|
||||
|
||||
// handle idle mode
|
||||
} else if (strcmp(prefs_get_string(PREF_AUTOAWAY_MODE), "idle") == 0) {
|
||||
presence_update(RESOURCE_ONLINE,
|
||||
prefs_get_string(PREF_AUTOAWAY_MESSAGE), idle_ms / 1000);
|
||||
}
|
||||
|
||||
// handle idle mode
|
||||
} else if (strcmp(prefs_get_string(PREF_AUTOAWAY_MODE), "idle") == 0) {
|
||||
presence_update(RESOURCE_ONLINE,
|
||||
prefs_get_string(PREF_AUTOAWAY_MESSAGE), idle_ms / 1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user