Understand new connect stanza.
authorfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Thu, 12 Apr 2007 01:01:52 +0000 (01:01 +0000)
committerfredrik <fredrik@959494ce-11ee-0310-bf91-de5d638817bd>
Thu, 12 Apr 2007 01:01:52 +0000 (01:01 +0000)
git-svn-id: svn+ssh://svn.dolda2000.com/srv/svn/repos/src/doldaconnect@923 959494ce-11ee-0310-bf91-de5d638817bd

clients/gaim/gaim-dolcon.c
clients/gnome-trans-applet/conduit-dclib.c
clients/gtk2/main.c

index 5aad9ae..6d29726 100644 (file)
@@ -170,14 +170,19 @@ static void dcfdcb(struct conndata *data, int fd, GaimInputCondition condition)
     }
     while((resp = dc_getresp()) != NULL) {
        if(!wcscmp(resp->cmdname, L".connect")) {
-           if(resp->code == 200) {
-               gaim_connection_update_progress(data->gc, "Authenticating", 2, 3);
-               dc_loginasync(NULL, 1, (int (*)(int, wchar_t *, char **, void *))loginconv, (void (*)(int, wchar_t *, void *))logincb, data);
-           } else {
+           if(resp->code != 201) {
                dc_disconnect();
                disconnected(data);
                gaim_connection_error(data->gc, "Server refused connection");
                return;
+           } else if(dc_checkprotocol(resp, DC_LATEST)) {
+               dc_disconnect();
+               disconnected(data);
+               gaim_connection_error(data->gc, "Server protocol revision mismatch");
+               return;
+           } else {
+               gaim_connection_update_progress(data->gc, "Authenticating", 2, 3);
+               dc_loginasync(NULL, 1, (int (*)(int, wchar_t *, char **, void *))loginconv, (void (*)(int, wchar_t *, void *))logincb, data);
            }
        } else if(!wcscmp(resp->cmdname, L".notify")) {
            dc_uimisc_handlenotify(resp);
index 2089f7f..c267db2 100644 (file)
@@ -195,12 +195,12 @@ static void dcfdcb(struct conduit *conduit, int fd, GdkInputCondition condition)
     {
        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);
index 643d975..aebeaac 100644 (file)
@@ -1067,16 +1067,20 @@ void handleresps(void)
     {
        if(!wcscmp(resp->cmdname, L".connect"))
        {
-           if(resp->code == 200)
+           if(resp->code != 201)
            {
+               msgbox(GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("The server refused the connection"));
+               dc_disconnect();
+               dcdisconnected();
+           } else if(dc_checkprotocol(resp, DC_LATEST)) {
+               msgbox(GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Server protocol revision mismatch"));
+               dc_disconnect();
+               dcdisconnected();
+           } else {
                tosbuf = 0x10; /* Minimum cost */
                setsockopt(dcfd, SOL_IP, IP_TOS, &tosbuf, sizeof(tosbuf));
                updatesbar(_("Connected"));
                dc_loginasync(connectas, 1, loginconv, logincallback, NULL);
-           } else {
-               msgbox(GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("The server refused the connection"));
-               dc_disconnect();
-               dcdisconnected();
            }
        } else if(!wcscmp(resp->cmdname, L".notify")) {
            dc_uimisc_handlenotify(resp);