Example #1
0
File: chat.c Project: VoxOx/VoxOx
static void roomlist_disco_result_cb(JabberStream *js, xmlnode *packet, gpointer data)
{
	xmlnode *query;
	xmlnode *item;
	const char *type;

	if(!js->roomlist)
		return;

	if(!(type = xmlnode_get_attrib(packet, "type")) || strcmp(type, "result")) {
		char *err = jabber_parse_error(js,packet);
		gaim_notify_error(js->gc, _("Error"),
				_("Error retrieving room list"), err);
		gaim_roomlist_set_in_progress(js->roomlist, FALSE);
		gaim_roomlist_unref(js->roomlist);
		js->roomlist = NULL;
		g_free(err);
		return;
	}

	if(!(query = xmlnode_get_child(packet, "query"))) {
		char *err = jabber_parse_error(js, packet);
		gaim_notify_error(js->gc, _("Error"),
				_("Error retrieving room list"), err);
		gaim_roomlist_set_in_progress(js->roomlist, FALSE);
		gaim_roomlist_unref(js->roomlist);
		js->roomlist = NULL;
		g_free(err);
		return;
	}

	for(item = xmlnode_get_child(query, "item"); item;
			item = xmlnode_get_next_twin(item)) {
		const char *name;
		GaimRoomlistRoom *room;
		JabberID *jid;

		if(!(jid = jabber_id_new(xmlnode_get_attrib(item, "jid"))))
			continue;
		name = xmlnode_get_attrib(item, "name");


		room = gaim_roomlist_room_new(GAIM_ROOMLIST_ROOMTYPE_ROOM, jid->node, NULL);
		gaim_roomlist_room_add_field(js->roomlist, room, jid->node);
		gaim_roomlist_room_add_field(js->roomlist, room, jid->domain);
		gaim_roomlist_room_add_field(js->roomlist, room, name ? name : "");
		gaim_roomlist_room_add(js->roomlist, room);

		jabber_id_free(jid);
	}
	gaim_roomlist_set_in_progress(js->roomlist, FALSE);
	gaim_roomlist_unref(js->roomlist);
	js->roomlist = NULL;
}
Example #2
0
File: chat.c Project: VoxOx/VoxOx
GaimRoomlist *jabber_roomlist_get_list(GaimConnection *gc)
{
	JabberStream *js = gc->proto_data;
	GList *fields = NULL;
	GaimRoomlistField *f;

	if(js->roomlist)
		gaim_roomlist_unref(js->roomlist);

	js->roomlist = gaim_roomlist_new(gaim_connection_get_account(js->gc));

	f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, "", "room", TRUE);
	fields = g_list_append(fields, f);

	f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, "", "server", TRUE);
	fields = g_list_append(fields, f);

	f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, _("Description"), "description", FALSE);
	fields = g_list_append(fields, f);

	gaim_roomlist_set_fields(js->roomlist, fields);


	gaim_request_input(gc, _("Enter a Conference Server"), _("Enter a Conference Server"),
			_("Select a conference server to query"),
			js->chat_servers ? js->chat_servers->data : "conference.jabber.org",
			FALSE, FALSE, NULL,
			_("Find Rooms"), GAIM_CALLBACK(roomlist_ok_cb),
			_("Cancel"), GAIM_CALLBACK(roomlist_cancel_cb), js);

	return js->roomlist;
}
Example #3
0
File: chat.c Project: VoxOx/VoxOx
static void roomlist_cancel_cb(JabberStream *js, const char *server) {
	if(js->roomlist) {
		gaim_roomlist_set_in_progress(js->roomlist, FALSE);
		gaim_roomlist_unref(js->roomlist);
		js->roomlist = NULL;
	}
}
Example #4
0
File: irc.c Project: VoxOx/VoxOx
static GaimRoomlist *irc_roomlist_get_list(GaimConnection *gc)
{
	struct irc_conn *irc;
	GList *fields = NULL;
	GaimRoomlistField *f;
	char *buf;

	irc = gc->proto_data;

	if (irc->roomlist)
		gaim_roomlist_unref(irc->roomlist);

	irc->roomlist = gaim_roomlist_new(gaim_connection_get_account(gc));

	f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, "", "channel", TRUE);
	fields = g_list_append(fields, f);

	f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_INT, _("Users"), "users", FALSE);
	fields = g_list_append(fields, f);

	f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, _("Topic"), "topic", FALSE);
	fields = g_list_append(fields, f);

	gaim_roomlist_set_fields(irc->roomlist, fields);

	buf = irc_format(irc, "v", "LIST");
	irc_send(irc, buf);
	g_free(buf);

	return irc->roomlist;
}
Example #5
0
File: group.c Project: VoxOx/VoxOx
/* free roomlist space, I have no idea when this one is called ... */
void qq_roomlist_cancel(GaimRoomlist *list)
{
	qq_data *qd;
	GaimConnection *gc;

	g_return_if_fail(list != NULL);
	gc = gaim_account_get_connection(list->account);

	qd = (qq_data *) gc->proto_data;
	gaim_roomlist_set_in_progress(list, FALSE);
	gaim_roomlist_unref(list);
}
Example #6
0
File: chat.c Project: VoxOx/VoxOx
void jabber_roomlist_cancel(GaimRoomlist *list)
{
	GaimConnection *gc;
	JabberStream *js;

	gc = gaim_account_get_connection(list->account);
	js = gc->proto_data;

	gaim_roomlist_set_in_progress(list, FALSE);

	if (js->roomlist == list) {
		js->roomlist = NULL;
		gaim_roomlist_unref(list);
	}
}
Example #7
0
File: irc.c Project: VoxOx/VoxOx
static void irc_roomlist_cancel(GaimRoomlist *list)
{
	GaimConnection *gc = gaim_account_get_connection(list->account);
	struct irc_conn *irc;

	if (gc == NULL)
		return;

	irc = gc->proto_data;

	gaim_roomlist_set_in_progress(list, FALSE);

	if (irc->roomlist == list) {
		irc->roomlist = NULL;
		gaim_roomlist_unref(list);
	}
}
Example #8
0
static void gaym_roomlist_cancel(struct _GaimRoomlist *list)
{
    GaimConnection *gc = gaim_account_get_connection(list->account);
    struct gaym_conn *gaym;

    if (gc == NULL)
        return;

    gaym = gc->proto_data;

    gaim_roomlist_set_in_progress(list, FALSE);

    if (gaym->roomlist == list) {
        g_list_free(g_list_nth_data(list->rooms, 0));
        gaym->roomlist = NULL;
        gaim_roomlist_unref(list);
    }

    if (gaym->roomlist_filter) {
        g_free(gaym->roomlist_filter);
        gaym->roomlist_filter = NULL;
    }
}
Example #9
0
static GaimRoomlist *gaym_roomlist_get_list(GaimConnection * gc)
{
    struct gaym_conn *gaym;
    GList *fields = NULL;
    GaimRoomlistField *f;
    char *buf;

    gaym = gc->proto_data;

    if (gaym->roomlist) {
        gaim_roomlist_unref(gaym->roomlist);
    }

    gaym->roomlist = gaim_roomlist_new(gaim_connection_get_account(gc));

    f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, _("Channel"),
                                "channel", FALSE);
    fields = g_list_prepend(fields, f);

    f = gaim_roomlist_field_new(GAIM_ROOMLIST_FIELD_STRING, "",
                                "description", TRUE);
    fields = g_list_prepend(fields, f);

    gaim_roomlist_set_fields(gaym->roomlist, fields);

    /**
     * Member created rooms are retrieved through the IRC protocol
     * and after the last response is recieved from that request
     * the static rooms are added
     */

    buf = gaym_format(gaym, "v", "LIST #_*");
    gaym_send(gaym, buf);
    g_free(buf);

    return gaym->roomlist;
}