changeset 183:209546c5b7d0

Improve /to command a bit.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 15 Nov 2010 20:01:29 +0200
parents 59992d930e70
children 3db9fa4c44de
files Makefile.gen nnchat.c
diffstat 2 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.gen	Mon Nov 15 19:20:04 2010 +0200
+++ b/Makefile.gen	Mon Nov 15 20:01:29 2010 +0200
@@ -1,4 +1,5 @@
-CFLAGS+=-g -W -Wall -O2 -DTH_NO_DEFAULTS
+#CFLAGS+=-g -W -Wall -O2 -DTH_NO_DEFAULTS
+CFLAGS+=-g -W -Wall -DTH_NO_DEFAULTS
 COMP=$(CC) $(CFLAGS)
 
 #
--- a/nnchat.c	Mon Nov 15 19:20:04 2010 +0200
+++ b/nnchat.c	Mon Nov 15 20:01:29 2010 +0200
@@ -649,11 +649,17 @@
         }
 #endif
         return 0;
-    } else if (!strncasecmp(buf, "/to ", 4)) {
+    } else if (!strncasecmp(buf, "/to", 3)) {
+        char *name = trimLeft(buf + 3);
         /* Set private messaging target */
         th_free(setTarget);
-        setTarget = th_strdup(trimLeft(buf + 4));
-        printMsg("Set prv target to '%s'\n", setTarget);
+        if (strlen(name) > 0) {
+            setTarget = th_strdup(trimLeft(buf + 3));
+            printMsg("Set prv target to '%s'\n", setTarget);
+        } else {
+            setTarget = NULL;
+            printMsg("Cleared prv target.\n");
+        }
         return 0;
     } else if (!strncasecmp(buf, "/who", 4)) {
         /* Alias /who to /listallusers */