static PyObject *mod_connect(PyObject *self, PyObject *args)
{
char *host;
- int port;
- port = -1;
- if(!PyArg_ParseTuple(args, "s|i", &host, &port))
+ host = NULL;
+ if(!PyArg_ParseTuple(args, "|s", &host))
return(NULL);
if(fd >= 0)
dc_disconnect();
- if((fd = dc_connect(host, port)) < 0) {
+ if((fd = dc_connect(host)) < 0) {
PyErr_SetFromErrno(PyExc_OSError);
return(NULL);
}
return(ret);
}
+static PyObject *mod_wantwrite(PyObject *self)
+{
+ if(dc_wantwrite())
+ Py_RETURN_TRUE;
+ else
+ Py_RETURN_FALSE;
+}
+
static PyMethodDef methods[] = {
{"connect", mod_connect, METH_VARARGS,
"Connect to a Dolda Connect server"},
"Perform an asynchronous login procedure"},
{"lexsexpr", mod_lexsexpr, METH_VARARGS,
"Use a standard algorithm to lex a search expression"},
+ {"wantwrite", (PyCFunction)mod_wantwrite, METH_NOARGS,
+ "Return a boolean indicating whether there is output to be fed to the server"},
{NULL, NULL, 0, NULL}
};