2 * Dolda Connect - Modular multiuser Direct Connect-style client
3 * Copyright (C) 2007 Fredrik Tolf <fredrik@dolda2000.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <doldaconnect/utils.h>
31 int pubhuboldhandler(int op, char *buf, size_t len)
33 static GtkListStore *model = NULL;
37 char *fields[4], *names[3];
44 model = gtk_list_store_new(4, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT);
48 while((p = memchr((p2 = p), '\n', len - (p - buf))) != NULL)
51 for(i = 0; i < 4; i++) {
53 if((p2 = strchr(p2, '|')) == NULL)
58 for(i = 0; i < 4; i++) {
59 if((wbuf = icsmbstowcs(fields[i], DCCHARSET, NULL)) == NULL) {
60 fields[i] = sstrdup(_("(Invalid character)"));
62 if((fields[i] = icwcstombs(wbuf, "UTF-8")) == NULL)
67 if(validhub(fields[0], fields[2], NULL)) {
68 gtk_list_store_append(model, &iter);
69 gtk_list_store_set(model, &iter, 0, fields[1], 1, fields[0], 2, fields[2], 3, atoi(fields[3]), -1);
79 cols[0] = 3; names[0] = _("# users");
80 cols[1] = 1; names[1] = _("Name");
81 cols[2] = 2; names[2] = _("Description");
82 setpubhubmodel(GTK_TREE_MODEL(model), 3, 3, cols, names);
86 g_object_unref(model);