Menu

#9 Better nickname recognition and non-Buddy support

open
nobody
None
5
2008-07-16
2008-07-16
Danny Auble
No

I found with an alias of da all sorts of things would pop up for things that weren't my user name, i.e. date. So this is a patch to make a couple more comparisons to see if it really is your nick. Also if a person wasn't on your buddy list and you were in a room and they say your name you never see it. Here is a fix for that also, which has a toggle associated.

diff pidgin-libnotify.c pidgin-libnotify.c~
35d34
< #include <assert.h>
67,71d65
< "/plugins/gtk/libnotify/buddy",
< _("Only show events from Buddies"));
< purple_plugin_pref_frame_add (frame, ppref);
<
< ppref = purple_plugin_pref_new_with_name_and_label (
276,277c270
< if(contact)
< notification = g_hash_table_lookup (buddy_hash, contact);
---
> notification = g_hash_table_lookup (buddy_hash, contact);
314,317c307,310
< if(contact) {
< g_hash_table_insert (buddy_hash, contact, notification);
< g_object_set_data (G_OBJECT(notification), "contact", contact);
< }
---
> g_hash_table_insert (buddy_hash, contact, notification);
>
> g_object_set_data (G_OBJECT(notification), "contact", contact);
>
399c392
< PurpleBuddy *buddy = NULL;
---
> PurpleBuddy *buddy;
402d394
< gboolean added = 0;
404d395
< blocked = purple_prefs_get_bool ("/plugins/gtk/libnotify/buddy");
406,412c397,398
< if (!buddy) {
< if (blocked)
< return;
< buddy = purple_buddy_new(account, sender, sender);
< added = 1;
< }
<
---
> if (!buddy)
> return;
418,421c404
< if(buddy)
< tr_name = truncate_escape_string (best_name (buddy), 25);
< else
< tr_name = g_strdup (sender);
---
> tr_name = truncate_escape_string (best_name (buddy), 25);
424a408
>
426,427c410
< if(added)
< g_free(buddy);
---
>
473d455
< gchar *nick_var;
476d457
<
480,510c461,462
< nick_var = g_strdup_printf (">%s:", nick);
< if (g_strstr_len (message, strlen(message), nick_var))
< goto print_msg;
<
< g_free (nick_var);
< nick_var = g_strdup_printf (">%s ", nick);
< if (g_strstr_len (message, strlen(message), nick_var))
< goto print_msg;
<
< g_free (nick_var);
< nick_var = g_strdup_printf (" %s:", nick);
< if (g_strstr_len (message, strlen(message), nick_var))
< goto print_msg;
<
< g_free (nick_var);
< nick_var = g_strdup_printf (" %s ", nick);
< if (g_strstr_len (message, strlen(message), nick_var))
< goto print_msg;
<
< g_free (nick_var);
< nick_var = g_strdup_printf (" %s<", nick);
< if (g_strstr_len (message, strlen(message), nick_var))
< goto print_msg;
<
< g_free (nick_var);
< nick_var = g_strdup_printf (">%s<", nick);
< if (g_strstr_len (message, strlen(message), nick_var))
< goto print_msg;
<
< g_free (nick_var);
< return;
---
> if (!g_strstr_len (message, strlen(message), nick))
> return;
512,513d463
< print_msg:
< g_free (nick_var);
628d577
< purple_prefs_add_bool ("/plugins/gtk/libnotify/buddy", FALSE);

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.