Author: ArcRiley Date: 2009-01-07 13:51:33 -0500 (Wed, 07 Jan 2009) New Revision: 1434
Modified: trunk/concordance/src/Core.c trunk/concordance/src/Core.h Log: added gsasl, minor cleanup and added comments Modified: trunk/concordance/src/Core.c =================================================================== --- trunk/concordance/src/Core.c 2009-01-07 16:34:37 UTC (rev 1433) +++ trunk/concordance/src/Core.c 2009-01-07 18:51:33 UTC (rev 1434) @@ -58,15 +58,21 @@ conCoreObject* self = (conCoreObject*) s; static char* kwlist[] = {"client", "server", 0}; + #ifdef MS_WINDOWS + /* initialize wsaData if it hasn't already by another Core - /* a little windows startup code */ - #ifdef MS_WINDOWS - if (WSAStartup( MAKEWORD(2,2), &wsaData )){ - printf("FAIL\n"); + int WSAStartup (WORD wVersionRequested, + LPWSADATA lpWSAData); + */ + if (!wsaInit) { + if (WSAStartup(MAKEWORD(2,2), &wsaData )) { + PyErr_SetString(PyExc_OSError, "error starting Windows socket layer"); + return -1; + } + wsaInit = TRUE; } #endif - /* set defaults for optional arguments 0.0.0.0 listens on every IP interface @@ -192,6 +198,13 @@ return PyObject_GenericSetAttr((PyObject*) self, key, value); } + /* + # + ########################################################################### + # + # MainLoop thread functions (nogil) + # */ + static gpointer conCore_loop(gpointer s) { /*\ cdef : \*/ @@ -621,15 +634,17 @@ "<stream:stream xmlns='jabber:client'" " xmlns:stream='http://etherx.jabber.org/streams'" " from='%s' id='%s'>" - "<stream:features>" - "<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>" - "<mechanism>DIGEST-MD5</mechanism></mechanisms>" - "</stream:features>", + "<stream:features><mechanisms" + " xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>" + "<mechanism>DIGEST-MD5</mechanism>" + "</mechanisms></stream:features>", "selket.apogean.org", "concordance-1"); conCore_sessionSend(session, buff->str, buff->len); } /* should disconnect here, something other than session was sent */ } + case 1 : { + } } /* increase XML depth regardless of element */ Modified: trunk/concordance/src/Core.h =================================================================== --- trunk/concordance/src/Core.h 2009-01-07 16:34:37 UTC (rev 1433) +++ trunk/concordance/src/Core.h 2009-01-07 18:51:33 UTC (rev 1434) @@ -24,15 +24,17 @@ #include "Python.h" #include "glib.h" +#include "gsasl.h" #include "expat.h" + #ifdef MS_WINDOWS -#include <ws2tcpip.h> -#include <Winsock2.h> -//#define wsa_get_ready() if( !wsa_is_ready ) {WSADATA wd; WSAStartup( MAKEWORD(2,2), &wd ); wsa_is_ready = 1; } -WSADATA wsaData; + #include <ws2tcpip.h> + #include <Winsock2.h> + WSADATA wsaData; + gboolean wsaInit; #else -#include <sys/socket.h> -#include <netdb.h> + #include <sys/socket.h> + #include <netdb.h> #endif _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn