=== modified file 'debian/changelog' --- debian/changelog 2009-02-19 18:52:30 +0000 +++ debian/changelog 2009-03-03 20:29:40 +0000 @@ -1,3 +1,19 @@ +pidgin-libnotify (0.14-1ubuntu3) jaunty; urgency=low + + * Updates to debian/patches/indicate.patch + * Support the truncate capability and don't truncate strings + if it is given. (LP: #162078) + * Remove debugging messages that were causing static and make + the other ones hide with standard Pidgin calls (LP: #335907) + * Modifing to not need buddies, so use the conversation name + for the title of the notification or indicator. This includes + the name of the person sending the message. This makes it so + that IRC works as expected. (LP: #337407) + * Doing an upload in main to update rosetta translations. + (LP: #336609) + + -- Ted Gould Sun, 22 Feb 2009 22:28:18 -0600 + pidgin-libnotify (0.14-1ubuntu2) jaunty; urgency=low * Added debian/patches/force-load.patch which makes the plugin load === modified file 'debian/patches/indicate.patch' --- debian/patches/indicate.patch 2009-02-19 14:38:37 +0000 +++ debian/patches/indicate.patch 2009-03-03 17:36:14 +0000 @@ -1,8 +1,6 @@ === modified file 'configure.ac' -Index: pidgin-libnotify-0.14/configure.ac -=================================================================== ---- pidgin-libnotify-0.14.orig/configure.ac 2008-12-14 18:25:03.000000000 +0100 -+++ pidgin-libnotify-0.14/configure.ac 2009-02-19 14:31:41.000000000 +0100 +--- old/configure.ac 2009-01-31 14:57:15 +0000 ++++ new/configure.ac 2009-02-18 22:25:48 +0000 @@ -74,6 +74,15 @@ AC_SUBST(LIBNOTIFY_LIBS) @@ -19,10 +17,10 @@ # Check for GTK+ # PKG_CHECK_MODULES(GTK, gtk+-2.0) -Index: pidgin-libnotify-0.14/src/Makefile.am -=================================================================== ---- pidgin-libnotify-0.14.orig/src/Makefile.am 2007-06-30 19:51:16.000000000 +0200 -+++ pidgin-libnotify-0.14/src/Makefile.am 2009-02-19 14:31:41.000000000 +0100 + +=== modified file 'src/Makefile.am' +--- old/src/Makefile.am 2008-10-14 11:11:34 +0000 ++++ new/src/Makefile.am 2009-02-18 22:25:48 +0000 @@ -10,7 +10,7 @@ pidgin-libnotify.c \ gln_intl.h @@ -40,11 +38,11 @@ $(DBUS_CFLAGS) \ $(GTK_CFLAGS) -Index: pidgin-libnotify-0.14/src/pidgin-libnotify.c -=================================================================== ---- pidgin-libnotify-0.14.orig/src/pidgin-libnotify.c 2009-02-19 14:31:41.000000000 +0100 -+++ pidgin-libnotify-0.14/src/pidgin-libnotify.c 2009-02-19 14:31:41.000000000 +0100 -@@ -35,15 +35,28 @@ + +=== modified file 'src/pidgin-libnotify.c' +--- old/src/pidgin-libnotify.c 2009-01-31 14:57:15 +0000 ++++ new/src/pidgin-libnotify.c 2009-03-03 17:31:26 +0000 +@@ -35,15 +35,29 @@ /* for pidgin_create_prpl_icon */ #include @@ -67,13 +65,14 @@ +static gboolean notify_supports_actions = FALSE; +static gboolean notify_supports_append = FALSE; ++static gboolean notify_supports_truncation = FALSE; + +static IndicateServer * indicate_server = NULL; + static PurplePluginPrefFrame * get_plugin_pref_frame (PurplePlugin *plugin) { -@@ -177,7 +190,7 @@ +@@ -177,7 +191,7 @@ PurpleConversation *conv = NULL; purple_debug_info (PLUGIN_ID, "action_cb(), " @@ -82,7 +81,7 @@ buddy = (PurpleBuddy *)g_object_get_data (G_OBJECT(notification), "buddy"); -@@ -203,7 +216,7 @@ +@@ -203,7 +217,7 @@ { PurpleContact *contact; @@ -91,7 +90,16 @@ contact = (PurpleContact *)g_object_get_data (G_OBJECT(notification), "contact"); if (contact) -@@ -257,7 +270,8 @@ +@@ -222,7 +236,7 @@ + { + gchar *escaped_str; + +- if (g_utf8_strlen (str, num_chars*2+1) > num_chars) { ++ if (!notify_supports_truncation && g_utf8_strlen (str, num_chars*2+1) > num_chars) { + gchar *truncated_str; + gchar *str2; + +@@ -257,31 +271,47 @@ static void notify (const gchar *title, const gchar *body, @@ -100,15 +108,29 @@ + gboolean append) { NotifyNotification *notification = NULL; - GdkPixbuf *icon; -@@ -272,10 +286,23 @@ +- GdkPixbuf *icon; +- PurpleBuddyIcon *buddy_icon; +- gchar *tr_body; +- PurpleContact *contact; ++ GdkPixbuf *icon = NULL; ++ PurpleBuddyIcon *buddy_icon = NULL; ++ gchar *tr_body = NULL; ++ PurpleContact *contact = NULL; + +- contact = purple_buddy_get_contact (buddy); ++ if (buddy != NULL) { ++ contact = purple_buddy_get_contact (buddy); ++ } + + if (body) + tr_body = truncate_escape_string (body, 60); else tr_body = NULL; - notification = g_hash_table_lookup (buddy_hash, contact); + /* If we're appending we shouldn't update an already + existing notification */ -+ if (!append) { ++ if (!append && contact != NULL) { + notification = g_hash_table_lookup (buddy_hash, contact); + } @@ -126,10 +148,24 @@ /* this shouldn't be necessary, file a bug */ notify_notification_show (notification, NULL); -@@ -293,6 +320,14 @@ + purple_debug_info (PLUGIN_ID, "notify(), update: " + "title: '%s', body: '%s', buddy: '%s'\n", +- title, tr_body, best_name (buddy)); ++ title, tr_body, buddy != NULL ? best_name (buddy) : "(null)"); + + g_free (tr_body); + return; +@@ -289,27 +319,42 @@ + notification = notify_notification_new (title, tr_body, NULL, NULL); + purple_debug_info (PLUGIN_ID, "notify(), new: " + "title: '%s', body: '%s', buddy: '%s'\n", +- title, tr_body, best_name (buddy)); ++ title, tr_body, buddy != NULL ? best_name (buddy) : "(null)"); g_free (tr_body); +- buddy_icon = purple_buddy_get_icon (buddy); +- if (buddy_icon) { + if (notify_supports_append) { + if (append) { + notify_notification_set_hint_string(notification, "append", "allow"); @@ -138,10 +174,38 @@ + } + } + - buddy_icon = purple_buddy_get_icon (buddy); - if (buddy_icon) { ++ if (buddy != NULL) { ++ buddy_icon = purple_buddy_get_icon (buddy); ++ } ++ ++ if (buddy_icon != NULL) { icon = pixbuf_from_buddy_icon (buddy_icon); -@@ -318,7 +353,9 @@ + purple_debug_info (PLUGIN_ID, "notify(), has a buddy icon.\n"); + } else { +- icon = pidgin_create_prpl_icon (buddy->account, 1); +- purple_debug_info (PLUGIN_ID, "notify(), has a prpl icon.\n"); ++ if (buddy != NULL) { ++ icon = pidgin_create_prpl_icon (buddy->account, 1); ++ purple_debug_info (PLUGIN_ID, "notify(), has a prpl icon.\n"); ++ } + } + +- if (icon) { ++ if (icon != NULL) { + notify_notification_set_icon_from_pixbuf (notification, icon); + g_object_unref (icon); + } else { + purple_debug_warning (PLUGIN_ID, "notify(), couldn't find any icon!\n"); + } + +- g_hash_table_insert (buddy_hash, contact, notification); ++ if (contact != NULL) { ++ g_hash_table_insert (buddy_hash, contact, notification); ++ } + + g_object_set_data (G_OBJECT(notification), "contact", contact); + +@@ -317,7 +362,9 @@ notify_notification_set_urgency (notification, NOTIFY_URGENCY_NORMAL); @@ -152,7 +216,7 @@ if (!notify_notification_show (notification, NULL)) { purple_debug_error (PLUGIN_ID, "notify(), failed to send notification\n"); -@@ -330,7 +367,7 @@ +@@ -329,7 +376,7 @@ notify_buddy_signon_cb (PurpleBuddy *buddy, gpointer data) { @@ -161,7 +225,7 @@ gboolean blocked; g_return_if_fail (buddy); -@@ -350,19 +387,16 @@ +@@ -349,19 +396,16 @@ tr_name = truncate_escape_string (best_name (buddy), 25); @@ -183,7 +247,7 @@ gboolean blocked; g_return_if_fail (buddy); -@@ -382,12 +416,9 @@ +@@ -381,40 +425,56 @@ tr_name = truncate_escape_string (best_name (buddy), 25); @@ -197,20 +261,58 @@ } static void -@@ -396,7 +427,7 @@ - const gchar *message) + notify_msg_sent (PurpleAccount *account, + const gchar *sender, +- const gchar *message) ++ const gchar *message, ++ PurpleConversation * conv) { - PurpleBuddy *buddy; +- PurpleBuddy *buddy; - gchar *title, *body, *tr_name; -+ gchar *body, *tr_name; ++ PurpleBuddy *buddy = NULL; ++ gchar *body = NULL, *tr_name = NULL; gboolean blocked; ++ blocked = purple_prefs_get_bool ("/plugins/gtk/libnotify/blocked"); ++ if (!purple_privacy_check(account, sender) && blocked) ++ return; ++ buddy = purple_find_buddy (account, sender); -@@ -409,13 +440,11 @@ - - tr_name = truncate_escape_string (best_name (buddy), 25); - +- if (!buddy) +- return; +- +- blocked = purple_prefs_get_bool ("/plugins/gtk/libnotify/blocked"); +- if (!purple_privacy_check(account, sender) && blocked) +- return; +- +- tr_name = truncate_escape_string (best_name (buddy), 25); +- - title = g_strdup_printf (_("%s says:"), tr_name); ++ ++ if (buddy != NULL) { ++ tr_name = truncate_escape_string (best_name (buddy), 25); ++ } else { ++ if (conv != NULL) { ++ const gchar * temp = purple_conversation_get_title(conv); ++ if (temp != NULL) { ++ if (sender == NULL) { ++ tr_name = g_strdup(temp); ++ } else { ++ tr_name = g_strdup_printf("%s (%s)", temp, sender); ++ } ++ } else { ++ if (sender != NULL) { ++ tr_name = g_strdup(sender); ++ } ++ } ++ } ++ } ++ ++ if (tr_name == NULL) { ++ purple_debug_warning(PLUGIN_ID, "Unable to find a title for the notification"); ++ return; ++ } ++ body = purple_markup_strip_html (message); - notify (title, body, buddy); @@ -221,7 +323,7 @@ g_free (body); } -@@ -435,19 +464,38 @@ +@@ -434,20 +494,39 @@ #ifndef DEBUG /* in debug mode, always show notifications */ if (conv && purple_conversation_has_focus (conv)) { @@ -238,34 +340,61 @@ + } + + if (conv == NULL) { -+ g_warning("Notify Message send has NULL Conversation, assuming hidden"); ++ purple_debug_warning(PLUGIN_ID, "Notify Message send has NULL Conversation, assuming hidden"); return; } if (!should_notify_unavailable (account)) return; -+ PidginConversation * pconv = PIDGIN_CONVERSATION(conv); -+ if (pconv == NULL) { -+ g_warning("Pidgin Conversation doesn't exist yet."); -+ return; -+ } -+ if (pconv->entry == NULL || pconv->imhtml == NULL) { -+ g_warning("Pidgin Conversation doesn't have widgets yet."); -+ return; -+ } -+ if (GTK_WIDGET_HAS_FOCUS(pconv->entry) || GTK_WIDGET_HAS_FOCUS(pconv->imhtml)) { -+ g_warning("Pidgin conversation's widgets are in focus"); -+ return; -+ } -+ - notify_msg_sent (account, sender, message); - } - -@@ -471,6 +519,225 @@ - } - - static gboolean +- notify_msg_sent (account, sender, message); ++ PidginConversation * pconv = PIDGIN_CONVERSATION(conv); ++ if (pconv == NULL) { ++ purple_debug_warning(PLUGIN_ID, "Pidgin Conversation doesn't exist yet."); ++ return; ++ } ++ if (pconv->entry == NULL || pconv->imhtml == NULL) { ++ purple_debug_warning(PLUGIN_ID, "Pidgin Conversation doesn't have widgets yet."); ++ return; ++ } ++ if (GTK_WIDGET_HAS_FOCUS(pconv->entry) || GTK_WIDGET_HAS_FOCUS(pconv->imhtml)) { ++ purple_debug_warning(PLUGIN_ID, "Pidgin conversation's widgets are in focus"); ++ return; ++ } ++ ++ notify_msg_sent (account, sender, message, conv); + } + + static void +@@ -463,10 +542,278 @@ + if (nick && !strcmp (sender, nick)) + return; + +- if (!g_strstr_len (message, strlen(message), nick)) +- return; +- +- notify_msg_sent (account, sender, message); ++ if (!purple_utf8_has_word (message, nick)) ++ return; ++ ++ PidginConversation * pconv = PIDGIN_CONVERSATION(conv); ++ if (pconv == NULL) { ++ purple_debug_warning(PLUGIN_ID, "Pidgin Conversation doesn't exist yet."); ++ return; ++ } ++ if (pconv->entry == NULL || pconv->imhtml == NULL) { ++ purple_debug_warning(PLUGIN_ID, "Pidgin Conversation doesn't have widgets yet."); ++ return; ++ } ++ if (GTK_WIDGET_HAS_FOCUS(pconv->entry) || GTK_WIDGET_HAS_FOCUS(pconv->imhtml)) { ++ purple_debug_warning(PLUGIN_ID, "Pidgin conversation's widgets are in focus"); ++ return; ++ } ++ ++ notify_msg_sent (account, sender, message, conv); ++} ++ ++static gboolean +indicate_focus_cb (GtkWidget * widget, GdkEventFocus * event, gpointer data) +{ + PurpleConversation * conv = (PurpleConversation *)data; @@ -336,15 +465,15 @@ +void +indicate_show_cb (IndicateIndicator * indicator, PurpleConversation * conv) +{ -+ g_debug ("indicate_show_cb()"); ++ /* g_debug ("indicate_show_cb()"); */ + + if (conv == NULL) { -+ g_warning("\tNULL conversation"); ++ purple_debug_warning(PLUGIN_ID, "\tNULL conversation"); + } + + PidginConversation * gtkconv = PIDGIN_CONVERSATION(conv); + if (gtkconv == NULL) { -+ g_warning("\tNULL Pidgin Conversation"); ++ purple_debug_warning(PLUGIN_ID, "\tNULL Pidgin Conversation"); + } + + pidgin_conv_switch_active_conversation(conv); @@ -361,19 +490,31 @@ + PurpleConversation *conv, + gpointer data) +{ -+ PurpleBuddy *buddy; -+ gchar *tr_name; ++ PurpleBuddy *buddy = NULL; ++ GdkPixbuf *icon = NULL; ++ gchar *tr_name = NULL; ++ PurpleBuddyIcon * buddy_icon = NULL; + -+ g_debug("Entering indicate_chat_nick"); ++ /* g_debug("Entering indicate_chat_nick"); */ + + if (conv == NULL) { -+ g_warning("Conversation is NULL, not sure what to do with that!"); ++ purple_debug_warning(PLUGIN_ID, "Conversation is NULL, not sure what to do with that!"); + return; + } + ++ if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { ++ gchar * nick = (gchar *)purple_conv_chat_get_nick (PURPLE_CONV_CHAT(conv)); ++ if (nick && !strcmp (sender, nick)) ++ return; ++ ++ if (!purple_utf8_has_word (message, nick)) ++ return; ++ } ++ + IndicateIndicatorMessage * indicator = purple_conversation_get_data(conv, "indicate-indicator"); + if (indicator != NULL) { + /* We've already indicated this one, let's set the time */ ++ /* g_debug("Updating indicator time"); */ + GTimeVal time; g_get_current_time(&time); + indicate_indicator_set_property_time(INDICATE_INDICATOR(indicator), "time", &time); + return; @@ -381,38 +522,59 @@ + + PidginConversation * pconv = PIDGIN_CONVERSATION(conv); + if (pconv == NULL) { -+ g_warning("Pidgin Conversation doesn't exist yet."); ++ purple_debug_warning(PLUGIN_ID, "Pidgin Conversation doesn't exist yet."); + return; + } + if (pconv->entry == NULL || pconv->imhtml == NULL) { -+ g_warning("Pidgin Conversation doesn't have widgets yet."); ++ purple_debug_warning(PLUGIN_ID, "Pidgin Conversation doesn't have widgets yet."); + return; + } + if (GTK_WIDGET_HAS_FOCUS(pconv->entry) || GTK_WIDGET_HAS_FOCUS(pconv->imhtml)) { -+ g_warning("Pidgin conversation's widgets are in focus"); -+ return; -+ } -+ -+ if (account == NULL || sender == NULL) { -+ g_warning("We can't create an indicator for an account or a sender that don't exist!"); -+ return; -+ } -+ -+ buddy = purple_find_buddy (account, sender); -+ if (!buddy) { -+ g_warning("Unable to find buddy."); -+ return; -+ } -+ -+ PurpleBuddyIcon * buddy_icon = purple_buddy_get_icon(buddy); -+ GdkPixbuf *icon; -+ if (buddy_icon) { ++ purple_debug_warning(PLUGIN_ID, "Pidgin conversation's widgets are in focus"); ++ return; ++ } ++ ++ if (account != NULL && sender != NULL) { ++ buddy = purple_find_buddy (account, sender); ++ } else { ++ purple_debug_warning(PLUGIN_ID, "We can't create an indicator for an account or a sender that don't exist!"); ++ } ++ ++ if (buddy != NULL) { ++ purple_debug_warning(PLUGIN_ID, "Unable to find buddy."); ++ ++ buddy_icon = purple_buddy_get_icon(buddy); ++ } ++ ++ if (buddy_icon != NULL) { + icon = pixbuf_from_buddy_icon(buddy_icon); + } else { -+ icon = pidgin_create_prpl_icon(buddy->account, 1); -+ } -+ -+ tr_name = truncate_escape_string (best_name (buddy), 25); ++ if (buddy != NULL) { ++ icon = pidgin_create_prpl_icon(buddy->account, 1); ++ } ++ } ++ ++ if (buddy != NULL) { ++ tr_name = truncate_escape_string (best_name (buddy), 25); ++ } else { ++ const gchar * temp = purple_conversation_get_title(conv); ++ if (temp != NULL) { ++ if (sender == NULL) { ++ tr_name = g_strdup(temp); ++ } else { ++ tr_name = g_strdup_printf("%s (%s)", temp, sender); ++ } ++ } else { ++ if (sender != NULL) { ++ tr_name = g_strdup(sender); ++ } ++ } ++ } ++ ++ if (tr_name == NULL) { ++ purple_debug_warning(PLUGIN_ID, "Unable to determine a sender"); ++ return; ++ } + + indicator = indicate_indicator_message_new(); + @@ -465,6 +627,8 @@ + notify_supports_actions = TRUE; + } else if (!strcmp(cap, "append")) { + notify_supports_append = TRUE; ++ } else if (!strcmp(cap, "truncate-string")) { ++ notify_supports_truncation = TRUE; + } else if (!strcmp(cap, "canonical-private-2")) { + notify_supports_append = TRUE; + } @@ -482,20 +646,17 @@ + g_list_free(caps); + + return; -+} -+ -+static gboolean - plugin_load (PurplePlugin *plugin) - { - void *conv_handle, *blist_handle, *conn_handle; -@@ -480,6 +747,15 @@ + } + + static gboolean +@@ -479,6 +826,15 @@ return FALSE; } + notify_check_caps(); + + indicate_server = indicate_server_ref_default(); -+ indicate_server_set_type(indicate_server, "messages.im"); ++ indicate_server_set_type(indicate_server, "messages.instant"); + indicate_server_set_desktop_file(indicate_server, "/usr/share/applications/pidgin.desktop"); + g_signal_connect(G_OBJECT(indicate_server), INDICATE_SERVER_SIGNAL_SERVER_DISPLAY, G_CALLBACK(indicate_server_display), NULL); + pidgin_blist_visibility_manager_add(); @@ -504,7 +665,7 @@ conv_handle = purple_conversations_get_handle (); blist_handle = purple_blist_get_handle (); conn_handle = purple_connections_get_handle(); -@@ -498,6 +774,12 @@ +@@ -497,6 +853,12 @@ purple_signal_connect (conv_handle, "received-chat-msg", plugin, PURPLE_CALLBACK(notify_chat_nick), NULL); @@ -517,7 +678,7 @@ /* used just to not display the flood of guifications we'd get */ purple_signal_connect (conn_handle, "signed-on", plugin, PURPLE_CALLBACK(event_connection_throttle), NULL); -@@ -526,6 +808,12 @@ +@@ -525,6 +887,12 @@ purple_signal_disconnect (conv_handle, "received-chat-msg", plugin, PURPLE_CALLBACK(notify_chat_nick)); @@ -530,7 +691,7 @@ purple_signal_disconnect (conn_handle, "signed-on", plugin, PURPLE_CALLBACK(event_connection_throttle)); -@@ -533,6 +821,10 @@ +@@ -532,6 +900,10 @@ notify_uninit (); @@ -541,3 +702,4 @@ return TRUE; } +