Mercurial > pidgin
changeset 765:bf31bf916f53
[gaim-migrate @ 775]
no, if the away message gets modified, it'll be modified many many times. you won't notice it
until you run out of space
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Fri, 25 Aug 2000 05:04:41 +0000 |
parents | a566fc987db9 |
children | 936c132ea0a1 |
files | src/gaim.h src/server.c src/util.c |
diffstat | 3 files changed, 17 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gaim.h Fri Aug 25 04:17:06 2000 +0000 +++ b/src/gaim.h Fri Aug 25 05:04:41 2000 +0000 @@ -401,7 +401,7 @@ #define TYPE_SIGNOFF 4 #define TYPE_KEEPALIVE 5 -#define REVISION "gaim:$Revision: 774 $" +#define REVISION "gaim:$Revision: 775 $" #define FLAPON "FLAPON\r\n\r\n" #define ROAST "Tic/Toc" @@ -585,7 +585,7 @@ extern GtkWidget *picture_button2(GtkWidget *, char *, char **, short); extern void translate_lst (FILE *, char *); extern void translate_blt (FILE *, char *); -extern void stylize(gchar *, int); +extern char *stylize(gchar *, int); /* Functions in server.c */ /* input to serv */
--- a/src/server.c Fri Aug 25 04:17:06 2000 +0000 +++ b/src/server.c Fri Aug 25 05:04:41 2000 +0000 @@ -704,7 +704,7 @@ if (awaymessage != NULL) { time_t t; - char tmpmsg[BUF_LEN]; + char *tmpmsg; time(&t); @@ -718,9 +718,8 @@ is_idle = -1; /* apply default fonts and colors */ - stylize(awaymessage->message, MSG_LEN); + tmpmsg = stylize(awaymessage->message, MSG_LEN); - strcpy(tmpmsg, awaymessage->message); escape_text(tmpmsg); escape_message(tmpmsg); serv_send_im(name, away_subs(tmpmsg, name), 1); @@ -729,7 +728,8 @@ is_idle = 1; if (cnv != NULL) - write_to_conv(cnv, away_subs(awaymessage->message, name), WFLAG_SEND | WFLAG_AUTO, NULL); + write_to_conv(cnv, away_subs(tmpmsg, name), WFLAG_SEND | WFLAG_AUTO, NULL); + g_free(tmpmsg); } }
--- a/src/util.c Fri Aug 25 04:17:06 2000 +0000 +++ b/src/util.c Fri Aug 25 05:04:41 2000 +0000 @@ -1107,29 +1107,31 @@ return; } -void stylize(gchar *text, int length) +char *stylize(gchar *text, int length) { gchar *buf; + char tmp[length]; buf = g_malloc(length); + g_snprintf(buf, length, "%s", text); if (font_options & OPT_FONT_FACE) { - g_snprintf(buf, length, "<FONT FACE=\"%s\">%s</FONT>", fontface, text); - strcpy(text, buf); + g_snprintf(tmp, length, "<FONT FACE=\"%s\">%s</FONT>", fontface, buf); + strcpy(buf, tmp); } if (font_options & OPT_FONT_FGCOL) { - g_snprintf(buf, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", fgcolor.red, fgcolor.green, fgcolor.blue, text); - strcpy(text, buf); + g_snprintf(tmp, length, "<FONT COLOR=\"#%02X%02X%02X\">%s</FONT>", fgcolor.red, fgcolor.green, fgcolor.blue, buf); + strcpy(buf, tmp); } if (font_options & OPT_FONT_BGCOL) { - g_snprintf(buf, length, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", bgcolor.red, bgcolor.green, bgcolor.blue, text); - strcpy(text, buf); + g_snprintf(tmp, length, "<BODY BGCOLOR=\"#%02X%02X%02X\">%s</BODY>", bgcolor.red, bgcolor.green, bgcolor.blue, buf); + strcpy(buf, tmp); } - g_free(buf); -} \ No newline at end of file + return buf; +}