Author: remi
Date: 2009-07-09 10:21:39 +0200 (Thu, 09 Jul 2009)
New Revision: 5093

Modified:
   
software_suite_v3/software/plugin/plugin-skype/trunk/executables/plugin-skype.py
Log:
* Fixed bug with self.isWindows() (replaced by os.name) which freeze the plugin 
when the stdin is handled by the server (daemon mode).
* Updated the way to launch skype application.

Modified: 
software_suite_v3/software/plugin/plugin-skype/trunk/executables/plugin-skype.py
===================================================================
--- 
software_suite_v3/software/plugin/plugin-skype/trunk/executables/plugin-skype.py
    2009-07-08 20:27:56 UTC (rev 5092)
+++ 
software_suite_v3/software/plugin/plugin-skype/trunk/executables/plugin-skype.py
    2009-07-09 08:21:39 UTC (rev 5093)
@@ -117,7 +117,7 @@
                 self.__skype = None
                 self.__apiAttachState = -1
                 if self.__skypeProcess != None:
-                    if self.isWindows():
+                    if os.name == "nt":
                         import win32api
                         try:
                             win32api.TerminateProcess(int(
@@ -188,7 +188,7 @@
     def __selectTuxAsAudioCard(self):
         """Set tux as audio peripheral.
         """
-        if self.isWindows():
+        if os.name == "nt":
             import platform
             if int(platform.version().split(".")[0]) >= 6:
                 self.__sendCommandToSkype('SET AUDIO_IN TuxDroid-Micro 
(TuxDroid-Audio)')
@@ -305,7 +305,7 @@
     def __getSkypeAppConnected(self):
         """Check for skype connection
         """
-        if not self.isWindows():
+        if os.name != "nt":
             return len(commands.getoutput("ps -A | grep skype")) > 0
         else:
             cmd = ["tasklist", "/FI", "IMAGENAME eq skype.exe"]
@@ -322,7 +322,7 @@
         if self.__getSkypeAppConnected():
             return
         self.throwMessage("Please wait while I launch the skeyepe application")
-        if self.isWindows():
+        if os.name == "nt":
             thread = threading.Thread(target = self.__startSkypeAppWindows)
             thread.start()
         else:
@@ -334,13 +334,24 @@
         """
         if "ProgramFiles" in os.environ:
             try:
-                self.__skypeProcess = subprocess.Popen(
-                    os.environ["ProgramFiles"] + "\\Skype\\Phone\\Skype.exe",
-                    stdin = subprocess.PIPE, stdout = subprocess.PIPE)
-                result = self.__skypeProcess.stdout.read()
-                result.split()
-                if ("not" in result) and ("recognized" in result) \
-                    and ("command" in result):
+                skypePath = os.environ["ProgramFiles"] + 
"\\Skype\\Phone\\Skype.exe"
+                if os.path.isfile(skypePath):
+                    cmd = [
+                        skypePath,
+                        '"workforplugins"',
+                    ]
+                    self.__skypeProcess = subprocess.Popen(
+                        cmd,
+                        stdin = subprocess.PIPE,
+                        stdout = subprocess.PIPE)
+                    while True:
+                        try:
+                            buffer = self.__skypeProcess.stdout.read(100)
+                        except:
+                            buffer = ""
+                        if len(buffer) == 0:
+                            break
+                else:
                     self.throwMessage("Sorry, it looks like skeyepe is not 
installed. Please go to the skeyepe website to download the software.")
                     self.__activeMain = False
             except WindowsError:


------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to