Author: jerome
Date: 2009-12-15 10:08:36 +0100 (Tue, 15 Dec 2009)
New Revision: 5975

Modified:
   
software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/communicator.py
Log:
* Added mutex for emoticons and tts text research.
* Fixed an encoding problem ( need to be tested on Linux ).

Modified: 
software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/communicator.py
===================================================================
--- 
software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/communicator.py
   2009-12-14 12:48:31 UTC (rev 5974)
+++ 
software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/communicator.py
   2009-12-15 09:08:36 UTC (rev 5975)
@@ -60,8 +60,7 @@
     contacts_ols = ['ONLINE', 'AWAY', 'NA', 'DND', 'SKYPEOUT', 'SKYPEME']
     
     #List available offline statuses.
-    contacts_ofs = [u'UNKNOWN', u'OFFLINE', u'INVISIBLE']
-               
+    contacts_ofs = [u'UNKNOWN', u'OFFLINE', u'INVISIBLE'] 
   
     
 ###################################################
@@ -491,6 +490,9 @@
     
     #...@params : TTS sentence.
     OnAvailableTTSSentence = None 
+    
+    
+    lock = threading.Lock()   
       
     
 ###################################################
@@ -640,7 +642,12 @@
             tts_available, message = self.__check_tts_sentence__(Message.Body)
             if tts_available:
                 if self.OnAvailableTTSSentence != None:
-                    thread = threading.Thread(target = 
self.OnAvailableTTSSentence, args = [message, ])
+                    try:
+                        mess = message.encode("iso-8859-1")
+                    except:
+                        mess = message.encode("utf-8")
+                        
+                    thread = threading.Thread(target = 
self.OnAvailableTTSSentence, args = [mess, ])
                     thread.start()
                 return
             
@@ -674,10 +681,13 @@
         '''
         Check message for matching emoticons.
         '''
+        self.lock.acquire()
         # Search for emoticon
         for emoticon in EMOTICONS_TO_ATTITUNES.keys():
             if message.lower().find(emoticon) != -1:
+                self.lock.release()
                 return ( True, emoticon )
+        self.lock.release()
         return ( False, '' )
     
     
@@ -685,17 +695,23 @@
         '''
         Check if the message contains 'tux'.
         '''
+        self.lock.acquire()
         # speak the text if begin is "tuxdroid>"
         if message.find('tuxdroid>') == 0:
+            self.lock.release()
             return ( True, message[9:] )
         # speak the text if begin is "tuxdroid"
         if message.find('tuxdroid') == 0:
+            self.lock.release()
             return ( True, message[8:] )
         # speak the text if begin is "tux>"
         if message.find('tux>') == 0:
+            self.lock.release()
             return ( True, message[4:] )
         # speak the text if begin is "tux"
         if message.find('tux') == 0:
+            self.lock.release()
             return ( True, message[3:] )
+        self.lock.release()
         return ( False, '' )
         


------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to