Ejemplo n.º 1
0
static PyObject *PyFFFont_CollabSessionJoin(PyFF_Font *self, PyObject *args)
{
#ifdef BUILD_COLLAB

    char* address = collabclient_makeAddressString(
	"localhost", collabclient_getDefaultBasePort());

    if ( PySequence_Size(args) == 1 )
    {
	char* uaddr = 0;
	if ( !PyArg_ParseTuple(args,"es","UTF-8",&uaddr) )
	    return( NULL );

	address = uaddr;
    }
    FontViewBase *fv = self->fv;

    TRACE("PyFFFont_CollabSessionJoin() address:%s fv:%p\n", address, self->fv );
    void* cc = collabclient_newFromPackedAddress( address );
    TRACE("PyFFFont_CollabSessionJoin() address:%s cc1:%p\n", address, cc );
    fv->collabClient = cc;
    TRACE("PyFFFont_CollabSessionJoin() address:%s cc2:%p\n", address, fv->collabClient );
    FontViewBase* newfv = collabclient_sessionJoin( cc, (FontView*)fv );
    // here fv->collabClient is 0 and there is a new fontview.
    TRACE("PyFFFont_CollabSessionJoin() address:%s cc3:%p\n", address, fv->collabClient );
    TRACE("PyFFFont_CollabSessionJoin() address:%s cc4:%p\n", address, newfv->collabClient );

    inPythonStartedCollabSession = 1;
    PyObject* ret = PyFV_From_FV_I( newfv );
    Py_RETURN( ret );
#endif

    Py_RETURN( self );
}
Ejemplo n.º 2
0
void collabclient_sessionReconnect( void* ccvp )
{
#ifdef BUILD_COLLAB

    cloneclient_t* cc = (cloneclient_t*)ccvp;

    zsocket_destroy( cc->ctx, cc->snapshot   );
    zsocket_destroy( cc->ctx, cc->subscriber );
    zsocket_destroy( cc->ctx, cc->publisher  );
    collabclient_remakeSockets( cc );
    cc->publisher_sendseq = 1;

    FontView* fv = FontViewFindUI( FontViewFind_byCollabPtr, cc );
    if( fv )
    {
	collabclient_sessionJoin( cc, fv );
    }

#endif
}