static gint delete_win_cb(GtkWidget *w, GdkEventAny *e, gpointer d) { PidginRoomlistDialog *dialog = d; if (dialog->roomlist && purple_roomlist_get_in_progress(dialog->roomlist)) purple_roomlist_cancel_get_list(dialog->roomlist); if (dialog->pg_update_to > 0) purple_timeout_remove(dialog->pg_update_to); if (dialog->roomlist) { PidginRoomlist *rl = dialog->roomlist->ui_data; if (dialog->pg_update_to > 0) /* yes, that's right, unref it twice. */ purple_roomlist_unref(dialog->roomlist); if (rl) rl->dialog = NULL; purple_roomlist_unref(dialog->roomlist); } dialog->progress = NULL; g_free(dialog); return FALSE; }
static void roomlist_disco_result_cb(JabberStream *js, const char *from, JabberIqType type, const char *id, xmlnode *packet, gpointer data) { xmlnode *query; xmlnode *item; if(!js->roomlist) return; if (type == JABBER_IQ_ERROR) { char *err = jabber_parse_error(js, packet, NULL); purple_notify_error(js->gc, _("Error"), _("Error retrieving room list"), err); purple_roomlist_set_in_progress(js->roomlist, FALSE); purple_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, NULL); purple_notify_error(js->gc, _("Error"), _("Error retrieving room list"), err); purple_roomlist_set_in_progress(js->roomlist, FALSE); purple_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; PurpleRoomlistRoom *room; JabberID *jid; if(!(jid = jabber_id_new(xmlnode_get_attrib(item, "jid")))) continue; name = xmlnode_get_attrib(item, "name"); room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, jid->node, NULL); purple_roomlist_room_add_field(js->roomlist, room, jid->node); purple_roomlist_room_add_field(js->roomlist, room, jid->domain); purple_roomlist_room_add_field(js->roomlist, room, name ? name : ""); purple_roomlist_room_add(js->roomlist, room); jabber_id_free(jid); } purple_roomlist_set_in_progress(js->roomlist, FALSE); purple_roomlist_unref(js->roomlist); js->roomlist = NULL; }
static void roomlist_cancel_cb(JabberStream *js, const char *server) { if(js->roomlist) { purple_roomlist_set_in_progress(js->roomlist, FALSE); purple_roomlist_unref(js->roomlist); js->roomlist = NULL; } }
static PurpleRoomlist *irc_roomlist_get_list(PurpleConnection *gc) { struct irc_conn *irc; GList *fields = NULL; PurpleRoomlistField *f; char *buf; irc = gc->proto_data; if (irc->roomlist) purple_roomlist_unref(irc->roomlist); irc->roomlist = purple_roomlist_new(purple_connection_get_account(gc)); f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "channel", TRUE); fields = g_list_append(fields, f); f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_INT, _("Users"), "users", FALSE); fields = g_list_append(fields, f); f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, _("Topic"), "topic", FALSE); fields = g_list_append(fields, f); purple_roomlist_set_fields(irc->roomlist, fields); buf = irc_format(irc, "v", "LIST"); irc_send(irc, buf); g_free(buf); return irc->roomlist; }
PurpleRoomlist *jabber_roomlist_get_list(PurpleConnection *gc) { JabberStream *js = gc->proto_data; GList *fields = NULL; PurpleRoomlistField *f; if(js->roomlist) purple_roomlist_unref(js->roomlist); js->roomlist = purple_roomlist_new(purple_connection_get_account(js->gc)); f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "room", TRUE); fields = g_list_append(fields, f); f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "server", TRUE); fields = g_list_append(fields, f); f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, _("Description"), "description", FALSE); fields = g_list_append(fields, f); purple_roomlist_set_fields(js->roomlist, fields); purple_request_input(gc, _("Enter a Conference Server"), _("Enter a Conference Server"), _("Select a conference server to query"), js->chat_servers ? js->chat_servers->data : NULL, FALSE, FALSE, NULL, _("Find Rooms"), PURPLE_CALLBACK(roomlist_ok_cb), _("Cancel"), PURPLE_CALLBACK(roomlist_cancel_cb), purple_connection_get_account(gc), NULL, NULL, js); return js->roomlist; }
/* free roomlist space, I have no idea when this one is called... */ void qq_roomlist_cancel(PurpleRoomlist *list) { PurpleConnection *gc; g_return_if_fail(list != NULL); gc = purple_account_get_connection(list->account); purple_roomlist_set_in_progress(list, FALSE); purple_roomlist_unref(list); }
static void unset_roomlist(gpointer null) { froomlist.window = NULL; if (froomlist.roomlist) { purple_roomlist_unref(froomlist.roomlist); froomlist.roomlist = NULL; } froomlist.account = NULL; froomlist.tree = NULL; }
static void update_roomlist(PurpleRoomlist *list) { if (froomlist.roomlist == list) return; if (froomlist.roomlist) purple_roomlist_unref(froomlist.roomlist); if ((froomlist.roomlist = list) != NULL) purple_roomlist_ref(list); }
void tgprpl_roomlist_cancel (PurpleRoomlist *list) { PurpleConnection *gc = purple_account_get_connection (list->account); if (! gc) { return; } connection_data *conn = purple_connection_get_protocol_data (gc); purple_roomlist_set_in_progress (list, FALSE); if (conn->roomlist == list) { conn->roomlist = NULL; purple_roomlist_unref (list); } }
void jabber_roomlist_cancel(PurpleRoomlist *list) { PurpleConnection *gc; JabberStream *js; gc = purple_account_get_connection(list->account); js = gc->proto_data; purple_roomlist_set_in_progress(list, FALSE); if (js->roomlist == list) { js->roomlist = NULL; purple_roomlist_unref(list); } }
static void dialog_select_account_cb(GObject *w, PurpleAccount *account, PidginRoomlistDialog *dialog) { gboolean change = (account != dialog->account); dialog->account = account; if (change && dialog->roomlist) { PidginRoomlist *rl = dialog->roomlist->ui_data; if (rl->tree) { gtk_widget_destroy(rl->tree); rl->tree = NULL; } purple_roomlist_unref(dialog->roomlist); dialog->roomlist = NULL; } }
static void irc_roomlist_cancel(PurpleRoomlist *list) { PurpleConnection *gc = purple_account_get_connection(list->account); struct irc_conn *irc; if (gc == NULL) return; irc = gc->proto_data; purple_roomlist_set_in_progress(list, FALSE); if (irc->roomlist == list) { irc->roomlist = NULL; purple_roomlist_unref(list); } }
void campfire_roomlist_cancel(PurpleRoomlist * list) { PurpleConnection *gc = purple_account_get_connection(list->account); CampfireConn *campfire = NULL; if (gc == NULL) return; campfire = gc->proto_data; purple_roomlist_set_in_progress(list, FALSE); if (campfire->roomlist == list) { campfire->roomlist = NULL; purple_roomlist_unref(list); } }
PurpleRoomlist * campfire_roomlist_get_list(PurpleConnection * gc) { CampfireConn *campfire = gc->proto_data; GList *fields = NULL; PurpleRoomlistField *f; purple_debug_info("campfire", "initiating ROOMLIST GET LIST\n"); if (campfire->roomlist) { purple_roomlist_unref(campfire->roomlist); } campfire->roomlist = purple_roomlist_new(purple_connection_get_account(gc)); /*f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "room", TRUE); */ /*fields = g_list_append(fields, f); */ f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, _("Topic"), "topic", FALSE); fields = g_list_append(fields, f); f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", "id", TRUE); fields = g_list_append(fields, f); purple_roomlist_set_fields(campfire->roomlist, fields); purple_roomlist_set_in_progress(campfire->roomlist, TRUE); campfire_room_query(campfire); /*purple_roomlist_set_in_progress(campfire->roomlist, FALSE); */ /*purple_roomlist_unref(campfire->roomlist); */ /*campfire->roomlist = NULL; */ return campfire->roomlist; }
static void list_button_cb(GtkButton *button, PidginRoomlistDialog *dialog) { PurpleConnection *gc; PidginRoomlist *rl; gc = purple_account_get_connection(dialog->account); if (!gc) return; if (dialog->roomlist != NULL) { rl = dialog->roomlist->ui_data; gtk_widget_destroy(rl->tree); purple_roomlist_unref(dialog->roomlist); } dialog->roomlist = purple_roomlist_get_list(gc); if (!dialog->roomlist) return; purple_roomlist_ref(dialog->roomlist); rl = dialog->roomlist->ui_data; rl->dialog = dialog; if (dialog->account_widget) gtk_widget_set_sensitive(dialog->account_widget, FALSE); gtk_container_add(GTK_CONTAINER(dialog->sw), rl->tree); /* some protocols (not bundled with libpurple) finish getting their * room list immediately */ if(purple_roomlist_get_in_progress(dialog->roomlist)) { gtk_widget_set_sensitive(dialog->stop_button, TRUE); gtk_widget_set_sensitive(dialog->list_button, FALSE); } else { gtk_widget_set_sensitive(dialog->stop_button, FALSE); gtk_widget_set_sensitive(dialog->list_button, TRUE); } gtk_widget_set_sensitive(dialog->add_button, FALSE); gtk_widget_set_sensitive(dialog->join_button, FALSE); }
void irc_msg_list(struct irc_conn *irc, const char *name, const char *from, char **args) { if (!irc->roomlist) return; if (!strcmp(name, "321")) { purple_roomlist_set_in_progress(irc->roomlist, TRUE); return; } if (!strcmp(name, "323")) { purple_roomlist_set_in_progress(irc->roomlist, FALSE); purple_roomlist_unref(irc->roomlist); irc->roomlist = NULL; return; } if (!strcmp(name, "322")) { PurpleRoomlistRoom *room; char *topic; if (!args[0] || !args[1] || !args[2] || !args[3]) return; if (!purple_roomlist_get_in_progress(irc->roomlist)) { purple_debug_warning("irc", "Buggy server didn't send RPL_LISTSTART.\n"); purple_roomlist_set_in_progress(irc->roomlist, TRUE); } room = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_ROOM, args[1], NULL); purple_roomlist_room_add_field(irc->roomlist, room, args[1]); purple_roomlist_room_add_field(irc->roomlist, room, GINT_TO_POINTER(strtol(args[2], NULL, 10))); topic = irc_mirc2txt(args[3]); purple_roomlist_room_add_field(irc->roomlist, room, topic); g_free(topic); purple_roomlist_room_add(irc->roomlist, room); } }
PurpleRoomlist *tgprpl_roomlist_get_list (PurpleConnection *gc) { debug ("tgprpl_roomlist_get_list()"); connection_data *conn = purple_connection_get_protocol_data (gc); GList *fields = NULL; if (conn->roomlist) { purple_roomlist_unref (conn->roomlist); } conn->roomlist = purple_roomlist_new (purple_connection_get_account (gc)); PurpleRoomlistField *f = purple_roomlist_field_new (PURPLE_ROOMLIST_FIELD_STRING, "", "id", TRUE); fields = g_list_append (fields, f); f = purple_roomlist_field_new (PURPLE_ROOMLIST_FIELD_INT, _("Users in chat"), "users", FALSE); fields = g_list_append (fields, f); purple_roomlist_set_fields (conn->roomlist, fields); tgl_peer_iterator_ex (conn->TLS, tgp_chat_roomlist_it, conn); return conn->roomlist; }