X-Git-Url: http://dolda2000.com/gitweb/?p=doldaconnect.git;a=blobdiff_plain;f=clients%2Fgtk2%2Fhublist.c;h=2420ff89e93cec134ce265110e765a6f6784b5c2;hp=556e3c3125434a8717ac64fc36639f353e0c3e73;hb=0bdaf034bbe27cb94ab32847afe683cb11a000eb;hpb=b0d389ac31cc08a6739846024a220a2d3b6958b7 diff --git a/clients/gtk2/hublist.c b/clients/gtk2/hublist.c index 556e3c3..2420ff8 100644 --- a/clients/gtk2/hublist.c +++ b/clients/gtk2/hublist.c @@ -1,6 +1,6 @@ /* * Dolda Connect - Modular multiuser Direct Connect-style client - * Copyright (C) 2007 Fredrik Tolf (fredrik@dolda2000.com) + * Copyright (C) 2007 Fredrik Tolf * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -69,6 +69,7 @@ void aborthublist(void) if(bzs != NULL) { BZ2_bzDecompressEnd(bzs); free(bzs); + bzs = NULL; } if(filter != NULL) { regfree(filter); @@ -147,7 +148,7 @@ static void fdcb(gpointer data, gint source, GdkInputCondition cond) bzs->avail_out = mybufsize - mybufdata; bzret = BZ2_bzDecompress(bzs); if((bzret != BZ_OK) && (bzret != BZ_STREAM_END)) { - msgbox(GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Could not decompress hublist (%i)"), hret); + msgbox(GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Could not decompress hublist (%i)"), bzret); aborthublist(); return; } @@ -195,6 +196,11 @@ void fetchhublist(char *url, regex_t *flt) u = parseurl(url); hc = htconnect(u); freeurl(u); + if(hc == NULL) { + msgbox(GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Could not read hublist from server: %s"), strerror(errno)); + return; + } + hc->autoredir = 1; state = 0; settags(); gtk_widget_show(main_pubhubbarbox); @@ -205,6 +211,7 @@ void fetchhublist(char *url, regex_t *flt) len = strlen(url); p = url + len; if((len > 4) && !strncmp(p - 4, ".bz2", 4)) { + /* Because using Transfer-Encoding would just be too good! */ p -= 4; len -= 4; bzs = memset(smalloc(sizeof(*bzs)), 0, sizeof(*bzs)); @@ -217,6 +224,7 @@ void fetchhublist(char *url, regex_t *flt) } } if((len > 4) && !strncmp(p - 4, ".xml", 4)) { + /* Because using Content-Type would just be too good! */ p -= 4; len -= 4; handler = pubhubxmlhandler;