From 752215cfdee21a0ac55de9b41b2cb19a785bd9a7 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Thu, 14 Aug 2003 13:20:04 +0000 Subject: Nicer thinking --- vchat-commands.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/vchat-commands.c b/vchat-commands.c index 0d7cf96..e60fa70 100755 --- a/vchat-commands.c +++ b/vchat-commands.c @@ -118,6 +118,22 @@ translatecommand( unsigned char **cmd) return result; } +/* handle thought */ +static void +dothink( unsigned char *tail, char nice ) +{ + while( *tail == ' ' ) tail++; + + /* send users message to server */ + snprintf (tmpstr, TMPSTRSIZE, ".%c %s", nice, tail); + networkoutput (tmpstr); + + /* show action in channel window */ + snprintf (tmpstr, TMPSTRSIZE, nice == 'O' ? getformatstr(FS_TXPUBNTHOUGHT) : getformatstr(FS_TXPUBTHOUGHT), tail); + writechan (tmpstr); +} + + /* handle action */ static void doaction( unsigned char *tail ) @@ -207,16 +223,8 @@ handleline (unsigned char *line) } break; case 'o': - /* We do think something, the ugly way :) */ - snprintf (tmpstr, TMPSTRSIZE, getformatstr(FS_TXPUBTHOUGHT), line); - writechan (tmpstr); - networkoutput (line); - break; case 'O': - /* We do think something, the nice way :) */ - snprintf (tmpstr, TMPSTRSIZE, getformatstr(FS_TXPUBNTHOUGHT), line); - writechan (tmpstr); - networkoutput (line); + dothink( line + 2, line[1] ); break; default: /* generic server command, send to server, show to user */ -- cgit v1.2.3