Mercurial > pidgin.yaz
changeset 1764:1e0613d9526b
[gaim-migrate @ 1774]
I decided to do the time stamp w/ messages thing that Eric put in the TODO list.
committer: Tailor Script <tailor@pidgin.im>
author | Rob Flynn <gaim@robflynn.com> |
---|---|
date | Fri, 27 Apr 2001 23:26:19 +0000 |
parents | 5ad0b0c3ea01 |
children | 2aab66c7a007 |
files | TODO plugins/icq/gaim_icq.c plugins/irc.c plugins/jabber/jabber.c plugins/msn/msn.c plugins/napster.c plugins/yay/yay.c plugins/zephyr/zephyr.c src/buddy.c src/buddy_chat.c src/conversation.c src/gaim.h src/oscar.c src/perl.c src/server.c src/toc.c |
diffstat | 16 files changed, 62 insertions(+), 55 deletions(-) [+] |
line wrap: on
line diff
--- a/TODO Fri Apr 27 22:21:53 2001 +0000 +++ b/TODO Fri Apr 27 23:26:19 2001 +0000 @@ -32,9 +32,6 @@ all of the custom messages, e.g. in Jabber it'd return "Away/" as one of the states, and you'd see "Away" with a menu of all the away messages you have. - Modify serv_got_im/serv_got_chat_in to take a time_t timestamp argument, as - well as write_to_conv to display the correct timestamp. Needed for - Yahoo, ICQ, Jabber, possibly others. Syd is cool and gave all of these ideas: Have multiple tickers in the same window, one for buddies
--- a/plugins/icq/gaim_icq.c Fri Apr 27 22:21:53 2001 +0000 +++ b/plugins/icq/gaim_icq.c Fri Apr 27 23:26:19 2001 +0000 @@ -125,7 +125,8 @@ char buf[256], *tmp = g_malloc(BUF_LONG); g_snprintf(tmp, BUF_LONG, "%s", data); g_snprintf(buf, sizeof buf, "%lu", uin); - serv_got_im(gc, buf, tmp, 0); + /* FIXME EWIC */ + serv_got_im(gc, buf, tmp, 0, time((time_t)NULL)); g_free(tmp); } @@ -180,7 +181,8 @@ char *msg = g_malloc(BUF_LONG), buf[256]; g_snprintf(msg, BUF_LONG, "<A HREF=\"%s\">%s</A>", url, descr); g_snprintf(buf, 256, "%lu", uin); - serv_got_im(gc, buf, msg, 0); + /* FIXME EWIC */ + serv_got_im(gc, buf, msg, 0, time((time_t)NULL)); g_free(msg); } @@ -219,7 +221,8 @@ char *who = g_strdup_printf("ICQ Web Pager: %s (%s)", nick, email); char *what = g_malloc(BUF_LONG); g_snprintf(what, BUF_LONG, "%s", msg); - serv_got_im(gc, who, what, 0); + /* FIXME EWIC */ + serv_got_im(gc, who, what, 0, time((time_t)NULL)); g_free(who); g_free(what); } @@ -231,7 +234,8 @@ char *who = g_strdup_printf("ICQ Mail Express: %s (%s)", nick, email); char *what = g_malloc(BUF_LONG); g_snprintf(what, BUF_LONG, "%s", msg); - serv_got_im(gc, who, what, 0); + /* FIXME EWIC */ + serv_got_im(gc, who, what, 0, time((time_t)NULL)); g_free(who); g_free(what); }
--- a/plugins/irc.c Fri Apr 27 22:21:53 2001 +0000 +++ b/plugins/irc.c Fri Apr 27 23:26:19 2001 +0000 @@ -461,7 +461,7 @@ /* Since AIM expects us to receive the message we send, we gotta fake it */ if (is_command==FALSE) - serv_got_chat_in(gc, id, gc->username, 0, message); + serv_got_chat_in(gc, id, gc->username, 0, message, time((time_t)NULL)); g_free(buf); @@ -586,7 +586,7 @@ res = g_strsplit(buf, " ", 5); if (!strcmp(res[1], "301")) - serv_got_im(gc, res[3], res[4] + 1, 1); + serv_got_im(gc, res[3], res[4] + 1, 1, time((time_t)NULL)); g_strfreev(res); } @@ -1100,11 +1100,11 @@ id = find_id_by_name(gc, u_channel); if (id != -1) { - serv_got_chat_in(gc, id, u_nick, 0, u_message); + serv_got_chat_in(gc, id, u_nick, 0, u_message, time((time_t)NULL)); } } else { /* Nope. Let's treat it as a private message */ - serv_got_im(gc, u_nick, u_message, 0); + serv_got_im(gc, u_nick, u_message, 0, time((time_t)NULL)); } return;
--- a/plugins/jabber/jabber.c Fri Apr 27 22:21:53 2001 +0000 +++ b/plugins/jabber/jabber.c Fri Apr 27 23:26:19 2001 +0000 @@ -509,7 +509,8 @@ } g_snprintf(m, sizeof(m), "%s", msg); - serv_got_im(GJ_GC(j), from, m, 0); + /* FIXME EWIC */ + serv_got_im(GJ_GC(j), from, m, 0, time((time_t)NULL)); if (!same) g_free(from); @@ -562,12 +563,13 @@ msg = xmlnode_get_data(y); g_snprintf(buf, sizeof(buf), "%s now has status: %s", p->from->resource, msg); - write_to_conv(b, buf, WFLAG_SYSTEM, NULL); + write_to_conv(b, buf, WFLAG_SYSTEM, NULL, time((time_t)NULL)); } } else if (msg) { char buf[8192]; g_snprintf(buf, sizeof(buf), "%s", msg); - serv_got_chat_in(GJ_GC(j), b->id, p->from->resource, 0, buf); + /* FIXME EWIC */ + serv_got_chat_in(GJ_GC(j), b->id, p->from->resource, 0, buf, time((time_t)NULL)); } /* } else if (msg) { @@ -702,7 +704,7 @@ char *msg = xmlnode_get_data(y); g_snprintf(buf, sizeof(buf), "%s now has status: %s", p->from->resource, msg); - write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL); + write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL, time((time_t)NULL)); } } }
--- a/plugins/msn/msn.c Fri Apr 27 22:21:53 2001 +0000 +++ b/plugins/msn/msn.c Fri Apr 27 23:26:19 2001 +0000 @@ -523,7 +523,7 @@ * of course, the header. */ g_snprintf(rahc, sizeof(rahc), "%s", strstr(msgdata, "\r\n\r\n") + 4); - serv_got_im(gc, res[1], rahc, 0); + serv_got_im(gc, res[1], rahc, 0, time((time_t)NULL)); g_strfreev(res); g_free(msgdata);
--- a/plugins/napster.c Fri Apr 27 22:21:53 2001 +0000 +++ b/plugins/napster.c Fri Apr 27 23:26:19 2001 +0000 @@ -570,7 +570,7 @@ if (command == 0xCD) { res = g_strsplit(buf, " ", 1); - serv_got_im(gc, res[0], res[1], 0); + serv_got_im(gc, res[0], res[1], 0, time((time_t)NULL)); g_strfreev(res); free(buf); return; @@ -643,7 +643,7 @@ channel = find_channel_by_name(gc, res[0]); if (channel) - serv_got_chat_in(gc, channel->id, res[1], 0, res[2]); + serv_got_chat_in(gc, channel->id, res[1], 0, res[2], time((time_t)NULL)); g_strfreev(res); free(buf);
--- a/plugins/yay/yay.c Fri Apr 27 22:21:53 2001 +0000 +++ b/plugins/yay/yay.c Fri Apr 27 23:26:19 2001 +0000 @@ -165,7 +165,7 @@ g_free(tmp); - serv_got_im(gc, nick, buf, 0); + serv_got_im(gc, nick, buf, 0, tm ? tm : time((time_t)NULL)); return 1; }
--- a/plugins/zephyr/zephyr.c Fri Apr 27 22:21:53 2001 +0000 +++ b/plugins/zephyr/zephyr.c Fri Apr 27 23:26:19 2001 +0000 @@ -302,7 +302,7 @@ len = MAX(BUF_LONG, strlen(buf2)); buf = g_malloc(len + 1); g_snprintf(buf, len + 1, "%s", buf2); - serv_got_im(zgc, notice.z_sender, buf, 0); + serv_got_im(zgc, notice.z_sender, buf, 0, time((time_t)NULL)); g_free(buf); } g_free(buf2);
--- a/src/buddy.c Fri Apr 27 22:21:53 2001 +0000 +++ b/src/buddy.c Fri Apr 27 23:26:19 2001 +0000 @@ -1729,7 +1729,7 @@ g_slist_index(connections, u->gc)); update_buttons_by_protocol(c); - write_to_conv(c, b->message, WFLAG_SEND, NULL); + write_to_conv(c, b->message, WFLAG_SEND, NULL, time((time_t)NULL)); serv_send_im(u->gc, name, b->message, 0); } if (b->options & OPT_POUNCE_COMMAND) @@ -2275,7 +2275,7 @@ if (c) { char tmp[1024]; g_snprintf(tmp, sizeof(tmp), _("%s logged in."), b->name); - write_to_conv(c, tmp, WFLAG_SYSTEM, NULL); + write_to_conv(c, tmp, WFLAG_SYSTEM, NULL, time((time_t)NULL)); } } bs->sound = 2; @@ -2327,7 +2327,7 @@ if (c) { char tmp[1024]; g_snprintf(tmp, sizeof(tmp), _("%s logged out."), b->name); - write_to_conv(c, tmp, WFLAG_SYSTEM, NULL); + write_to_conv(c, tmp, WFLAG_SYSTEM, NULL, time((time_t)NULL)); } }
--- a/src/buddy_chat.c Fri Apr 27 22:21:53 2001 +0000 +++ b/src/buddy_chat.c Fri Apr 27 23:26:19 2001 +0000 @@ -345,7 +345,7 @@ return FALSE; } -void chat_write(struct conversation *b, char *who, int flag, char *message) +void chat_write(struct conversation *b, char *who, int flag, char *message, time_t mtime) { GList *ignore = b->ignored; char *str; @@ -377,7 +377,7 @@ g_free(str); } - write_to_conv(b, message, flag, who); + write_to_conv(b, message, flag, who, mtime); } @@ -411,7 +411,7 @@ g_snprintf(buf2, sizeof(buf2), "%s->%s", b->gc->username, who); - chat_write(b, buf2, WFLAG_WHISPER, buf); + chat_write(b, buf2, WFLAG_WHISPER, buf, time((time_t)NULL)); gtk_widget_grab_focus(GTK_WIDGET(b->entry)); @@ -542,7 +542,7 @@ if (display_options & OPT_DISP_CHAT_LOGON) { g_snprintf(tmp, sizeof(tmp), _("%s entered the room."), name); - write_to_conv(b, tmp, WFLAG_SYSTEM, NULL); + write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time((time_t)NULL)); } } @@ -605,7 +605,7 @@ if (display_options & OPT_DISP_CHAT_LOGON) { g_snprintf(tmp, sizeof(tmp), _("%s is now known as %s"), old, new); - write_to_conv(b, tmp, WFLAG_SYSTEM, NULL); + write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time((time_t)NULL)); } } @@ -648,7 +648,7 @@ if (display_options & OPT_DISP_CHAT_LOGON) { g_snprintf(tmp, sizeof(tmp), _("%s left the room."), buddy); - write_to_conv(b, tmp, WFLAG_SYSTEM, NULL); + write_to_conv(b, tmp, WFLAG_SYSTEM, NULL, time((time_t)NULL)); } }
--- a/src/conversation.c Fri Apr 27 22:21:53 2001 +0000 +++ b/src/conversation.c Fri Apr 27 23:26:19 2001 +0000 @@ -828,7 +828,7 @@ if (!c->is_chat) { buf3 = g_strdup(buf); - write_to_conv(c, buf3, WFLAG_SEND, NULL); + write_to_conv(c, buf3, WFLAG_SEND, NULL, time((time_t)NULL)); g_free(buf3); serv_send_im(c->gc, c->name, buf, 0); @@ -1266,7 +1266,7 @@ /* this is going to be interesting since the conversation could either be a * normal IM conversation or a chat window. but hopefully it won't matter */ -void write_to_conv(struct conversation *c, char *what, int flags, char *who) +void write_to_conv(struct conversation *c, char *what, int flags, char *who, time_t mtime) { char buf[BUF_LONG]; char *str; @@ -1278,6 +1278,9 @@ int gtk_font_options = 0; GString *logstr; char buf2[BUF_LONG]; + char mdate[64]; + + strftime(mdate, sizeof(mdate), "%H:%M:%S", localtime(&mtime)); gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_COMMENTS; @@ -1313,13 +1316,14 @@ who = b->show; } + if (flags & WFLAG_SYSTEM) { if (general_options & OPT_DISP_SHOW_TIME) - g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s) </FONT><B>%s</B>", date(), what); + g_snprintf(buf, BUF_LONG, "<FONT SIZE=\"2\">(%s) </FONT><B>%s</B>", mdate, what); else - g_snprintf(buf, BUF_LONG, "<B>%s</B>", date(), what); + g_snprintf(buf, BUF_LONG, "<B>%s</B>", mdate, what); g_snprintf(buf2, sizeof(buf2), "<FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B><BR>", - date(), what); + mdate, what); gtk_imhtml_append_text(GTK_IMHTML(c->text), buf2, 0); @@ -1399,11 +1403,11 @@ if (general_options & OPT_DISP_SHOW_TIME) g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><FONT SIZE=\"2\">(%s) </FONT>" - "<B>%s</B></FONT> ", colour, date(), str); + "<B>%s</B></FONT> ", colour, mdate, str); else g_snprintf(buf, BUF_LONG, "<FONT COLOR=\"%s\"><B>%s</B></FONT> ", colour, str); g_snprintf(buf2, BUF_LONG, "<FONT COLOR=\"%s\"><FONT SIZE=\"2\"><!--(%s) --></FONT>" - "<B>%s</B></FONT> ", colour, date(), str); + "<B>%s</B></FONT> ", colour, mdate, str); g_free(str);
--- a/src/gaim.h Fri Apr 27 22:21:53 2001 +0000 +++ b/src/gaim.h Fri Apr 27 23:26:19 2001 +0000 @@ -547,7 +547,7 @@ /* Functions in buddy_chat.c */ extern void join_chat(); -extern void chat_write(struct conversation *, char *, int, char *); +extern void chat_write(struct conversation *, char *, int, char *, time_t); extern void add_chat_buddy(struct conversation *, char *); extern void remove_chat_buddy(struct conversation *, char *); extern void show_new_buddy_chat(struct conversation *); @@ -636,17 +636,17 @@ /* output from serv */ extern void serv_got_update(struct gaim_connection *, char *, int, int, time_t, time_t, int, gushort); -extern void serv_got_im(struct gaim_connection *, char *, char *, int); +extern void serv_got_im(struct gaim_connection *, char *, char *, int, time_t); extern void serv_got_eviled(struct gaim_connection *, char *, int); extern void serv_got_chat_invite(struct gaim_connection *, char *, int, char *, char *); extern void serv_got_joined_chat(struct gaim_connection *, int, char *); extern void serv_got_chat_left(struct gaim_connection *, int); -extern void serv_got_chat_in(struct gaim_connection *, int, char *, int, char *); +extern void serv_got_chat_in(struct gaim_connection *, int, char *, int, char *, time_t); /* Functions in conversation.c */ extern void update_convo_add_button(struct conversation *); extern void write_html_with_smileys(GtkWidget *, GtkWidget *, char *); -extern void write_to_conv(struct conversation *, char *, int, char *); +extern void write_to_conv(struct conversation *, char *, int, char *, time_t); extern void show_conv(struct conversation *); extern struct conversation *new_conversation(char *); extern struct conversation *find_conversation(char *);
--- a/src/oscar.c Fri Apr 27 22:21:53 2001 +0000 +++ b/src/oscar.c Fri Apr 27 23:26:19 2001 +0000 @@ -957,7 +957,7 @@ if (!(dim->cnv = find_conversation(dim->name))) dim->cnv = new_conversation(dim->name); g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name); - write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL); + write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL, time((time_t)NULL)); gtk_signal_connect(GTK_OBJECT(dim->cnv->window), "destroy", GTK_SIGNAL_FUNC(delete_direct_im), dim); @@ -1317,7 +1317,7 @@ va_end(ap); g_snprintf(tmp, BUF_LONG, "%s", msg); - serv_got_im(gc, userinfo->sn, tmp, icbmflags & AIM_IMFLAGS_AWAY); + serv_got_im(gc, userinfo->sn, tmp, icbmflags & AIM_IMFLAGS_AWAY, time((time_t)NULL)); g_free(tmp); } else if (channel == 2) { struct aim_userinfo_s *userinfo; @@ -1719,7 +1719,7 @@ tmp = g_malloc(BUF_LONG); g_snprintf(tmp, BUF_LONG, "%s", msg); - serv_got_chat_in(gc, b->id, info->sn, 0, tmp); + serv_got_chat_in(gc, b->id, info->sn, 0, tmp, time((time_t)NULL)); g_free(tmp); return 1; @@ -2224,7 +2224,7 @@ dim->watcher = gdk_input_add(dim->conn->fd, GDK_INPUT_READ | GDK_INPUT_EXCEPTION, oscar_callback, dim->conn); g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), priv->sn); - write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL); + write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL, time((time_t)NULL)); aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, gaim_directim_incoming, 0); @@ -2254,7 +2254,7 @@ debug_printf("Got DirectIM message from %s\n", priv->sn); - serv_got_im(gc, priv->sn, msg, 0); + serv_got_im(gc, priv->sn, msg, 0, time((time_t)NULL)); return 1; } @@ -2282,7 +2282,7 @@ g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn); if (dim->cnv) - write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL); + write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL, time((time_t)NULL)); aim_conn_kill(sess, &conn);
--- a/src/perl.c Fri Apr 27 22:21:53 2001 +0000 +++ b/src/perl.c Fri Apr 27 23:26:19 2001 +0000 @@ -510,7 +510,7 @@ c = find_conversation(nick); if (!c) c = new_conversation(nick); - write_to_conv(c, what, WFLAG_SEND, NULL); + write_to_conv(c, what, WFLAG_SEND, NULL, time((time_t)NULL)); serv_send_im(c->gc, nick, what, atoi(isauto)); }
--- a/src/server.c Fri Apr 27 22:21:53 2001 +0000 +++ b/src/server.c Fri Apr 27 23:26:19 2001 +0000 @@ -311,7 +311,7 @@ -void serv_got_im(struct gaim_connection *gc, char *name, char *message, int away) +void serv_got_im(struct gaim_connection *gc, char *name, char *message, int away, time_t mtime) { struct conversation *cnv; int new_conv = 0; @@ -370,7 +370,7 @@ if (cnv != NULL) { if (cnv->makesound && (sound_options & OPT_SOUND_RECV)) play_sound(RECEIVE); - write_to_conv(cnv, message, away | WFLAG_RECV, NULL); + write_to_conv(cnv, message, away | WFLAG_RECV, NULL, mtime); } } else { @@ -388,7 +388,7 @@ if (cnv->makesound && (sound_options & OPT_SOUND_RECV)) play_sound(RECEIVE); } - write_to_conv(cnv, message, away | WFLAG_RECV, NULL); + write_to_conv(cnv, message, away | WFLAG_RECV, NULL, mtime); } @@ -414,7 +414,7 @@ serv_send_im(gc, name, away_subs(tmpmsg, alias), 1); if (cnv != NULL) - write_to_conv(cnv, away_subs(tmpmsg, alias), WFLAG_SEND | WFLAG_AUTO, NULL); + write_to_conv(cnv, away_subs(tmpmsg, alias), WFLAG_SEND | WFLAG_AUTO, NULL, mtime); g_free(tmpmsg); } } @@ -723,7 +723,7 @@ g_free(b); } -void serv_got_chat_in(struct gaim_connection *g, int id, char *who, int whisper, char *message) +void serv_got_chat_in(struct gaim_connection *g, int id, char *who, int whisper, char *message, time_t mtime) { int w; GSList *bcs = g->buddy_chats; @@ -752,7 +752,7 @@ else w = 0; - chat_write(b, who, w, message); + chat_write(b, who, w, message, mtime); } void send_keepalive(gpointer d)
--- a/src/toc.c Fri Apr 27 22:21:53 2001 +0000 +++ b/src/toc.c Fri Apr 27 23:26:19 2001 +0000 @@ -411,7 +411,7 @@ a = (away && (*away == 'T')) ? 1 : 0; - serv_got_im(gc, c, message, a); + serv_got_im(gc, c, message, a, time((time_t)NULL)); } else if (!strcasecmp(c, "UPDATE_BUDDY")) { char *l, *uc; int logged, evil, idle, type = 0; @@ -484,7 +484,7 @@ w = (whisper && (*whisper == 'T')) ? 1 : 0; - serv_got_chat_in(gc, id, who, w, m); + serv_got_chat_in(gc, id, who, w, m, time((time_t)NULL)); } else if (!strcasecmp(c, "CHAT_UPDATE_BUDDY")) { int id; char *in, *buddy;