--- a/ChangeLog Thu Jul 03 07:39:46 2008 -0400
+++ b/ChangeLog Thu Jul 03 08:14:49 2008 -0400
@@ -11,6 +11,7 @@
* Added preferences to the irssi plugin that allow changing its behavior
* Fixed the preference strings in slashexec so mnemonics are no longer
incorrectly interpreted from the strings.
+ * Added Message Length plugin * Fixed a typo in irc-more's source that allowed a potential double-free
--- a/msglen/msglen.c Thu Jul 03 07:39:46 2008 -0400
+++ b/msglen/msglen.c Thu Jul 03 08:14:49 2008 -0400
@@ -67,6 +67,18 @@
+static void msg_len_update(PidginWindow *win, PurpleConversation *conv); +msg_len_key_released_cb(GtkWidget *w, GdkEventKey *e, gpointer d) { + MsgLenData *mld = (MsgLenData *)d; + msg_len_update(mld->win, mld->conv); msg_len_update(PidginWindow *win, PurpleConversation *conv) {
PidginConversation *gtkconv = NULL;
@@ -77,13 +89,15 @@
+ gtkconv = PIDGIN_CONVERSATION(conv); mld = g_hash_table_lookup(data, conv);
mld = g_new0(MsgLenData, 1);
mld->label = gtk_label_new("");
pidgin_menu_tray_append(PIDGIN_MENU_TRAY(win->menu.tray), mld->label,
@@ -92,45 +106,41 @@
g_signal_connect_swapped(G_OBJECT(mld->label), "destroy",
G_CALLBACK(g_nullify_pointer), &mld->label);
+ g_signal_connect(G_OBJECT(gtkconv->entry), "key-release-event", + G_CALLBACK(msg_len_key_released_cb), mld);
- gtkconv = PIDGIN_CONVERSATION(conv);
count = gtk_text_buffer_get_char_count(gtkconv->entry_buffer);
text = g_strdup_printf("%d", count);
gtk_label_set_text(GTK_LABEL(mld->label), text);
- g_hash_table_insert(data, win, mld);
+ g_hash_table_insert(data, conv, mld); /******************************************************************************
*****************************************************************************/
-msg_len_conv_created_cb(PurpleConversation *conv, gpointer data) {
+msg_len_conv_created_cb(PurpleConversation *conv, gpointer d) { PidginConversation *pconv = PIDGIN_CONVERSATION(conv);
PidginWindow *win = pidgin_conv_get_window(pconv);
- purple_debug_info("msglen", "created\n");
msg_len_update(win, conv);
-msg_len_conv_destroyed_cb(PurpleConversation *conv, gpointer data) {
- purple_debug_info("msglen", "destroyed\n");
+msg_len_conv_destroyed_cb(PurpleConversation *conv, gpointer d) { + g_hash_table_remove(data, conv); -msg_len_conv_switched_cb(PurpleConversation *conv, gpointer data) {
+msg_len_conv_switched_cb(PurpleConversation *conv, gpointer d) { PidginConversation *pconv = PIDGIN_CONVERSATION(conv);
PidginWindow *win = pidgin_conv_get_window(pconv);
- purple_debug_info("msglen", "switched\n");
msg_len_update(win, conv);
@@ -139,6 +149,7 @@
*****************************************************************************/
plugin_load(PurplePlugin *plugin) {
void *conv_handle = purple_conversations_get_handle();
data = g_hash_table_new_full(g_direct_hash, g_direct_equal,
@@ -153,6 +164,13 @@
"conversation-switched", plugin,
PURPLE_CALLBACK(msg_len_conv_switched_cb), NULL);
+ for(convs = purple_get_conversations(); convs; convs = convs->next) { + PurpleConversation *conv = (PurpleConversation *)convs->data; + PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); + msg_len_update(gtkconv->win, conv); @@ -215,3 +233,4 @@
PURPLE_INIT_PLUGIN(msg_len, init_plugin, info)
--- a/msglen/plugins.cfg Thu Jul 03 07:39:46 2008 -0400
+++ b/msglen/plugins.cfg Thu Jul 03 08:14:49 2008 -0400
@@ -1,5 +1,5 @@
summary=Shows the length of your current message in the menu tray