[tuxdroid-svn] r6017 - software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/execut
Status: Beta
Brought to you by:
ks156
From: jerome <c2m...@c2...> - 2009-12-29 10:21:18
|
Author: jerome Date: 2009-12-29 11:21:03 +0100 (Tue, 29 Dec 2009) New Revision: 6017 Modified: software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/connector.py software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py Log: * Fixed a bug making outgoing calls when Skype client were never started. Modified: software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/connector.py =================================================================== --- software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/connector.py 2009-12-28 09:52:05 UTC (rev 6016) +++ software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/connector.py 2009-12-29 10:21:03 UTC (rev 6017) @@ -154,13 +154,13 @@ def __new_skype_status__(self, status): '''If Skype is closed and reopened we can reattach. ''' + self.skype.OnAttachmentStatus = self.__new_skype_status__ #If api is not attached, then setting 'api not ready' values if status != Skype4Py.apiAttachSuccess: self.apiReady = False #API attach is available, meaning api was disconnected. if status == Skype4Py.apiAttachAvailable: - self.skype.OnAttachmentStatus = self.__new_skype_status__ #Attaching api. try: self.skype.Attach() @@ -279,4 +279,14 @@ ''' if(self.lock): self.lock = False - return not self.lock + return not self.lock + + + # -------------------------------------------------------------------------- + # Attach Skype api. + # -------------------------------------------------------------------------- + def AttachAPI(self): + '''Attach Skype api. + ''' + self.__connect_all__() + 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-28 09:52:05 UTC (rev 6016) +++ software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py 2009-12-29 10:21:03 UTC (rev 6017) @@ -318,6 +318,7 @@ ''' Initialize Skype objects and set events handlers. ''' + self.mutex.acquire() #Api ready and connected so creatin other commands objects. self.synchronious = SynchroniousCommands(self.connectorObj) @@ -340,9 +341,9 @@ self.asynchronious.OnOutgoingCall = self.OnOutgoingCall self.asynchronious.OnOutgoingFinished = self.OnOutgoingFinished - self.mutex.acquire() self.initialized = True self.mutex.release() + def OnIncomingRefused(self, contactHandle): @@ -513,14 +514,14 @@ time.sleep(1.0) #Setting Tux Droid as audio peripheral. - ''' + try: #in try statement to take calls in care. if ( self.synchronious != None ) and ( not self.synchronious.isTuxDroidAudioCard() ): self.throwTrace(self.synchronious.setAudioCards()) except: pass - ''' + ##---------------------------------------------------------------- @@ -535,25 +536,34 @@ if self.isIncoming: #Then it's an incoming call. self.serv.notify(COMMAND_INCOMING) + elif self.isOutgoingUser: if not self.connectorObj.isClientRunning(): - self.connectorObj.startClient() - while ( not self.initialized ): - time.sleep(2.0) + thread = threading.Thread(target=self.connectorObj.startClient) + thread.start() + self.clientStartedByPlugin = True + #Wait for login and attach. + mutex = threading.Lock() self.initialized = False - self.clientStartedByPlugin = True + while not self.initialized: + mutex.acquire() + time.sleep(4) + self.connectorObj.OnAPIReady = self.initializeDaemon + self.connectorObj.AttachAPI() + mutex.release() + #Then interface outgoing call. self.serv.notify(COMMAND_OUTGOING_USER) + else: #Then user uses TuxBox to make a call. self.serv.notify(COMMAND_OUTGOING_INTERFACE) #Finally, reset values. self.isIncoming = False - self.isOutgoingUser = True + self.isOutgoingUser = True - def ServerOnClientNotification(self, idClient, Message): ''' ''' |