diff mcabber/src/jabglue.c @ 116:1e7e59775f12

[/trunk] Changeset 130 by mikael * Add /status command. * Fix /quit command when there is a trailing word ("/quit bye"...). * Add an extension (.txt) to the TODO file.
author mikael
date Mon, 25 Apr 2005 15:26:17 +0000
parents 065d8368c36b
children 1e8f646e2c5b
line wrap: on
line diff
--- a/mcabber/src/jabglue.c	Sun Apr 24 20:50:16 2005 +0000
+++ b/mcabber/src/jabglue.c	Mon Apr 25 15:26:17 2005 +0000
@@ -36,6 +36,7 @@
 unsigned int KeepaliveDelay;
 static int s_id = 1;  // FIXME which use??
 static int regmode, regdone;
+static enum imstatus mystatus = offline;
 unsigned char online;
 
 char imstatus2char[imstatus_size] = {
@@ -203,9 +204,19 @@
   }
 }
 
-void setjabberstatus(enum imstatus st, char *msg)
+inline enum imstatus jb_getstatus()
+{
+  return mystatus;
+}
+
+void jb_setstatus(enum imstatus st, char *msg)
 {
-  xmlnode x = jutil_presnew(JPACKET__UNKNOWN, 0, 0);
+  xmlnode x;
+
+  if (!online)
+    return;
+
+  x = jutil_presnew(JPACKET__UNKNOWN, 0, 0);
 
   switch(st) {
     case away:
@@ -243,7 +254,7 @@
             add["prio"].c_str(), (unsigned) -1);
   */
 
-  if (!msg || !*msg) {
+  if (!msg) {
     msg  = ""; // FIXME
     //msg = imstatus2str(st);
   }
@@ -254,9 +265,10 @@
   jab_send(jc, x);
   xmlnode_free(x);
 
-  //sendvisibility();
+  //sendvisibility();   ???
 
-  // XXX logger.putourstatus(proto, getstatus(), ourstatus = st);
+  hk_mystatuschange(0, mystatus, st);
+  mystatus = st;
 }
 
 void jb_send_msg(const char *jid, const char *text)
@@ -276,7 +288,7 @@
 
   //setautostatus(jhook.manualstatus);
 
-  setjabberstatus(1, "I'm here!");
+  jb_setstatus(available, "I'm here!"); // XXX not always "available"...
   buddylist_build();
   /*
   for (i = 0; i < clist.count; i++) {