# HG changeset patch # User Eric Warmenhoven # Date 987813160 0 # Node ID 00f74db70f2dbb328ae651542e04bbb492088d2f # Parent dd78a230aa069897d52f40d498df7bc594dc1cb3 [gaim-migrate @ 1745] have write_to_conv put on the timestamps for system messages. committer: Tailor Script diff -r dd78a230aa06 -r 00f74db70f2d plugins/jabber/jabber.c --- a/plugins/jabber/jabber.c Fri Apr 20 23:04:48 2001 +0000 +++ b/plugins/jabber/jabber.c Sat Apr 21 00:32:40 2001 +0000 @@ -560,7 +560,7 @@ else if ((y = xmlnode_get_tag(p->x, "status"))) { char buf[8192]; msg = xmlnode_get_data(y); - g_snprintf(buf, sizeof(buf), "%s now has status: %s", + g_snprintf(buf, sizeof(buf), "%s now has status: %s", p->from->resource, msg); write_to_conv(b, buf, WFLAG_SYSTEM, NULL); } @@ -698,7 +698,7 @@ else if ((y = xmlnode_get_tag(p->x, "status"))) { char buf[8192]; char *msg = xmlnode_get_data(y); - g_snprintf(buf, sizeof(buf), "%s now has status: %s", + g_snprintf(buf, sizeof(buf), "%s now has status: %s", p->from->resource, msg); write_to_conv(cnv, buf, WFLAG_SYSTEM, NULL); } diff -r dd78a230aa06 -r 00f74db70f2d src/buddy.c --- a/src/buddy.c Fri Apr 20 23:04:48 2001 +0000 +++ b/src/buddy.c Sat Apr 21 00:32:40 2001 +0000 @@ -2250,9 +2250,7 @@ struct conversation *c = find_conversation(b->name); if (c) { char tmp[1024]; - g_snprintf(tmp, sizeof(tmp), _("%s logged in%s%s."), b->name, - ((display_options & OPT_DISP_SHOW_TIME) ? " @ " : ""), - ((display_options & OPT_DISP_SHOW_TIME) ? date() : "")); + g_snprintf(tmp, sizeof(tmp), _("%s logged in."), b->name); write_to_conv(c, tmp, WFLAG_SYSTEM, NULL); } } @@ -2304,9 +2302,7 @@ struct conversation *c = find_conversation(b->name); if (c) { char tmp[1024]; - g_snprintf(tmp, sizeof(tmp), _("%s logged out%s%s."), b->name, - ((display_options & OPT_DISP_SHOW_TIME) ? " @ " : ""), - ((display_options & OPT_DISP_SHOW_TIME) ? date() : "")); + g_snprintf(tmp, sizeof(tmp), _("%s logged out."), b->name); write_to_conv(c, tmp, WFLAG_SYSTEM, NULL); } } diff -r dd78a230aa06 -r 00f74db70f2d src/buddy_chat.c --- a/src/buddy_chat.c Fri Apr 20 23:04:48 2001 +0000 +++ b/src/buddy_chat.c Sat Apr 21 00:32:40 2001 +0000 @@ -541,12 +541,7 @@ play_sound(CHAT_JOIN); if (display_options & OPT_DISP_CHAT_LOGON) { - if (display_options & OPT_DISP_SHOW_TIME) - g_snprintf(tmp, sizeof(tmp), - _("(%s) %s entered the room."), - date(), name); - else - g_snprintf(tmp, sizeof(tmp), _("%s entered the room."), name); + g_snprintf(tmp, sizeof(tmp), _("%s entered the room."), name); write_to_conv(b, tmp, WFLAG_SYSTEM, NULL); } } @@ -609,12 +604,7 @@ gtk_widget_show(list_item); if (display_options & OPT_DISP_CHAT_LOGON) { - if (display_options & OPT_DISP_SHOW_TIME) - g_snprintf(tmp, sizeof(tmp), - _("(%s) %s is now known as %s."), - date(), old, new); - else - g_snprintf(tmp, sizeof(tmp), _("%s is now known as %s"), old, new); + g_snprintf(tmp, sizeof(tmp), _("%s is now known as %s"), old, new); write_to_conv(b, tmp, WFLAG_SYSTEM, NULL); } } @@ -657,12 +647,7 @@ play_sound(CHAT_LEAVE); if (display_options & OPT_DISP_CHAT_LOGON) { - if (display_options & OPT_DISP_SHOW_TIME) - g_snprintf(tmp, sizeof(tmp), - _("(%s) %s left the room."), - date(), buddy); - else - g_snprintf(tmp, sizeof(tmp), _("%s left the room."), buddy); + g_snprintf(tmp, sizeof(tmp), _("%s left the room."), buddy); write_to_conv(b, tmp, WFLAG_SYSTEM, NULL); } } diff -r dd78a230aa06 -r 00f74db70f2d src/conversation.c --- a/src/conversation.c Fri Apr 20 23:04:48 2001 +0000 +++ b/src/conversation.c Sat Apr 21 00:32:40 2001 +0000 @@ -1266,16 +1266,16 @@ * 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) { - char *buf = g_malloc(BUF_LONG); + char buf[BUF_LONG]; char *str; FILE *fd; char colour[10]; int colorv = -1; char *clr; - char *smiley = g_malloc(7); struct buddy *b; int gtk_font_options = 0; GString *logstr; + char buf2[BUF_LONG]; gtk_font_options = gtk_font_options ^ GTK_IMHTML_NO_COMMENTS; @@ -1312,18 +1312,22 @@ } if (flags & WFLAG_SYSTEM) { + if (general_options & OPT_DISP_SHOW_TIME) + g_snprintf(buf, BUF_LONG, "(%s) %s", date(), what); + else + g_snprintf(buf, BUF_LONG, "%s", date(), what); + g_snprintf(buf2, sizeof(buf2), "%s
", + date(), what); - gtk_imhtml_append_text(GTK_IMHTML(c->text), what, 0); - - gtk_imhtml_append_text(GTK_IMHTML(c->text), "
", 0); + gtk_imhtml_append_text(GTK_IMHTML(c->text), buf2, 0); if (logging_options & OPT_LOG_STRIP_HTML) { - char *t1 = strip_html(what); + char *t1 = strip_html(buf); c->history = g_string_append(c->history, t1); c->history = g_string_append(c->history, "\n"); g_free(t1); } else { - c->history = g_string_append(c->history, what); + c->history = g_string_append(c->history, buf); c->history = g_string_append(c->history, "
\n"); } @@ -1332,9 +1336,9 @@ char nm[256]; if (logging_options & OPT_LOG_STRIP_HTML) { - t1 = strip_html(what); + t1 = strip_html(buf); } else { - t1 = what; + t1 = buf; } if (c->is_chat) g_snprintf(nm, 256, "%s.chat", c->name); @@ -1355,7 +1359,6 @@ } } else { - char buf2[BUF_LONG]; if ((clr = strstr(what, "unseen = TRUE; } - - g_free(smiley); - g_free(buf); } diff -r dd78a230aa06 -r 00f74db70f2d src/oscar.c --- a/src/oscar.c Fri Apr 20 23:04:48 2001 +0000 +++ b/src/oscar.c Sat Apr 21 00:32:40 2001 +0000 @@ -855,7 +855,7 @@ char buf[256]; 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); + g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), dim->name); write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL); gtk_signal_connect(GTK_OBJECT(dim->cnv->window), "destroy", @@ -2122,7 +2122,7 @@ dim->conn = newconn; 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); + g_snprintf(buf, sizeof buf, _("Direct IM with %s established"), priv->sn); write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL); aim_conn_addhandler(sess, newconn, AIM_CB_FAM_OFT, AIM_CB_OFT_DIRECTIMINCOMING, @@ -2179,7 +2179,7 @@ gdk_input_remove(dim->watcher); gtk_signal_disconnect_by_data(GTK_OBJECT(dim->cnv->window), dim); - g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn); + g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn); if (dim->cnv) write_to_conv(dim->cnv, buf, WFLAG_SYSTEM, NULL);