From 599760ac5c011c9ffc1515264ad08ca7dea98b44 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Sun, 1 Feb 2004 15:37:21 +0000 Subject: Bell on PM // Match username && username: --- vchat-commands.c | 2 +- vchat-config.h | 1 + vchat-protocol.c | 4 ++-- vchat-ui.c | 4 +++- vchat-user.c | 4 +++- vchat.h | 4 ++-- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/vchat-commands.c b/vchat-commands.c index 7d41c0c..5f54733 100755 --- a/vchat-commands.c +++ b/vchat-commands.c @@ -178,7 +178,7 @@ privatemessagetx ( unsigned char *tail ) { /* show message in private window */ snprintf (tmpstr, TMPSTRSIZE, getformatstr(FS_TXPRIVMSG), tail, mesg); - writepriv (tmpstr); + writepriv (tmpstr, 0); /* note we messaged someone */ ul_msgto(tail); diff --git a/vchat-config.h b/vchat-config.h index c25c3cb..008a940 100755 --- a/vchat-config.h +++ b/vchat-config.h @@ -52,6 +52,7 @@ static volatile configoption configoptions[] = { {CF_SCROLLBPRIVT,CO_INT, "privscrollt",(char *) 0, (char *)-1, { NULL } }, {CF_SCROLLBACKT, CO_INT, "scrolltime", (char *) 86400, (char *)-1, { NULL } }, {CF_KEEPLOG, CO_INT, "keeplog", (char *) 0, (char *)-1, { NULL } }, + {CF_BELLPRIV, CO_INT, "bellonpm", (char *) 0, (char *)-1, { NULL } }, {CF_NIL, CO_NIL, NULL, NULL, NULL, { NULL } }, }; diff --git a/vchat-protocol.c b/vchat-protocol.c index 4d1f333..a78d587 100755 --- a/vchat-protocol.c +++ b/vchat-protocol.c @@ -385,7 +385,7 @@ pmnotsent (unsigned char *message) { while(*message && *message!=' ') message++; snprintf(tmpstr,TMPSTRSIZE,getformatstr(FS_ERR),message+1); - writepriv( tmpstr); + writepriv( tmpstr, 0); } @@ -935,7 +935,7 @@ parsemsg (unsigned char *message) str2++; if (str2[0] == ' ') str2++; snprintf(tmpstr,TMPSTRSIZE,getformatstr(FS_RXPRIVMSG),str1,str2); - writepriv (tmpstr); + writepriv (tmpstr, 1); ul_msgfrom(str1); } /* message starts with a number? must be a servermessage */ diff --git a/vchat-ui.c b/vchat-ui.c index 6afbe19..289d5f5 100755 --- a/vchat-ui.c +++ b/vchat-ui.c @@ -324,7 +324,7 @@ int writecf (formtstr id,unsigned char *str) { return i; } -int writepriv (unsigned char *str) { +int writepriv (unsigned char *str, int maybeep) { int i = 0; if (private) { @@ -341,6 +341,8 @@ int writepriv (unsigned char *str) { i = writescr(private, tmp); } if( privwinhidden ) { + if( maybeep && getintoption( CF_BELLPRIV )) + putchar( 7 ); privheight_desired = privwinhidden; privwinhidden = 0; resize(0); diff --git a/vchat-user.c b/vchat-user.c index 4ad9f4f..1e14112 100755 --- a/vchat-user.c +++ b/vchat-user.c @@ -159,11 +159,13 @@ ul_join (unsigned char *name, int channel) user * ul_finduser (unsigned char *name) { user *tmp = nicks; + snprintf( tmpstr, TMPSTRSIZE, "%s:", name); + /* search user */ while (tmp) { /* is it this user? */ - if (!strcmp (name, tmp->nick)) + if (!strcmp (name, tmp->nick) || !strcmp(tmpstr, tmp->nick)) { return tmp; } diff --git a/vchat.h b/vchat.h index fcae04f..33c378b 100755 --- a/vchat.h +++ b/vchat.h @@ -39,7 +39,7 @@ typedef enum { CF_NIL, CF_NICK, CF_FROM, CF_SERVERHOST, CF_SERVERPORT, CF_CIPHERSUITE, CF_CONFIGFILE, CF_CERTFILE, CF_KEYFILE, CF_FORMFILE, CF_LOGFILE, CF_USESSL, CF_USECERT, CF_PRIVHEIGHT, CF_HSCROLL, CF_CHANNEL, CF_USETIME, CF_USETOPIC, CF_SCROLLBPRIV, CF_SCROLLBACK, CF_SCROLLBPRIVT, CF_SCROLLBACKT, -CF_KEEPLOG, CF_ENCODING } confopt; +CF_KEEPLOG, CF_ENCODING, CF_BELLPRIV } confopt; /* format strings */ typedef enum { FS_PLAIN, FS_CHAN, FS_PRIV, FS_SERV, FS_GLOB, FS_DBG, FS_ERR, @@ -149,7 +149,7 @@ void userinput (void); /* display various messages */ int writechan (unsigned char *str); -int writepriv (unsigned char *str); +int writepriv (unsigned char *str, int maybeep ); void writeout (unsigned char *str); void showout (void); void flushout (void); -- cgit v1.2.3