changeset 996:f4d6570e2628

Chatstates: display contact chatstate in the chat status bar
author Mikael Berthe <mikael@lilotux.net>
date Thu, 02 Nov 2006 21:59:15 +0100
parents c89e7993c4d9
children d0d0cd9e39c4
files mcabber/src/screen.c
diffstat 1 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/screen.c	Wed Nov 01 23:40:48 2006 +0100
+++ b/mcabber/src/screen.c	Thu Nov 02 21:59:15 2006 +0100
@@ -1089,6 +1089,31 @@
   g_free(buf_locale);
   g_free(buf);
 
+  // Display chatstates of the contact, if available.
+  if (btype & ROSTER_TYPE_USER) {
+    char eventchar = 0;
+    guint event;
+
+    // We do not specify the resource here, so one of the resources with the
+    // highest priority will be used.
+    event = buddy_resource_getevents(BUDDATA(current_buddy), NULL);
+
+    if (event == ROSTER_EVENT_ACTIVE)
+      eventchar = 'A';
+    else if (event == ROSTER_EVENT_COMPOSING)
+      eventchar = 'C';
+    else if (event == ROSTER_EVENT_PAUSED)
+      eventchar = 'P';
+    else if (event == ROSTER_EVENT_INACTIVE)
+      eventchar = 'I';
+    else if (event == ROSTER_EVENT_GONE)
+      eventchar = 'G';
+
+    if (eventchar)
+      mvwprintw(chatstatusWnd, 0, maxX-3, "[%c]", eventchar);
+  }
+
+
   if (forceupdate) {
     update_panels();
   }