Re: More Gaim Alias Fixes



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

Ooops... made a tiny change to prevent possible 'Object not set to an
instance' junks.

- -Kevin
Kevin Kubasik wrote:
> 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.
> 

- ------------------------------------------------------------------------

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);

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

iQIVAwUBRIQZDv3xZFNDM330AQh9NhAAsvfPcZBFJofzDSF7wxknltcrCWrC5rpG
u/WfXrB2VuO6UxRjE7RlbYXe5Z/8Hwh94Sfj1Xr+C1jYnVKnePq7myrG7tR2iG34
3Ze5Ps9NnSD11MMuti/Nn49UYjWnjtdxIo1qrJwCXhQ9ETTpk7XoBhf+Dt5V45ZD
H06Y0KL24At5iDj02llr0e8r2WSffK7ib3IhkqttIs+5QsXeqxRNgshE0t6AQw11
iS7dBi4iT/iPJmSJjhGAQeSAHE0JkYlAelODxIROGCHLV+VuShJvi7qyj5/Shp2Q
jP2i93Y1nMHN9q1CdXm7WkAFZMpbcogATe8xJiKeXfvLy8Z/YhfPE2fi35AIRYaz
Qx0ZOXEUUsHqbBaofiDxWh39VKWK4byIexUchVyScnSCWq1csr4ZnGTMuD6Jn76G
jsv3tXy6hfRcMF3D+CNbJpL4x8RIgQeeajzwBAgizNAj8SfeOWJsa2jOKQ/KkRr9
FH+m3AFvvjID95Klvp0JFWkCZGVuv0HvXA4OBPP9k0je7TUxqau7+6cWXNa5S/Qn
P/zV1uCCm5Y4OLy4fqb/JDp3ilWPUrPsCNuk2ED/Kc/nbmKOK0VCnlQQzkt0bkWI
N6tRFmxljQx3OgZzWjwmYufSrBFPqWlW9MEsEaOBzqTq85kzJcBsinXe212ZPrFC
WUBlSK151Qc=
=jKir
-----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:39:14 -0000
@@ -53,26 +53,39 @@
 			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 == null)
+				return;
+			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:39:14 -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]