changeset 640:1cd7f8e3895b

"/status_to" can be used with no jid (it will use the current buddy's jid)
author Mikael Berthe <mikael@lilotux.net>
date Wed, 28 Dec 2005 18:58:03 +0100
parents 3edd3687c38d
children 62679532ea55
files mcabber/src/commands.c
diffstat 1 files changed, 24 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/commands.c	Wed Dec 28 11:09:01 2005 +0100
+++ b/mcabber/src/commands.c	Wed Dec 28 18:58:03 2005 +0100
@@ -501,9 +501,31 @@
 
   if (!jid || !st) {
     scr_LogPrint(LPRINT_NORMAL, "Wrong usage");
-  } else if (check_jid_syntax(jid)) {
-    scr_LogPrint(LPRINT_NORMAL, "<%s> is not a valid Jabber id", jid);
+    free_arg_lst(paramlst);
+    return;
+  }
+
+  // Allow things like /status_to "" away
+  if (!*jid)
+    jid = NULL;
+
+  if (jid) {
+    // The JID has been specified.  Quick check...
+    if (check_jid_syntax(jid)) {
+      scr_LogPrint(LPRINT_NORMAL, "<%s> is not a valid Jabber id", jid);
+      jid = NULL;
+    } else {
+      mc_strtolower(jid);
+    }
   } else {
+    // Add the current buddy
+    if (current_buddy)
+      jid = (char*)buddy_getjid(BUDDATA(current_buddy));
+    if (!jid)
+      scr_LogPrint(LPRINT_NORMAL, "Please specify a Jabber id");
+  }
+
+  if (jid) {
     char *cmd;
     if (!msg)
       msg = "";