From: Eric W. <war...@us...> - 2001-09-27 20:33:02
|
Update of /cvsroot/gaim/gaim/src In directory usw-pr-cvs1:/tmp/cvs-serv20741 Modified Files: buddy_chat.c conversation.c gaim.h Log Message: i need to go to class. but just because i need to do something doesn't mean i will, especially when what i need to do is related to school. Index: buddy_chat.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/buddy_chat.c,v retrieving revision 1.116 retrieving revision 1.117 diff -u -d -r1.116 -r1.117 --- buddy_chat.c 2001/09/27 19:17:10 1.116 +++ buddy_chat.c 2001/09/27 20:32:59 1.117 @@ -25,6 +25,7 @@ #include <string.h> #include <sys/time.h> #include <unistd.h> +#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <gtk/gtk.h> @@ -469,6 +470,46 @@ return FALSE; } +static gboolean find_nick(struct gaim_connection *gc, char *message) +{ + char *msg = g_strdup(message), *who, *p; + int n; + g_strdown(msg); + + who = g_strdup(gc->username); + n = strlen(who); + g_strdown(who); + + if ((p = strstr(msg, who)) != NULL) { + if ((p == msg) || (!isalnum(*(p - 1)) && !isalnum(*(p + n)))) { + g_free(who); + g_free(msg); + return TRUE; + } + } + g_free(who); + + if (g_strcasecmp(gc->username, gc->displayname)) { + g_free(msg); + return FALSE; + } + + who = g_strdup(gc->displayname); + n = strlen(who); + g_strdown(who); + + if ((p = strstr(msg, who)) != NULL) { + if ((p == msg) || (!isalnum(*(p - 1)) && !isalnum(*(p + n)))) { + g_free(who); + g_free(msg); + return TRUE; + } + } + g_free(who); + g_free(msg); + return FALSE; +} + void chat_write(struct conversation *b, char *who, int flag, char *message, time_t mtime) { GList *ignore = b->ignored; @@ -488,11 +529,11 @@ if (!(flag & WFLAG_WHISPER)) { str = g_strdup(normalize (who)); - if (!g_strcasecmp(str, normalize (b->gc->username))) { + if (!g_strcasecmp(str, normalize(b->gc->username))) { if (b->makesound && (sound_options & OPT_SOUND_CHAT_YOU_SAY)) play_sound(CHAT_YOU_SAY); flag |= WFLAG_SEND; - } else if (!g_strcasecmp(str, normalize (b->gc->displayname))) { + } else if (!g_strcasecmp(str, normalize(b->gc->displayname))) { if (b->makesound && (sound_options & OPT_SOUND_CHAT_YOU_SAY)) play_sound(CHAT_YOU_SAY); flag |= WFLAG_SEND; @@ -503,6 +544,9 @@ } g_free(str); } + + if ((flag & WFLAG_RECV) && find_nick(b->gc, message)) + flag |= WFLAG_NICK; write_to_conv(b, message, flag, who, mtime); } Index: conversation.c =================================================================== RCS file: /cvsroot/gaim/gaim/src/conversation.c,v retrieving revision 1.265 retrieving revision 1.266 diff -u -d -r1.265 -r1.266 --- conversation.c 2001/09/27 19:17:10 1.265 +++ conversation.c 2001/09/27 20:32:59 1.266 @@ -1429,11 +1429,11 @@ if (meify(what)) { str = g_malloc(1024); g_snprintf(str, 1024, "***%s", who); - strcpy(colour, "#6C2585\0"); + strcpy(colour, "#6C2585"); } else { str = g_malloc(1024); g_snprintf(str, 1024, "*%s*:", who); - strcpy(colour, "#00ff00\0"); + strcpy(colour, "#00ff00"); } } else { if (meify(what)) { @@ -1442,14 +1442,19 @@ g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, who); else g_snprintf(str, 1024, "***%s", who); - strcpy(colour, "#062585\0"); + if (flags & WFLAG_NICK) + strcpy(colour, "#ef7f00"); + else + strcpy(colour, "#062585"); } else { str = g_malloc(1024); if (flags & WFLAG_AUTO) g_snprintf(str, 1024, "%s %s", who, AUTO_RESPONSE); else g_snprintf(str, 1024, "%s:", who); - if (flags & WFLAG_RECV) + if (flags & WFLAG_NICK) + strcpy(colour, "#ef7f00"); + else if (flags & WFLAG_RECV) strcpy(colour, "#ff0000"); else if (flags & WFLAG_SEND) strcpy(colour, "#0000ff"); Index: gaim.h =================================================================== RCS file: /cvsroot/gaim/gaim/src/gaim.h,v retrieving revision 1.264 retrieving revision 1.265 diff -u -d -r1.264 -r1.265 --- gaim.h 2001/09/27 17:44:23 1.264 +++ gaim.h 2001/09/27 20:32:59 1.265 @@ -63,12 +63,13 @@ #define UC_NORMAL 8 #define UC_UNAVAILABLE 16 -#define WFLAG_SEND 1 -#define WFLAG_RECV 2 -#define WFLAG_AUTO 4 -#define WFLAG_WHISPER 8 -#define WFLAG_FILERECV 16 -#define WFLAG_SYSTEM 32 +#define WFLAG_SEND 0x01 +#define WFLAG_RECV 0x02 +#define WFLAG_AUTO 0x04 +#define WFLAG_WHISPER 0x08 +#define WFLAG_FILERECV 0x10 +#define WFLAG_SYSTEM 0x20 +#define WFLAG_NICK 0x40 #define AUTO_RESPONSE "<AUTO-REPLY> : " |