Mercurial > pidgin.yaz
changeset 592:7c75d69a1129
[gaim-migrate @ 602]
this really cool guy sent a patch to convert %n, %d and %t to things in
away messages. i just wish i could remember his name.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 03 Aug 2000 05:35:13 +0000 |
parents | a26eb4c472d8 |
children | 37dd78318a2e |
files | src/gaim.h src/oscar.c src/perl.c src/server.c src/util.c |
diffstat | 5 files changed, 67 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/gaim.h Thu Aug 03 02:05:26 2000 +0000 +++ b/src/gaim.h Thu Aug 03 05:35:13 2000 +0000 @@ -402,7 +402,7 @@ #define TYPE_SIGNOFF 4 #define TYPE_KEEPALIVE 5 -#define REVISION "gaim:$Revision: 600 $" +#define REVISION "gaim:$Revision: 602 $" #define FLAPON "FLAPON\r\n\r\n" #define ROAST "Tic/Toc" @@ -572,6 +572,7 @@ extern char *full_date(); extern void check_gaim_versions(); extern void spell_checker(GtkWidget *); +extern char *away_subs(char *, char *); /* Functions in server.c */ /* input to serv */
--- a/src/oscar.c Thu Aug 03 02:05:26 2000 +0000 +++ b/src/oscar.c Thu Aug 03 05:35:13 2000 +0000 @@ -807,7 +807,8 @@ info->warnlevel, asctime(localtime(&info->onlinesince)), info->idletime, - prof); + infotype == AIM_GETINFO_GENERALINFO ? prof : + away_subs(prof, current_user->username)); g_show_info_text(buf); return 1;
--- a/src/perl.c Thu Aug 03 02:05:26 2000 +0000 +++ b/src/perl.c Thu Aug 03 05:35:13 2000 +0000 @@ -260,7 +260,16 @@ XS (XS_AIM_print) { - /* FIXME */ + char *title; + char *message; + int junk; + dXSARGS; + items = 0; + + title = SvPV(ST(0), junk); + message = SvPV(ST(1), junk); + do_error_dialog(message, title); + XSRETURN(0); } XS (XS_AIM_buddy_list)
--- a/src/server.c Thu Aug 03 02:05:26 2000 +0000 +++ b/src/server.c Thu Aug 03 05:35:13 2000 +0000 @@ -733,13 +733,13 @@ strcpy(tmpmsg, awaymessage->message); escape_text(tmpmsg); escape_message(tmpmsg); - serv_send_im(name, tmpmsg, 1); + serv_send_im(name, away_subs(tmpmsg, name), 1); if (is_idle == -1) is_idle = 1; if (cnv != NULL) - write_to_conv(cnv, awaymessage->message, WFLAG_SEND | WFLAG_AUTO, NULL); + write_to_conv(cnv, away_subs(awaymessage->message, name), WFLAG_SEND | WFLAG_AUTO, NULL); } }
--- a/src/util.c Thu Aug 03 02:05:26 2000 +0000 +++ b/src/util.c Thu Aug 03 05:35:13 2000 +0000 @@ -837,3 +837,54 @@ } +/* Look for %n, %d, or %t in msg, and replace with the sender's name, date, + or time */ +char *away_subs(char *msg, char *name) +{ + char *c; + static char cpy[BUF_LONG]; + int cnt=0; + time_t t = time(0); + struct tm *tme = localtime(&t); + char tmp[20]; + + cpy[0] = '\0'; + c = msg; + while(*c) { + switch(*c) { + case '%': + if (*(c+1)) { + switch (*(c+1)) { + case 'n': + // append name + strcpy (cpy+cnt, name); + cnt += strlen(name); + c++; + break; + case 'd': + // append date + strftime (tmp, 20, "%D", tme); + strcpy (cpy+cnt, tmp); + cnt += strlen(tmp); + c++; + break; + case 't': + // append time + strftime (tmp, 20, "%r", tme); + strcpy (cpy+cnt, tmp); + cnt += strlen(tmp); + c++; + break; + default: + cpy[cnt++]=*c; + } + } + break; + default: + cpy[cnt++]=*c; + } + c++; + } + cpy[cnt]='\0'; + return(cpy); +}