mirror of
https://github.com/profanity-im/profanity.git
synced 2025-01-03 14:57:42 -05:00
Moved idle chat state handling out of ui module
This commit is contained in:
parent
383d91ec36
commit
acf1afe025
@ -453,7 +453,31 @@ prof_handle_idle(void)
|
||||
{
|
||||
jabber_conn_status_t status = jabber_get_connection_status();
|
||||
if (status == JABBER_CONNECTED) {
|
||||
ui_idle();
|
||||
GSList *recipients = ui_get_recipients();
|
||||
GSList *curr = recipients;
|
||||
|
||||
while (curr != NULL) {
|
||||
char *recipient = curr->data;
|
||||
chat_session_no_activity(recipient);
|
||||
|
||||
if (chat_session_is_gone(recipient) &&
|
||||
!chat_session_get_sent(recipient)) {
|
||||
message_send_gone(recipient);
|
||||
} else if (chat_session_is_inactive(recipient) &&
|
||||
!chat_session_get_sent(recipient)) {
|
||||
message_send_inactive(recipient);
|
||||
} else if (prefs_get_boolean(PREF_OUTTYPE) &&
|
||||
chat_session_is_paused(recipient) &&
|
||||
!chat_session_get_sent(recipient)) {
|
||||
message_send_paused(recipient);
|
||||
}
|
||||
|
||||
curr = g_slist_next(curr);
|
||||
}
|
||||
|
||||
if (recipients != NULL) {
|
||||
g_slist_free(recipients);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -211,33 +211,11 @@ ui_contact_typing(const char * const barejid)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ui_idle(void)
|
||||
GSList *
|
||||
ui_get_recipients(void)
|
||||
{
|
||||
GSList *recipients = wins_get_chat_recipients();
|
||||
GSList *curr = recipients;
|
||||
while (curr != NULL) {
|
||||
char *recipient = curr->data;
|
||||
chat_session_no_activity(recipient);
|
||||
|
||||
if (chat_session_is_gone(recipient) &&
|
||||
!chat_session_get_sent(recipient)) {
|
||||
message_send_gone(recipient);
|
||||
} else if (chat_session_is_inactive(recipient) &&
|
||||
!chat_session_get_sent(recipient)) {
|
||||
message_send_inactive(recipient);
|
||||
} else if (prefs_get_boolean(PREF_OUTTYPE) &&
|
||||
chat_session_is_paused(recipient) &&
|
||||
!chat_session_get_sent(recipient)) {
|
||||
message_send_paused(recipient);
|
||||
}
|
||||
|
||||
curr = g_slist_next(curr);
|
||||
}
|
||||
|
||||
if (recipients != NULL) {
|
||||
g_slist_free(recipients);
|
||||
}
|
||||
return recipients;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -48,7 +48,7 @@ void ui_refresh(void);
|
||||
void ui_close(void);
|
||||
void ui_resize(const int ch, const char * const input,
|
||||
const int size);
|
||||
void ui_idle(void);
|
||||
GSList* ui_get_recipients(void);
|
||||
void ui_handle_special_keys(const wint_t * const ch, const char * const inp,
|
||||
const int size);
|
||||
void ui_switch_win(const int i);
|
||||
|
Loading…
Reference in New Issue
Block a user