Mercurial > pidgin
changeset 764:a566fc987db9
[gaim-migrate @ 774]
apply default fonts and colors to an away message
committer: Tailor Script <tailor@pidgin.im>
author | Todd Kulesza <fflewddur> |
---|---|
date | Fri, 25 Aug 2000 04:17:06 +0000 |
parents | 4aeb969c70c9 |
children | bf31bf916f53 |
files | src/gaim.h src/server.c src/util.c |
diffstat | 3 files changed, 51 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gaim.h Fri Aug 25 02:59:42 2000 +0000 +++ b/src/gaim.h Fri Aug 25 04:17:06 2000 +0000 @@ -401,7 +401,7 @@ #define TYPE_SIGNOFF 4 #define TYPE_KEEPALIVE 5 -#define REVISION "gaim:$Revision: 764 $" +#define REVISION "gaim:$Revision: 774 $" #define FLAPON "FLAPON\r\n\r\n" #define ROAST "Tic/Toc" @@ -585,6 +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); /* Functions in server.c */ /* input to serv */
--- a/src/server.c Fri Aug 25 02:59:42 2000 +0000 +++ b/src/server.c Fri Aug 25 04:17:06 2000 +0000 @@ -628,12 +628,11 @@ - void serv_got_im(char *name, char *message, int away) { struct conversation *cnv; - int is_idle = -1; - int new_conv = 0; + int is_idle = -1; + int new_conv = 0; #ifdef GAIM_PLUGINS GList *c = callbacks; @@ -658,7 +657,8 @@ #endif if ((general_options & OPT_GEN_TIK_HACK) && awaymessage && - !strcmp(message, ">>>Automated Message: Getting Away Message<<<")) { + !strcmp(message, ">>>Automated Message: Getting Away Message<<<")) + { serv_send_im(name, awaymessage->message, 1); return; } @@ -669,7 +669,8 @@ linkify_text(message); } - if (away) away = WFLAG_AUTO; + if (away) + away = WFLAG_AUTO; if (awaymessage != NULL) { if (!(general_options & OPT_GEN_DISCARD_WHEN_AWAY)) { @@ -701,32 +702,35 @@ - if (awaymessage != NULL) { - time_t t; + if (awaymessage != NULL) { + time_t t; char tmpmsg[BUF_LEN]; - time(&t); + time(&t); - if ((cnv == NULL) || (t - cnv->sent_away) < 120) - return; + if ((cnv == NULL) || (t - cnv->sent_away) < 120) + return; + + cnv->sent_away = t; - cnv->sent_away = t; + if (is_idle) + is_idle = -1; - if (is_idle) - is_idle = -1; - + /* apply default fonts and colors */ + stylize(awaymessage->message, MSG_LEN); + strcpy(tmpmsg, awaymessage->message); escape_text(tmpmsg); escape_message(tmpmsg); - serv_send_im(name, away_subs(tmpmsg, name), 1); + serv_send_im(name, away_subs(tmpmsg, name), 1); - if (is_idle == -1) + if (is_idle == -1) is_idle = 1; - if (cnv != NULL) + if (cnv != NULL) write_to_conv(cnv, away_subs(awaymessage->message, name), WFLAG_SEND | WFLAG_AUTO, NULL); - } + } }
--- a/src/util.c Fri Aug 25 02:59:42 2000 +0000 +++ b/src/util.c Fri Aug 25 04:17:06 2000 +0000 @@ -1106,3 +1106,30 @@ return; } + +void stylize(gchar *text, int length) +{ + gchar *buf; + + buf = g_malloc(length); + + if (font_options & OPT_FONT_FACE) + { + g_snprintf(buf, length, "<FONT FACE=\"%s\">%s</FONT>", fontface, text); + strcpy(text, buf); + } + + 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); + } + + 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_free(buf); +} \ No newline at end of file