changeset 188:6b399b7ce40b

Automatically grab PRV target from incoming PRV if target not already set.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 16 Nov 2010 02:40:17 +0200
parents c73003485c2d
children b0d64dde62af
files nnchat.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/nnchat.c	Tue Nov 16 02:39:59 2010 +0200
+++ b/nnchat.c	Tue Nov 16 02:40:17 2010 +0200
@@ -393,6 +393,15 @@
         t = nn_strip_tags(s + 1);
         if (!strncmp(t, "BPRV", 4)) {
             h = nn_decode_str2(t + 1);
+            if (setTarget == NULL && !strncmp(h, "PRV from ", 9)) {
+                char *end, *name = th_strdup(h + 9);
+                if (name != NULL && (end = strchr(name, ':')) != NULL) {
+                    *end = 0;
+                    setTarget = th_strdup(name);
+                    printMsg("PRV target autoset to '%s'\n", setTarget);
+                }
+                th_free(name);
+            }
             printMsg("½11½%s½0½\n", h);
         } else {
             h = nn_decode_str2(t);