diff options
Diffstat (limited to 'src/chat_state.c')
-rw-r--r-- | src/chat_state.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/chat_state.c b/src/chat_state.c index b0e08fd5..cac73817 100644 --- a/src/chat_state.c +++ b/src/chat_state.c @@ -33,11 +33,14 @@ */ #include <stdlib.h> +#include <assert.h> #include <glib.h> #include "chat_state.h" #include "chat_session.h" +#include "window_list.h" +#include "ui/win_types.h" #include "xmpp/xmpp.h" #include "config/preferences.h" @@ -149,6 +152,40 @@ chat_state_gone(const char *const barejid, ChatState *state) } } +void +chat_state_idle(void) +{ + jabber_conn_status_t status = connection_get_status(); + if (status == JABBER_CONNECTED) { + GSList *recipients = wins_get_chat_recipients(); + GSList *curr = recipients; + + while (curr) { + char *barejid = curr->data; + ProfChatWin *chatwin = wins_get_chat(barejid); + chat_state_handle_idle(chatwin->barejid, chatwin->state); + curr = g_slist_next(curr); + } + + if (recipients) { + g_slist_free(recipients); + } + } +} + +void +chat_state_activity(void) +{ + jabber_conn_status_t status = connection_get_status(); + ProfWin *current = wins_get_current(); + + if ((status == JABBER_CONNECTED) && (current->type == WIN_CHAT)) { + ProfChatWin *chatwin = (ProfChatWin*)current; + assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK); + chat_state_handle_typing(chatwin->barejid, chatwin->state); + } +} + static void _send_if_supported(const char *const barejid, void (*send_func)(const char *const)) { |