r7127 - in bigboard/trunk/bigboard: . stocks/people



Author: hp
Date: 2008-01-03 15:41:17 -0600 (Thu, 03 Jan 2008)
New Revision: 7127

Modified:
   bigboard/trunk/bigboard/people_tracker.py
   bigboard/trunk/bigboard/stocks/people/PeopleStock.py
Log:
fix search for people

Modified: bigboard/trunk/bigboard/people_tracker.py
===================================================================
--- bigboard/trunk/bigboard/people_tracker.py	2008-01-03 21:21:56 UTC (rev 7126)
+++ bigboard/trunk/bigboard/people_tracker.py	2008-01-03 21:41:17 UTC (rev 7127)
@@ -301,7 +301,12 @@
             self.display_name = None
 
         if self.display_name == None:
-            self.display_name = resource.name
+            if resource.protocol == 'mugshot-local':
+                ## resource.name for this would be a data model URI thing
+                self.display_name = 'NO_NAME'
+            else:
+                ## resource.name for xmpp/aim should be the xmpp/aim address
+                self.display_name = resource.name
 
         self.emit("display-name-changed")
 

Modified: bigboard/trunk/bigboard/stocks/people/PeopleStock.py
===================================================================
--- bigboard/trunk/bigboard/stocks/people/PeopleStock.py	2008-01-03 21:21:56 UTC (rev 7126)
+++ bigboard/trunk/bigboard/stocks/people/PeopleStock.py	2008-01-03 21:41:17 UTC (rev 7127)
@@ -156,10 +156,10 @@
         self.__person = person
 
     def get_title(self):
-        return self.__person.name
+        return self.__person.display_name
 
     def get_detail(self):
-        return self.__person.name
+        return self.__person.display_name
 
     def get_icon(self):
         """Returns an icon for the result"""
@@ -171,7 +171,17 @@
 
     def _on_activated(self):
         """Action when user has activated the result"""
-        libbig.show_url(self.__person.homeUrl)
+        if self.__person.is_contact:
+            try:
+                user = self.__person.resource.user
+            except AttributeError:
+                user = None
+            if user:
+                libbig.show_url(user.homeUrl)
+        else:
+            ### FIXME - what should we do here? open an IM conversation?
+            ### or scroll to and pop out the user in the people stock?
+            pass
 
 class PeopleSearchProvider(search.SearchProvider):    
     def __init__(self, tracker):
@@ -194,7 +204,7 @@
             if p.is_contact and not matched:
                 emails = []
                 try:
-                    emails = person.resource.emails
+                    emails = p.resource.emails
                 except AttributeError:
                     pass
                 for email in emails:
@@ -205,7 +215,10 @@
             if not matched:
                 if p.aim and query in p.aim:
                     matched = True
-                    
+                
+                if p.xmpp and query in p.xmpp:
+                    matched = True
+
             if matched:
                 results.append(PeopleSearchResult(self, p))
 



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