[tuxdroid-svn] r5966 - 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-09 17:28:17
|
Author: jerome Date: 2009-12-09 18:28:04 +0100 (Wed, 09 Dec 2009) New Revision: 5966 Modified: software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py Log: * Added on plugin event. 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-09 14:37:28 UTC (rev 5965) +++ software_suite_v3/software/plugin/plugin-skype/branches/in_out_plugin/executables/plugin-skype.py 2009-12-09 17:28:04 UTC (rev 5966) @@ -47,7 +47,6 @@ ''' Skype plugin configuration. ''' - throwEmoticons = True @@ -118,11 +117,30 @@ ''' self.initializeCommandsClient() - #Create Tux Droid api and repare events. - #Run main loop. + thread = threading.Thread(target=self.mainloop) + thread.start() + def incomingPluginEvent(self, eventName, eventValues): + ''' + Tux Droid plugin event callback. + ''' + try: + #Check for IPN client started. + if not self.client.start(): + return + #Accept call + if eventName == 'head': + self.client.notify('accept_call') + #Reject Call + elif eventName in ['left', 'right']: + self.client.notify('reject_call') + finally: + #Quit plugin + + + ##---------------------------------------------------------------- ## * PLUGIN COMMAND : Set Tux Droid for an incoming call. ##---------------------------------------------------------------- @@ -319,6 +337,9 @@ + ##---------------------------------------------------------------- + ## * Tux Droid plugin events. + ##---------------------------------------------------------------- def onPluginStop(self): ''' OnPluginStop event. @@ -329,6 +350,20 @@ else: #In other cases, close connection but not skype client. self.connectorObj.stop() + + + + def onPluginEvent(self, eventName, eventValues): + ''' + Callback on plugin event. + @param eventName: Event name. + @param eventValues: Event values. + ''' + #Start the adequate function for each plugin command. + if self.getCommand() == 'incomingCall': + self.incomingPluginEvent(eventName, eventValues) + else: + pass ##---------------------------------------------------------------- |