{
if(!wcscmp(resp->cmdname, L".connect"))
{
- if(resp->code == 200)
+ if(dc_checkprotocol(resp, DC_LATEST))
{
- dc_loginasync(NULL, 1, noconv, (void (*)(int, wchar_t *, void *))logincb, conduit);
- } else {
dc_disconnect();
disconnected(conduit);
+ } else {
+ dc_loginasync(NULL, 1, noconv, (void (*)(int, wchar_t *, void *))logincb, conduit);
}
} else if(!wcscmp(resp->cmdname, L".notify")) {
dc_uimisc_handlenotify(resp);
static int connect(struct conduit *conduit)
{
struct data *data;
- char *host;
data = conduit->cdata;
if(inuse != NULL)
return(-1);
- if((host = getenv("DCSERVER")) == NULL)
- host = "localhost";
- if((data->fd = dc_connect(host, -1)) < 0)
+ if((data->fd = dc_connect(NULL)) < 0)
return(-1);
data->gdkread = gdk_input_add(data->fd, GDK_INPUT_READ, (void (*)(gpointer, int, GdkInputCondition))dcfdcb, conduit);
updatewrite(conduit);