changeset 293:ff39ebf05b40 dev-0_9_0

Fix unwindowed PRVs.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 11 Jun 2011 03:39:22 +0300
parents 90dd26f5918a
children 11e19afcfcf5
files nnchat.c
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/nnchat.c	Sat Jun 11 03:18:29 2011 +0300
+++ b/nnchat.c	Sat Jun 11 03:39:22 2011 +0300
@@ -620,7 +620,9 @@
 
         t = nn_strip_tags(s + 1);
         if (!strncmp(t, "BPRV ", 5)) {
-            char *name, *tmp, *msg;
+            char *name, *tmp, *msg, *h;
+            nn_window_t *win;
+            h = nn_decode_str2(t + 1);
             
             if (!strncmp(t, "BPRV from ", 10)) {
                 name = nn_decode_str2(t + 10);
@@ -638,8 +640,14 @@
             *tmp = 0;
 
             isIgnored = setIgnoreMode && checkIgnoreList(name);
-
-            printMsgQ(nn_find_window(name), isIgnored, "½5½<½%d½%s½5½>½0½ %s\n", isMine ? 14 : 15, isMine ? optUserName : name, msg);
+            win = nn_find_window(name);
+            
+            if (win != NULL)
+                printMsgQ(win, isIgnored, "½5½<½%d½%s½5½>½0½ %s\n", isMine ? 14 : 15, isMine ? optUserName : name, msg);
+            else
+                printMsgQ(NULL, isIgnored, "½11½%s½0½\n", h);
+            
+            th_free(h);
         } else {
             /* It's an action (/me) */
             char *h = nn_decode_str2(t);