gee
oldstatus
2005-09-19, Nathan Walp
/* Puts last 4k of log in new conversations a la Everybuddy (and then * stolen by Trillian "Pro") */ #include "conversation.h" #define HISTORY_PLUGIN_ID "gtk-history" #define HISTORY_SIZE (4 * 1024) static gboolean _scroll_imhtml_to_end(gpointer data) GtkIMHtml *imhtml = data; gtk_imhtml_scroll_to_end(GTK_IMHTML(imhtml)); g_object_unref(G_OBJECT(imhtml)); static void historize(GaimConversation *c) GaimGtkConversation *gtkconv; GaimConversationType convtype; GtkIMHtmlOptions options = GTK_IMHTML_NO_COLOURS; convtype = gaim_conversation_get_type(c); if (convtype == GAIM_CONV_IM) logs = gaim_log_get_logs(GAIM_LOG_IM, gaim_conversation_get_name(c), gaim_conversation_get_account(c)); else if (convtype == GAIM_CONV_CHAT) logs = gaim_log_get_logs(GAIM_LOG_CHAT, gaim_conversation_get_name(c), gaim_conversation_get_account(c)); history = gaim_log_read((GaimLog*)logs->data, &flags); gtkconv = GAIM_GTK_CONVERSATION(c); if (flags & GAIM_LOG_READ_NO_NEWLINE) options |= GTK_IMHTML_NO_NEWLINE; gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), history, options); gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<hr>", options); g_object_ref(G_OBJECT(gtkconv->imhtml)); g_idle_add(_scroll_imhtml_to_end, gtkconv->imhtml); GaimLog *log = logs->data; plugin_load(GaimPlugin *plugin) gaim_signal_connect(gaim_conversations_get_handle(), plugin, GAIM_CALLBACK(historize), NULL); static GaimPluginInfo info = N_("Shows recently logged conversations in new conversations."), N_("When a new conversation is opened this plugin will insert the last conversation into the current conversation."), "Sean Egan <bj91704@binghamton.edu>", init_plugin(GaimPlugin *plugin) GAIM_INIT_PLUGIN(history, init_plugin, info)