[Freeswitch-branches] [commit] r11481 - freeswitch/branches/ctrix/mod_airpe

FreeSWITCH SVN ctrix at freeswitch.org
Sat Jan 24 07:50:34 PST 2009


Author: ctrix
Date: Sat Jan 24 09:50:34 2009
New Revision: 11481

Log:
Fix this test before complete rework

Modified:
   freeswitch/branches/ctrix/mod_airpe/Makefile
   freeswitch/branches/ctrix/mod_airpe/airpe_if_osx.c

Modified: freeswitch/branches/ctrix/mod_airpe/Makefile
==============================================================================
--- freeswitch/branches/ctrix/mod_airpe/Makefile	(original)
+++ freeswitch/branches/ctrix/mod_airpe/Makefile	Sat Jan 24 09:50:34 2009
@@ -10,7 +10,8 @@
 #LOCAL_LDFLAGS=-lX11
 
 #--------------------------------- OSX
-LOCAL_LDFLAGS=-framework Skype -framework CoreFoundation
+#LOCAL_LDFLAGS=-framework CoreFoundation
+LOCAL_LDFLAGS=-framework Skype -framework CoreFoundation -framework Carbon
 
 
 include ../../../../build/modmake.rules

Modified: freeswitch/branches/ctrix/mod_airpe/airpe_if_osx.c
==============================================================================
--- freeswitch/branches/ctrix/mod_airpe/airpe_if_osx.c	(original)
+++ freeswitch/branches/ctrix/mod_airpe/airpe_if_osx.c	Sat Jan 24 09:50:34 2009
@@ -4,6 +4,7 @@
 #if defined (MACOSX) || defined(DARWIN)
 
 #include "Skype/SkypeAPI-Carbon.h"
+#include <CoreFoundation/CoreFoundation.h>
 
 struct skype_window_handler_s {
     struct SkypeDelegate	delegate;
@@ -43,18 +44,22 @@
     string = CFStringCreateWithCString(NULL, message_P, kCFStringEncodingUTF8 );
     SendSkypeCommand(string);
     CFRelease(string);
+    RunCurrentEventLoop(0.01);
 
     return SWITCH_STATUS_SUCCESS;
 }
 
 switch_status_t airpe_skype_avalaible(skype_window_handler_t *window)
 {
+/*
     if ( IsSkypeAvailable() ) {
 	return SWITCH_STATUS_SUCCESS;
     }
     else {
 	return SWITCH_STATUS_FALSE;
     }
+*/
+	return SWITCH_STATUS_FALSE;
 }
 
 
@@ -62,20 +67,16 @@
 /*****************************************************************************
     THREADS
  *****************************************************************************/
-static void IncomingMessage(CFStringRef aNotificationString) {
+static int attached = -1;
 
+static void IncomingMessage(CFStringRef aNotificationString) {
     ADEBUG("Incoming message");
-
-//    char *string;
-//    airpe_manage_skype_msg( airpe, string);
-
 }
 
 static void AttachResponse(unsigned int aAttachResponseCode) {
     ADEBUG("Attach: %d\n", aAttachResponseCode);
+    attached = aAttachResponseCode;
 }
-
-
 void *SWITCH_THREAD_FUNC airpe_skype_thread(switch_thread_t * thread, void *obj) {
     airpe_interface_t *airpe = NULL;
     struct SkypeDelegate *del;
@@ -85,13 +86,17 @@
 
     if ( !IsSkypeAvailable() ) {
 	ADEBUG("Sorry, not available\n");
-	return NULL;
+	goto done;
     }
-
+    RunCurrentEventLoop(0.1);
+/*
     if ( !IsSkypeRunning() ) {
 	ADEBUG("Sorry, not running\n");
-	return NULL;
+	goto done;
     }
+    RunCurrentEventLoop(0.1);
+*/
+    airpe->running = 1;
 
     del = &airpe->skype_window->delegate;
     del->clientApplicationName=CFSTR("airpe");
@@ -99,26 +104,37 @@
     del->SkypeAttachResponse=AttachResponse;
 
     SetSkypeDelegate(del);
+    RunCurrentEventLoop(0.1);
     ConnectToSkype();
+    RunCurrentEventLoop(0.1);
+
+    while ( airpe->running && attached !=1  ) {
+//	ADEBUG("Sorry, not attached\n");
+	RunCurrentEventLoop(0.01);
+    }
+
+    if ( !attached && airpe->running ) {
+	ADEBUG("Sorry, not attached\n");
+	goto done;
+    }
 
     if ( airpe_on_connect_messages( airpe, 6 ) != SWITCH_STATUS_SUCCESS ) {
 	switch_log_printf(	SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, 
 				"airpe client %s. Failed to send handshake messages\n", 
 				airpe->name);
-    	return NULL;
+	goto done;
     }
 
 
-    airpe->running = 1;
     while ( airpe->running ) {
-	switch_sleep(1000000);
+	RunCurrentEventLoop(0.01);
     }
 
     DisconnectFromSkype();
     RemoveSkypeDelegate();
 
+ done:
     ADEBUG("Exiting\n");
-
     airpe->airpe_thread_skype = NULL;
 
     return NULL;



More information about the Freeswitch-branches mailing list