}
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);
{
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);
{
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);