More Gaim Alias Fixes



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hey, I've attached a patch which I'll commit if there are no concerns,
it finally cleans up the Gaim alias issue. We were assigning the
speakingto_alias and speakingto_icon values in HitFilter, which was not
passing those changes back as the hit was approved. If we store those
values at index time as opposed to query time, they are stored and
retrieved without issue.

No, I kept most of the logic in place to check for changes to a buddies
alias or icon during the HitFilter, but I think the same problem may
continue, and prevent them from doing much of anything.

Regardless, check it out and let me know what you think.

- --
Cheers,
Kevin Kubasik
240-838-6616
http://kubasik.net/blog
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iQIVAwUBRIQVpP3xZFNDM330AQjrfg//WwfxBhlWPZBLK2AVY2Dk61P1wandfLDI
8WSruyP6fmroTYu0PqMJLmOVVdp+ccJ1/dWBeRhA7z0UpfyS6GTo1SUKncX0o0Dy
KtYIbfnObXnXP3eBohiVN6lP47051vIVi1BFLfns8HW3QTwaA2Hhf5ZezJ1AZLk5
cojJtW2BJ+7hO58nLiy3AQf5D/RLzKaffa+NjBjSOhwive0nPAKyE8fI9MybzzCV
BQejtDQgWqFtu2gv+9pkjn7L4q65we98g1cNTqELUWoKIjXkZ0as8m9k0ZK00LBU
MVOhRK+WiRtuHzS7nPKmjwv6e6gx2QP5hAX4p2lBEFtKY2BNeQ2Bic43q0VRZaoH
+E0CGSddy+WHN1Pi0I5RwwYJFU0WtIAGqhASI2NqeJceTSsMiU9yA5hmOaFhHSB1
IX/QQdXlq6Pn0uhgnBM9TjJsFVLMlPE2hwYLHLQM/qhmXElaT2ky0oN+DGl1WL2C
VFmmtyc7pKdowYsEdzFEHG3vdBqUvVfm/3pnZSiXViFYLtlLYx202BoNgXYpSXWI
Anr9l8tt4Oby4SPb1I3Y3p/uOd3KVBnjitPezejPgkVmF+i+qlhT+DCDpoNTD6IH
x9LTV19i6VNtg0z6KXjRjTGwj8cbXeM7xQY2q5s0z/441zgtkSuLn/TBSmlAoz/F
PaNKx4G9nkk=
=G9lK
-----END PGP SIGNATURE-----
Index: Filters/FilterImLog.cs
===================================================================
RCS file: /cvs/gnome/beagle/Filters/FilterImLog.cs,v
retrieving revision 1.1
diff -u -1 -2 -r1.1 FilterImLog.cs
--- Filters/FilterImLog.cs	24 Oct 2005 20:16:58 -0000	1.1
+++ Filters/FilterImLog.cs	5 Jun 2006 11:28:54 -0000
@@ -53,26 +53,37 @@
 			else
 				Error ();
 		}
 
 		protected override void DoPullProperties ()
 		{
 			AddProperty (Beagle.Property.NewDate ("fixme:starttime", log.StartTime));
 			AddProperty (Beagle.Property.NewDate ("fixme:endtime", log.EndTime));
 			AddProperty (Beagle.Property.NewUnsearched ("fixme:client", log.Client));
 			AddProperty (Beagle.Property.NewUnsearched ("fixme:protocol", log.Protocol));
 
 			// FIXME: Should these use Property.NewKeyword and be searched?
-			AddProperty (Beagle.Property.NewUnsearched ("fixme:speakingto", log.SpeakingTo));
+			AddProperty (Beagle.Property.NewKeyword ("fixme:speakingto", log.SpeakingTo));
 			AddProperty (Beagle.Property.NewUnsearched ("fixme:identity", log.Identity));
+			
+			GaimBuddyListReader list = new GaimBuddyListReader();
+			ImBuddy buddy = list.Search (log.SpeakingTo);
+			if (buddy.Alias != "")
+				AddProperty (Beagle.Property.NewKeyword ("fixme:speakingto_alias", buddy.Alias));
+			
+			string icon_dir = Path.Combine (PathFinder.HomeDir ,".gaim");
+			icon_dir = Path.Combine (icon_dir, "icons");
+			if (buddy.BuddyIconLocation != "")
+				AddProperty (Beagle.Property.NewUnsearched ("fixme:speakingto_icon", Path.Combine (icon_dir,  buddy.BuddyIconLocation)));
+	
 		}
 
 		override protected void DoPull ()
 		{
 			foreach (ImLog.Utterance utt in log.Utterances) {
 				AppendText (utt.Text);
 				AppendText (" ");
 			}
 
 			Finished ();
 		}
 
Index: beagled/GaimLogQueryable/GaimLogQueryable.cs
===================================================================
RCS file: /cvs/gnome/beagle/beagled/GaimLogQueryable/GaimLogQueryable.cs,v
retrieving revision 1.55
diff -u -1 -2 -r1.55 GaimLogQueryable.cs
--- beagled/GaimLogQueryable/GaimLogQueryable.cs	4 Jun 2006 04:22:13 -0000	1.55
+++ beagled/GaimLogQueryable/GaimLogQueryable.cs	5 Jun 2006 11:28:54 -0000
@@ -252,31 +252,33 @@
 
 		override protected double RelevancyMultiplier (Hit hit)
 		{
 			return HalfLifeMultiplierFromProperty (hit, 0.25, "fixme:endtime", "fixme:starttime");
 		}
 
 		override protected bool HitFilter (Hit hit) 
 		{
 			ImBuddy buddy = list.Search (hit ["fixme:speakingto"]);
 			
 			if (buddy == null) 
 				return false;
-				
-			if (buddy.Alias != "")
-				hit.AddProperty (Beagle.Property.NewKeyword ("fixme:speakingto_alias", buddy.Alias));
-				
-			if (buddy.BuddyIconLocation != "")
-				hit.AddProperty (Beagle.Property.NewUnsearched ("fixme:speakingto_icon", Path.Combine (icons_dir, buddy.BuddyIconLocation)));
-			
+			if (buddy.Alias != "" && hit["fixme:speakingto_alias"] != buddy.Alias ){
+				hit["fixme:speakingto_alias"]= buddy.Alias ;
+				log.Debug (" Re-Indexing " + buddy.BuddyAccountName + "'s alias as: " + buddy.Alias);
+			}
+			string current_icon_loc = Path.Combine (icons_dir, buddy.BuddyIconLocation);
+			if (buddy.BuddyIconLocation != "" && current_icon_loc != hit["fixme:speakingto_icon"] ){
+				hit["fixme:speakingto_icon"] = Path.Combine (icons_dir, buddy.BuddyIconLocation);
+				log.Debug (" Re-Indexing " + buddy.BuddyAccountName + "'s icon at: " + buddy.BuddyIconLocation);
+			}
 			
 			return true;
 		}
 
 		override public string GetSnippet (string [] query_terms, Hit hit)
 		{
 			TextReader reader;
 			reader = TextCache.UserCache.GetReader (hit.Uri);
 			if (reader == null)
 				return null;
 			HtmlRemovingReader html_removing_reader = new HtmlRemovingReader (reader);
 			string snippet = SnippetFu.GetSnippet (query_terms, html_removing_reader);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]