X-Git-Url: http://dolda2000.com/gitweb/?a=blobdiff_plain;f=clients%2Fgtk2%2Fmain.c;h=aebeaacdb371814fe95de2250eca0269ddf7a44c;hb=649eeeb6cf1ab37d2350146d49c126ee775194f4;hp=8aa487c99f2fd557ad0398db98dc7d8eb3786d11;hpb=cac656ef0444b50ab59b96b7f87d56f60bed6c2c;p=doldaconnect.git diff --git a/clients/gtk2/main.c b/clients/gtk2/main.c index 8aa487c..aebeaac 100644 --- a/clients/gtk2/main.c +++ b/clients/gtk2/main.c @@ -21,10 +21,10 @@ * inability to structure GUI programs properly. Looking at it too * closely may cause ocular hemorrhaging. */ +#include #include #include #include -#include #include #include #include @@ -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); @@ -1361,7 +1365,7 @@ void cb_main_lsres_activate(GtkWidget *widget, gpointer data) void dcconnect(char *host) { - dcfd = dc_connect(host, -1); + dcfd = dc_connect(host); if(dcfd < 0) { msgbox(GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Could not connect:\n\n%s"), strerror(errno)); @@ -2574,8 +2578,8 @@ int main(int argc, char **argv) gtk_init(&argc, &argv); dc_init(); signal(SIGCHLD, SIG_IGN); - pubhubaddr = sstrdup("http://www.hublist.org/PublicHubList.config.bz2"); - dcserver = sstrdup("localhost"); + pubhubaddr = sstrdup("http://www.hublist.org/PublicHubList.xml.bz2"); + dcserver = sstrdup(""); if((pwent = getpwuid(getuid())) == NULL) { fprintf(stderr, "could not get your passwd data");