+ name = names[0];
+ names[0] = names[i];
+ names[i] = name;
+ type = types[0];
+ types[0] = types[i];
+ types[i] = type;
+ break;
+ }
+ }
+ if(i == numcols)
+ {
+ msgbox(GTK_MESSAGE_WARNING, GTK_BUTTONS_OK, _("The hub list at %s did not contain the address to any hubs"));
+ break;
+ }
+ model = gtk_list_store_newv(numcols, types);
+ for(n = findnode(r->children, "Hub"); n != NULL; n = findnode(n->next, "Hub"))
+ {
+ if(!xmlHasProp(n, (xmlChar *)"Address") || !xmlHasProp(n, (xmlChar *)"Name"))
+ continue;
+ if(filterpubhub)
+ {
+ match = 0;
+ attr = (char *)xmlGetProp(n, (xmlChar *)"Name");
+ if(!regexec(&pubhubfilter, attr, 0, NULL, 0))
+ match = 1;
+ xmlFree(attr);
+ if((attr = (char *)xmlGetProp(n, (xmlChar *)"Description")) != NULL)
+ {
+ if(!regexec(&pubhubfilter, attr, 0, NULL, 0))
+ match = 1;
+ xmlFree(attr);
+ }
+ if(!match)
+ continue;
+ }
+ gtk_list_store_append(model, &iter);
+ for(i = 0; i < numcols; i++)
+ {
+ attr = (char *)xmlGetProp(n, (xmlChar *)names[i]);
+ if(attr != NULL)
+ {
+ if(types[i] == G_TYPE_STRING)
+ gtk_list_store_set(model, &iter, i, attr, -1);
+ else if(types[i] == G_TYPE_INT)
+ gtk_list_store_set(model, &iter, i, atoi(attr), -1);
+ else if(types[i] == G_TYPE_INT64)
+ gtk_list_store_set(model, &iter, i, strtoll(attr, NULL, 0), -1);
+ xmlFree(attr);
+ }
+ }
+ }
+ cols = smalloc((numcols - 1) * sizeof(*cols));
+ for(i = 1; i < numcols; i++)
+ cols[i - 1] = i;
+ sortcol = 0;
+ for(i = 0; i < numcols; i++)
+ {
+ if(!strcmp(names[i], "Users"))
+ sortcol = i;
+ }
+ setpubhubmodel(GTK_TREE_MODEL(model), sortcol, numcols - 1, cols, names + 1);
+ free(cols);
+ g_object_unref(model);
+ break;
+ case PHO_FINI:
+ if(ctxt != NULL)
+ {
+ if(ctxt->myDoc != NULL)
+ xmlFreeDoc(ctxt->myDoc);
+ xmlFreeParserCtxt(ctxt);
+ ctxt = NULL;
+ }
+ break;
+ }
+ if(numcols != 0)
+ {
+ for(i = 0; i < numcols; i++)
+ free(names[i]);
+ free(names);
+ free(types);
+ }
+ return(0);
+}
+
+int pubhuboldhandler(int op, char *buf, size_t *len)
+{
+ static GtkListStore *model = NULL;
+ int i;
+ char *p, *p2;
+ wchar_t *wbuf;
+ char *fields[4], *names[3];
+ int cols[3];
+ GtkTreeIter iter;
+
+ switch(op)
+ {
+ case PHO_INIT:
+ model = gtk_list_store_new(4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT);
+ break;
+ case PHO_DATA:
+ while((p = memchr(buf, '\n', *len)) != NULL)
+ {
+ *(p++) = 0;
+ for(i = 0, p2 = buf; i < 4; i++) {