diff mcabber/src/jabglue.c @ 519:5c338d31de56

Show current global status message in "/status"
author Mikael Berthe <mikael@lilotux.net>
date Mon, 14 Nov 2005 18:47:08 +0100
parents d40c434fff46
children cc8c969ab6e5
line wrap: on
line diff
--- a/mcabber/src/jabglue.c	Mon Nov 14 18:34:57 2005 +0100
+++ b/mcabber/src/jabglue.c	Mon Nov 14 18:47:08 2005 +0100
@@ -44,6 +44,7 @@
 static int s_id;
 static int regmode, regdone;
 static enum imstatus mystatus = offline;
+static gchar *mystatusmsg;
 static unsigned char online;
 
 char imstatus2char[imstatus_size+1] = {
@@ -263,6 +264,11 @@
   return mystatus;
 }
 
+inline const char *jb_getstatusmsg()
+{
+  return mystatusmsg;
+}
+
 void jb_setstatus(enum imstatus st, const char *recipient, const char *msg)
 {
   xmlnode x;
@@ -339,6 +345,9 @@
 
   hk_mystatuschange(0, mystatus, st, msg);
   mystatus = st;
+  if (mystatusmsg) g_free(mystatusmsg);
+  if (msg)  mystatusmsg = g_strdup(msg);
+  else      mystatusmsg = NULL;
 }
 
 void jb_send_msg(const char *jid, const char *text, int type,
@@ -798,6 +807,10 @@
 
         online = FALSE;
         mystatus = offline;
+        if (mystatusmsg) {
+          g_free(mystatusmsg);
+          mystatusmsg = NULL;
+        }
         roster_free();
         update_roster = TRUE;
         break;