[Freeswitch-svn] [commit] r7226 - freeswitch/trunk/src/mod/languages/mod_spidermonkey_curl

Freeswitch SVN anthm at freeswitch.org
Mon Jan 14 17:19:48 EST 2008


Author: anthm
Date: Mon Jan 14 17:19:48 2008
New Revision: 7226

Modified:
   freeswitch/trunk/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c

Log:
update

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c	Mon Jan 14 17:19:48 2008
@@ -39,8 +39,9 @@
 	JSContext *cx;
 	JSObject *obj;
 	JSFunction *function;
+	JSObject *user_data;
 	jsrefcount saveDepth;
-	jsval ret;
+	jsval ret;	
 };
 
 
@@ -58,7 +59,9 @@
 	if (co->function) {
 		char *ret;
 		argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(co->cx, (char *)ptr));
-
+		if (co->user_data) {
+			argv[argc++] = OBJECT_TO_JSVAL(co->user_data);
+		}
 		JS_ResumeRequest(co->cx, co->saveDepth);
 		JS_CallFunction(co->cx, co->obj, co->function, argc, argv, &co->ret);
 		co->saveDepth = JS_SuspendRequest(co->cx);
@@ -134,7 +137,11 @@
 	}
 
 	if (argc > 4) {
-		cred = JS_GetStringBytes(JS_ValueToString(cx, argv[4]));
+		JS_ValueToObject(cx, argv[4], &co->user_data);
+	}
+
+	if (argc > 5) {
+		cred = JS_GetStringBytes(JS_ValueToString(cx, argv[5]));
 		if (!switch_strlen_zero(cred)) {
 			curl_easy_setopt(co->curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
 			curl_easy_setopt(co->curl_handle, CURLOPT_USERPWD, cred);



More information about the Freeswitch-svn mailing list