Author: jerome
Date: 2009-12-15 14:59:29 +0100 (Tue, 15 Dec 2009)
New Revision: 5982

Modified:
   
software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py
Log:
* Added mutex for previous and next contact function.
* Added a 0.4 sec delay before throwing first contact.

Modified: 
software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py
===================================================================
--- 
software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py
   2009-12-15 13:44:04 UTC (rev 5981)
+++ 
software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py
   2009-12-15 13:59:29 UTC (rev 5982)
@@ -112,6 +112,8 @@
     asynchronious = None
     connectorObj  = None
     
+    mutex = threading.Lock()
+    
     #Used for run command only.
     command = ""
     canrun  = True
@@ -437,21 +439,24 @@
         Go next in the online contacts list.
         '''
         try:
+            self.mutex.acquire()
             self.currentContact += 1
             
             if self.currentContact >= len(self.onlineList):
                 self.currentContact = 0
                 
             self.serv.notify('tts>%s' % self.onlineList[self.currentContact])
-        except:
-            self.serv.notify('tts>%s' % self.onlineList[0])
-            
+        finally:
+            time.sleep(0.4)
+            self.mutex.release()            
+        
     
     def previousContact(self):
         '''
         Go previous in the online contacts list.
         '''
         try:
+            self.mutex.acquire()
             self.currentContact -= 1
             
             if self.currentContact <= -1:
@@ -459,10 +464,11 @@
                 self.currentContact = len(self.onlineList) - 1
                 
             self.serv.notify('tts>%s' % self.onlineList[self.currentContact])
-        except:
-            self.serv.notify('tts>%s' % self.onlineList[0])
+        finally:
+            time.sleep(0.4)
+            self.mutex.release()  
+        
     
-    
     def mainloop(self):
         '''
         Run main loop.
@@ -550,6 +556,7 @@
         elif Message == 'get_contacts':
             #Outgoing call requested, so getting online list and sending 
outgoing command.
             self.onlineList = self.synchronious.getOnlineList()
+            time.sleep(0.4)
             #And throwing the first online contact in list.
             self.nextContact()
             


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

Reply via email to