void* collabclient_newFromPackedAddress( char* packed ) { #ifdef BUILD_COLLAB if( !strncmp( packed, "tcp://", strlen("tcp://"))) packed += strlen("tcp://"); int port_default = 5556; int port = port_default; char address[IPADDRESS_STRING_LENGTH_T]; strncpy( address, packed, IPADDRESS_STRING_LENGTH_T-1 ); HostPortUnpack( address, &port, port_default ); return( collabclient_new( address, port ) ); #else return 0; #endif }
static PyObject *PyFFFont_CollabSessionStart(PyFF_Font *self, PyObject *args) { #ifdef BUILD_COLLAB int port_default = collabclient_getDefaultBasePort(); int port = port_default; char address[IPADDRESS_STRING_LENGTH_T]; if( !getNetworkAddress( address )) { snprintf( address, IPADDRESS_STRING_LENGTH_T-1, "%s", HostPortPack( "127.0.0.1", port )); } else { snprintf( address, IPADDRESS_STRING_LENGTH_T-1, "%s", HostPortPack( address, port )); } if ( PySequence_Size(args) == 1 ) { char* uaddr = 0; if ( !PyArg_ParseTuple(args,"es","UTF-8",&uaddr) ) return( NULL ); strcpy( address, uaddr ); } FontViewBase *fv = self->fv; HostPortUnpack( address, &port, port_default ); printf("address:%s\n", address ); printf("port:%d\n", port ); void* cc = collabclient_new( address, port ); fv->collabClient = cc; collabclient_sessionStart( cc, (FontView*)fv ); printf("connecting to server...sent the sfd for session start.\n"); inPythonStartedCollabSession = 1; #endif Py_RETURN( self ); }