# HG changeset patch # User Todd Kulesza # Date 967177026 0 # Node ID a566fc987db9582068ea22633adb970d435da239 # Parent 4aeb969c70c942d0e791ec73bf2f0aed1de560df [gaim-migrate @ 774] apply default fonts and colors to an away message committer: Tailor Script diff -r 4aeb969c70c9 -r a566fc987db9 src/gaim.h --- 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 */ diff -r 4aeb969c70c9 -r a566fc987db9 src/server.c --- 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); - } + } } diff -r 4aeb969c70c9 -r a566fc987db9 src/util.c --- 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, "%s", fontface, text); + strcpy(text, buf); + } + + if (font_options & OPT_FONT_FGCOL) + { + g_snprintf(buf, length, "%s", fgcolor.red, fgcolor.green, fgcolor.blue, text); + strcpy(text, buf); + } + + if (font_options & OPT_FONT_BGCOL) + { + g_snprintf(buf, length, "%s", bgcolor.red, bgcolor.green, bgcolor.blue, text); + strcpy(text, buf); + } + + g_free(buf); +} \ No newline at end of file