pidgin: ff884d61: Some struct hiding. What a pain.
markdoliner at pidgin.im
markdoliner at pidgin.im
Tue Aug 23 01:45:54 EDT 2011
----------------------------------------------------------------------
Revision: ff884d612889ec8d5f9c23a58e101ce65245ea19
Parent: b7a866ecc5b4c0101311c4fe6bd15d27cd2a15a8
Author: markdoliner at pidgin.im
Date: 08/23/11 01:43:51
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/ff884d612889ec8d5f9c23a58e101ce65245ea19
Changelog:
Some struct hiding. What a pain.
Changes against parent b7a866ecc5b4c0101311c4fe6bd15d27cd2a15a8
patched ChangeLog.API
patched finch/gntroomlist.c
patched libpurple/protocols/irc/irc.c
patched libpurple/protocols/jabber/chat.c
patched libpurple/protocols/silc/chat.c
patched libpurple/protocols/yahoo/yahoochat.c
patched libpurple/roomlist.c
patched libpurple/roomlist.h
patched pidgin/gtkroomlist.c
-------------- next part --------------
============================================================
--- libpurple/protocols/irc/irc.c 2711e8001a672aebc7b00a5e18a167ff0a4372f6
+++ libpurple/protocols/irc/irc.c 38d815e25fb1c718ca7f71867f199971dd4759c3
@@ -890,7 +890,8 @@ static void irc_roomlist_cancel(PurpleRo
static void irc_roomlist_cancel(PurpleRoomlist *list)
{
- PurpleConnection *gc = purple_account_get_connection(list->account);
+ PurpleAccount *account = purple_roomlist_get_account(list);
+ PurpleConnection *gc = purple_account_get_connection(account);
struct irc_conn *irc;
if (gc == NULL)
============================================================
--- libpurple/protocols/yahoo/yahoochat.c 6d85b7b10ce44ee13d49c1d93d536b9a4a713314
+++ libpurple/protocols/yahoo/yahoochat.c 41dca2f605b046ea8821bb30e1d6f37c67100f20
@@ -1375,7 +1375,9 @@ static void yahoo_roomlist_cleanup(Purpl
purple_roomlist_set_in_progress(list, FALSE);
if (yrl) {
- list->proto_data = g_list_remove(list->proto_data, yrl);
+ GList *proto_data = purple_roomlist_get_proto_data(list);
+ proto_data = g_list_remove(proto_data, yrl);
+ purple_roomlist_set_proto_data(list, proto_data);
yahoo_roomlist_destroy(yrl);
}
@@ -1451,7 +1453,7 @@ static void yahoo_roomlist_send_cb(gpoin
yrl->inpa = 0;
g_free(yrl->txbuf);
yrl->txbuf = NULL;
- purple_notify_error(purple_account_get_connection(list->account), NULL, _("Unable to connect"), _("Fetching the room list failed."));
+ purple_notify_error(purple_account_get_connection(purple_roomlist_get_account(list)), NULL, _("Unable to connect"), _("Fetching the room list failed."));
yahoo_roomlist_cleanup(list, yrl);
return;
}
@@ -1474,10 +1476,12 @@ static void yahoo_roomlist_got_connected
{
struct yahoo_roomlist *yrl = data;
PurpleRoomlist *list = yrl->list;
- YahooData *yd = purple_account_get_connection(list->account)->proto_data;
+ PurpleAccount *account = purple_roomlist_get_account(list);
+ PurpleConnection *pc = purple_account_get_connection(account);
+ YahooData *yd = pc->proto_data;
if (source < 0) {
- purple_notify_error(purple_account_get_connection(list->account), NULL, _("Unable to connect"), _("Fetching the room list failed."));
+ purple_notify_error(pc, NULL, _("Unable to connect"), _("Fetching the room list failed."));
yahoo_roomlist_cleanup(list, yrl);
return;
}
@@ -1506,6 +1510,7 @@ PurpleRoomlist *yahoo_roomlist_get_list(
struct yahoo_roomlist *yrl;
const char *rll, *rlurl;
char *url;
+ GList *proto_data;
account = purple_connection_get_account(gc);
@@ -1556,7 +1561,9 @@ PurpleRoomlist *yahoo_roomlist_get_list(
return NULL;
}
- rl->proto_data = g_list_append(rl->proto_data, yrl);
+ proto_data = purple_roomlist_get_proto_data(rl);
+ proto_data = g_list_append(proto_data, yrl);
+ purple_roomlist_set_proto_data(rl, proto_data);
purple_roomlist_set_in_progress(rl, TRUE);
return rl;
@@ -1566,8 +1573,8 @@ void yahoo_roomlist_cancel(PurpleRoomlis
{
GList *l, *k;
- k = l = list->proto_data;
- list->proto_data = NULL;
+ k = l = purple_roomlist_get_proto_data(list);
+ purple_roomlist_set_proto_data(list, NULL);
purple_roomlist_set_in_progress(list, FALSE);
@@ -1580,48 +1587,54 @@ void yahoo_roomlist_expand_category(Purp
void yahoo_roomlist_expand_category(PurpleRoomlist *list, PurpleRoomlistRoom *category)
{
+ PurpleAccount *account;
struct yahoo_roomlist *yrl;
char *url;
char *id;
const char *rll;
+ GList *proto_data;
- if (category->type != PURPLE_ROOMLIST_ROOMTYPE_CATEGORY)
+ if (purple_roomlist_room_get_type(category) != PURPLE_ROOMLIST_ROOMTYPE_CATEGORY)
return;
- if (!(id = g_list_nth_data(category->fields, 1))) {
+ if (!(id = g_list_nth_data(purple_roomlist_room_get_fields(category), 1))) {
purple_roomlist_set_in_progress(list, FALSE);
return;
}
- rll = purple_account_get_string(list->account, "room_list_locale",
+ account = purple_roomlist_get_account(list);
+ rll = purple_account_get_string(account, "room_list_locale",
YAHOO_ROOMLIST_LOCALE);
if (rll != NULL && *rll != '\0') {
url = g_strdup_printf("%s?chatroom_%s=0&intl=%s",
- purple_account_get_string(list->account,"room_list",
+ purple_account_get_string(account,"room_list",
YAHOO_ROOMLIST_URL), id, rll);
} else {
url = g_strdup_printf("%s?chatroom_%s=0",
- purple_account_get_string(list->account,"room_list",
+ purple_account_get_string(account,"room_list",
YAHOO_ROOMLIST_URL), id);
}
yrl = g_new0(struct yahoo_roomlist, 1);
yrl->list = list;
yrl->cat = category;
- list->proto_data = g_list_append(list->proto_data, yrl);
+ proto_data = purple_roomlist_get_proto_data(list);
+ proto_data = g_list_append(proto_data, yrl);
+ purple_roomlist_set_proto_data(list, proto_data);
+
purple_url_parse(url, &(yrl->host), NULL, &(yrl->path), NULL, NULL);
g_free(url);
yrl->ucat = purple_roomlist_room_new(PURPLE_ROOMLIST_ROOMTYPE_CATEGORY, _("User Rooms"), yrl->cat);
purple_roomlist_room_add(list, yrl->ucat);
- if (purple_proxy_connect(purple_account_get_connection(list->account),
- list->account, yrl->host, 80,
+ if (purple_proxy_connect(purple_account_get_connection(account),
+ account, yrl->host, 80,
yahoo_roomlist_got_connected, yrl) == NULL)
{
- purple_notify_error(purple_account_get_connection(list->account),
+ purple_notify_error(purple_account_get_connection(account),
NULL, _("Connection problem"), _("Unable to fetch room list."));
purple_roomlist_ref(list);
yahoo_roomlist_cleanup(list, yrl);
============================================================
--- libpurple/protocols/jabber/chat.c 338a3fae5f4b20bacd627fb04c275c60fd12ad27
+++ libpurple/protocols/jabber/chat.c 995b5ae99f912a4cdb222c7fe541b1607406410f
@@ -887,8 +887,8 @@ char *jabber_roomlist_room_serialize(Pur
char *jabber_roomlist_room_serialize(PurpleRoomlistRoom *room)
{
-
- return g_strdup_printf("%s@%s", (char*)room->fields->data, (char*)room->fields->next->data);
+ GList *fields = purple_roomlist_room_get_fields(room);
+ return g_strdup_printf("%s@%s", (char*)fields->data, (char*)fields->next->data);
}
PurpleRoomlist *jabber_roomlist_get_list(PurpleConnection *gc)
@@ -928,10 +928,12 @@ void jabber_roomlist_cancel(PurpleRoomli
void jabber_roomlist_cancel(PurpleRoomlist *list)
{
+ PurpleAccount *account;
PurpleConnection *gc;
JabberStream *js;
- gc = purple_account_get_connection(list->account);
+ account = purple_roomlist_get_account(list);
+ gc = purple_account_get_connection(account);
js = gc->proto_data;
purple_roomlist_set_in_progress(list, FALSE);
============================================================
--- pidgin/gtkroomlist.c f8ac4c12c977283487864cf8a5259b9fa504a696
+++ pidgin/gtkroomlist.c 9782ab6ee158b1c675de5306e941f2cdda4812de
@@ -91,7 +91,7 @@ static gint delete_win_cb(GtkWidget *w,
purple_timeout_remove(dialog->pg_update_to);
if (dialog->roomlist) {
- PidginRoomlist *rl = dialog->roomlist->ui_data;
+ PidginRoomlist *rl = purple_roomlist_get_ui_data(dialog->roomlist);
if (dialog->pg_update_to > 0)
/* yes, that's right, unref it twice. */
@@ -115,7 +115,7 @@ static void dialog_select_account_cb(GOb
dialog->account = account;
if (change && dialog->roomlist) {
- PidginRoomlist *rl = dialog->roomlist->ui_data;
+ PidginRoomlist *rl = purple_roomlist_get_ui_data(dialog->roomlist);
if (rl->tree) {
gtk_widget_destroy(rl->tree);
rl->tree = NULL;
@@ -135,7 +135,7 @@ static void list_button_cb(GtkButton *bu
return;
if (dialog->roomlist != NULL) {
- rl = dialog->roomlist->ui_data;
+ rl = purple_roomlist_get_ui_data(dialog->roomlist);
gtk_widget_destroy(rl->tree);
purple_roomlist_unref(dialog->roomlist);
}
@@ -144,7 +144,7 @@ static void list_button_cb(GtkButton *bu
if (!dialog->roomlist)
return;
purple_roomlist_ref(dialog->roomlist);
- rl = dialog->roomlist->ui_data;
+ rl = purple_roomlist_get_ui_data(dialog->roomlist);
rl->dialog = dialog;
if (dialog->account_widget)
@@ -203,7 +203,7 @@ selection_changed_cb(GtkTreeSelection *s
val.g_type = 0;
gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val);
room = g_value_get_pointer(&val);
- if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) {
+ if (!room || !(purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM)) {
gtk_widget_set_sensitive(dialog->join_button, FALSE);
gtk_widget_set_sensitive(dialog->add_button, FALSE);
return;
@@ -228,7 +228,8 @@ static void do_add_room_cb(GtkWidget *w,
static void do_add_room_cb(GtkWidget *w, struct _menu_cb_info *info)
{
char *name;
- PurpleConnection *gc = purple_account_get_connection(info->list->account);
+ PurpleAccount *account = purple_roomlist_get_account(info->list);
+ PurpleConnection *gc = purple_account_get_connection(account);
PurplePluginProtocolInfo *prpl_info = NULL;
if(gc != NULL)
@@ -237,9 +238,9 @@ static void do_add_room_cb(GtkWidget *w,
if(prpl_info != NULL && prpl_info->roomlist_room_serialize)
name = prpl_info->roomlist_room_serialize(info->room);
else
- name = g_strdup(info->room->name);
+ name = g_strdup(purple_roomlist_room_get_name(info->room));
- purple_blist_request_add_chat(info->list->account, NULL, NULL, name);
+ purple_blist_request_add_chat(account, NULL, NULL, name);
g_free(name);
}
@@ -247,7 +248,7 @@ static void add_room_to_blist_cb(GtkButt
static void add_room_to_blist_cb(GtkButton *button, PidginRoomlistDialog *dialog)
{
PurpleRoomlist *rl = dialog->roomlist;
- PidginRoomlist *grl = rl->ui_data;
+ PidginRoomlist *grl = purple_roomlist_get_ui_data(rl);
struct _menu_cb_info *info = g_object_get_data(G_OBJECT(button), "room-info");
if(info != NULL)
@@ -262,7 +263,7 @@ static void join_button_cb(GtkButton *bu
static void join_button_cb(GtkButton *button, PidginRoomlistDialog *dialog)
{
PurpleRoomlist *rl = dialog->roomlist;
- PidginRoomlist *grl = rl->ui_data;
+ PidginRoomlist *grl = purple_roomlist_get_ui_data(rl);
struct _menu_cb_info *info = g_object_get_data(G_OBJECT(button), "room-info");
if(info != NULL)
@@ -272,7 +273,7 @@ static void row_activated_cb(GtkTreeView
static void row_activated_cb(GtkTreeView *tv, GtkTreePath *path, GtkTreeViewColumn *arg2,
PurpleRoomlist *list)
{
- PidginRoomlist *grl = list->ui_data;
+ PidginRoomlist *grl = purple_roomlist_get_ui_data(list);
GtkTreeIter iter;
PurpleRoomlistRoom *room;
GValue val;
@@ -282,7 +283,7 @@ static void row_activated_cb(GtkTreeView
val.g_type = 0;
gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val);
room = g_value_get_pointer(&val);
- if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM))
+ if (!room || !(purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM))
return;
info.list = list;
@@ -294,7 +295,7 @@ static gboolean room_click_cb(GtkWidget
static gboolean room_click_cb(GtkWidget *tv, GdkEventButton *event, PurpleRoomlist *list)
{
GtkTreePath *path;
- PidginRoomlist *grl = list->ui_data;
+ PidginRoomlist *grl = purple_roomlist_get_ui_data(list);
GValue val;
PurpleRoomlistRoom *room;
GtkTreeIter iter;
@@ -313,7 +314,7 @@ static gboolean room_click_cb(GtkWidget
gtk_tree_model_get_value (GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val);
room = g_value_get_pointer(&val);
- if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM))
+ if (!room || !(purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM))
return FALSE;
info.list = list;
@@ -341,9 +342,9 @@ static void row_expanded_cb(GtkTreeView
gtk_tree_model_get_value(gtk_tree_view_get_model(treeview), arg1, ROOM_COLUMN, &val);
category = g_value_get_pointer(&val);
- if (!category->expanded_once) {
+ if (!purple_roomlist_room_get_expanded_once(category)) {
purple_roomlist_expand_category(list, category);
- category->expanded_once = TRUE;
+ purple_roomlist_room_set_expanded_once(category, TRUE);
}
}
@@ -354,7 +355,7 @@ pidgin_roomlist_paint_tooltip(GtkWidget
pidgin_roomlist_paint_tooltip(GtkWidget *widget, gpointer user_data)
{
PurpleRoomlist *list = user_data;
- PidginRoomlist *grl = list->ui_data;
+ PidginRoomlist *grl = purple_roomlist_get_ui_data(list);
GtkStyle *style;
int current_height, max_width;
int max_text_width;
@@ -393,7 +394,7 @@ static gboolean pidgin_roomlist_create_t
static gboolean pidgin_roomlist_create_tip(PurpleRoomlist *list, GtkTreePath *path)
{
- PidginRoomlist *grl = list->ui_data;
+ PidginRoomlist *grl = purple_roomlist_get_ui_data(list);
PurpleRoomlistRoom *room;
GtkTreeIter iter;
GValue val;
@@ -414,19 +415,23 @@ static gboolean pidgin_roomlist_create_t
gtk_tree_model_get_value(GTK_TREE_MODEL(grl->model), &iter, ROOM_COLUMN, &val);
room = g_value_get_pointer(&val);
- if (!room || !(room->type & PURPLE_ROOMLIST_ROOMTYPE_ROOM))
+ if (!room || !(purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_ROOM))
return FALSE;
tooltip_text = g_string_new("");
gtk_tree_model_get(GTK_TREE_MODEL(grl->model), &iter, NAME_COLUMN, &name, -1);
- for (j = NUM_OF_COLUMNS, l = room->fields, k = list->fields; l && k; j++, l = l->next, k = k->next) {
+ for (j = NUM_OF_COLUMNS,
+ l = purple_roomlist_room_get_fields(room),
+ k = purple_roomlist_get_fields(list);
+ l && k; j++, l = l->next, k = k->next)
+ {
PurpleRoomlistField *f = k->data;
gchar *label;
- if (f->hidden)
+ if (purple_roomlist_field_get_hidden(f))
continue;
- label = g_markup_escape_text(f->label, -1);
- switch (f->type) {
+ label = g_markup_escape_text(purple_roomlist_field_get_label(f), -1);
+ switch (purple_roomlist_field_get_type(f)) {
case PURPLE_ROOMLIST_FIELD_BOOL:
g_string_append_printf(tooltip_text, "%s<b>%s:</b> %s", first ? "" : "\n", label, l->data ? "True" : "False");
break;
@@ -478,7 +483,7 @@ pidgin_roomlist_create_tooltip(GtkWidget
gpointer data, int *w, int *h)
{
PurpleRoomlist *list = data;
- PidginRoomlist *grl = list->ui_data;
+ PidginRoomlist *grl = purple_roomlist_get_ui_data(list);
grl->tipwindow = widget;
if (!pidgin_roomlist_create_tip(data, path))
return FALSE;
@@ -622,7 +627,7 @@ static void pidgin_roomlist_new(PurpleRo
{
PidginRoomlist *rl = g_new0(PidginRoomlist, 1);
- list->ui_data = rl;
+ purple_roomlist_set_ui_data(list, rl);
rl->cats = g_hash_table_new_full(NULL, NULL, NULL, (GDestroyNotify)gtk_tree_row_reference_free);
@@ -685,7 +690,7 @@ static void pidgin_roomlist_set_fields(P
static void pidgin_roomlist_set_fields(PurpleRoomlist *list, GList *fields)
{
- PidginRoomlist *grl = list->ui_data;
+ PidginRoomlist *grl = purple_roomlist_get_ui_data(list);
gint columns = NUM_OF_COLUMNS;
int j;
GtkTreeStore *model;
@@ -707,7 +712,7 @@ static void pidgin_roomlist_set_fields(P
for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) {
PurpleRoomlistField *f = l->data;
- switch (f->type) {
+ switch (purple_roomlist_field_get_type(f)) {
case PURPLE_ROOMLIST_FIELD_BOOL:
types[j] = G_TYPE_BOOLEAN;
break;
@@ -749,18 +754,19 @@ static void pidgin_roomlist_set_fields(P
for (j = NUM_OF_COLUMNS, l = fields; l; l = l->next, j++) {
PurpleRoomlistField *f = l->data;
- if (f->hidden)
+ if (purple_roomlist_field_get_hidden(f))
continue;
renderer = gtk_cell_renderer_text_new();
- column = gtk_tree_view_column_new_with_attributes(f->label, renderer,
- "text", j, NULL);
+ column = gtk_tree_view_column_new_with_attributes(
+ purple_roomlist_field_get_label(f), renderer,
+ "text", j, NULL);
gtk_tree_view_column_set_sizing(GTK_TREE_VIEW_COLUMN(column),
GTK_TREE_VIEW_COLUMN_GROW_ONLY);
gtk_tree_view_column_set_resizable(GTK_TREE_VIEW_COLUMN(column), TRUE);
gtk_tree_view_column_set_sort_column_id(GTK_TREE_VIEW_COLUMN(column), j);
gtk_tree_view_column_set_reorderable(GTK_TREE_VIEW_COLUMN(column), TRUE);
- if (f->type == PURPLE_ROOMLIST_FIELD_INT) {
+ if (purple_roomlist_field_get_type(f) == PURPLE_ROOMLIST_FIELD_INT) {
gtk_tree_view_column_set_cell_data_func(column, renderer, int_cell_data_func,
GINT_TO_POINTER(j), NULL);
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(model), j, int_sort_func,
@@ -789,7 +795,7 @@ static gboolean pidgin_progress_bar_puls
static gboolean pidgin_progress_bar_pulse(gpointer data)
{
PurpleRoomlist *list = data;
- PidginRoomlist *rl = list->ui_data;
+ PidginRoomlist *rl = purple_roomlist_get_ui_data(list);
if (!rl || !rl->dialog || !rl->dialog->pg_needs_pulse) {
if (rl && rl->dialog)
@@ -805,7 +811,7 @@ static void pidgin_roomlist_add_room(Pur
static void pidgin_roomlist_add_room(PurpleRoomlist *list, PurpleRoomlistRoom *room)
{
- PidginRoomlist *rl = list->ui_data;
+ PidginRoomlist *rl = purple_roomlist_get_ui_data(list);
GtkTreeRowReference *rr, *parentrr = NULL;
GtkTreePath *path;
GtkTreeIter iter, parent, child;
@@ -814,7 +820,7 @@ static void pidgin_roomlist_add_room(Pur
gboolean append = TRUE;
rl->total_rooms++;
- if (room->type == PURPLE_ROOMLIST_ROOMTYPE_ROOM)
+ if (purple_roomlist_room_get_type(room) == PURPLE_ROOMLIST_ROOMTYPE_ROOM)
rl->num_rooms++;
if (rl->dialog) {
@@ -826,8 +832,8 @@ static void pidgin_roomlist_add_room(Pur
rl->dialog->pg_needs_pulse = TRUE;
}
- if (room->parent) {
- parentrr = g_hash_table_lookup(rl->cats, room->parent);
+ if (purple_roomlist_room_get_parent(room)) {
+ parentrr = g_hash_table_lookup(rl->cats, purple_roomlist_room_get_parent(room));
path = gtk_tree_row_reference_get_path(parentrr);
if (path) {
PurpleRoomlistRoom *tmproom = NULL;
@@ -848,24 +854,28 @@ static void pidgin_roomlist_add_room(Pur
else
iter = child;
- if (room->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY)
+ if (purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY)
gtk_tree_store_append(rl->model, &child, &iter);
path = gtk_tree_model_get_path(GTK_TREE_MODEL(rl->model), &iter);
- if (room->type & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) {
+ if (purple_roomlist_room_get_type(room) & PURPLE_ROOMLIST_ROOMTYPE_CATEGORY) {
rr = gtk_tree_row_reference_new(GTK_TREE_MODEL(rl->model), path);
g_hash_table_insert(rl->cats, room, rr);
}
gtk_tree_path_free(path);
- gtk_tree_store_set(rl->model, &iter, NAME_COLUMN, room->name, -1);
+ gtk_tree_store_set(rl->model, &iter, NAME_COLUMN, purple_roomlist_room_get_name(room), -1);
gtk_tree_store_set(rl->model, &iter, ROOM_COLUMN, room, -1);
- for (j = NUM_OF_COLUMNS, l = room->fields, k = list->fields; l && k; j++, l = l->next, k = k->next) {
+ for (j = NUM_OF_COLUMNS,
+ l = purple_roomlist_room_get_fields(room),
+ k = purple_roomlist_get_fields(list);
+ l && k; j++, l = l->next, k = k->next)
+ {
PurpleRoomlistField *f = k->data;
- if (f->hidden)
+ if (purple_roomlist_field_get_hidden(f))
continue;
gtk_tree_store_set(rl->model, &iter, j, l->data, -1);
}
@@ -873,7 +883,7 @@ static void pidgin_roomlist_in_progress(
static void pidgin_roomlist_in_progress(PurpleRoomlist *list, gboolean in_progress)
{
- PidginRoomlist *rl = list->ui_data;
+ PidginRoomlist *rl = purple_roomlist_get_ui_data(list);
if (!rl || !rl->dialog)
return;
@@ -895,7 +905,7 @@ static void pidgin_roomlist_destroy(Purp
static void pidgin_roomlist_destroy(PurpleRoomlist *list)
{
- PidginRoomlist *rl = list->ui_data;
+ PidginRoomlist *rl = purple_roomlist_get_ui_data(list);
roomlists = g_list_remove(roomlists, list);
@@ -903,7 +913,7 @@ static void pidgin_roomlist_destroy(Purp
g_hash_table_destroy(rl->cats);
g_free(rl);
- list->ui_data = NULL;
+ purple_roomlist_set_ui_data(list, NULL);
}
static PurpleRoomlistUiOps ops = {
============================================================
--- libpurple/roomlist.c 1946bbe953c69bdf2acfa1ebd0690d908287cbcc
+++ libpurple/roomlist.c 04b60f0d85d7808c453b69ccdbc83d4d8df840e3
@@ -32,7 +32,40 @@
#include "roomlist.h"
#include "server.h"
+/**
+ * Represents a list of rooms for a given connection on a given protocol.
+ */
+struct _PurpleRoomlist {
+ PurpleAccount *account; /**< The account this list belongs to. */
+ GList *fields; /**< The fields. */
+ GList *rooms; /**< The list of rooms. */
+ gboolean in_progress; /**< The listing is in progress. */
+ gpointer ui_data; /**< UI private data. */
+ gpointer proto_data; /** Prpl private data. */
+ guint ref; /**< The reference count. */
+};
+/**
+ * Represents a room.
+ */
+struct _PurpleRoomlistRoom {
+ PurpleRoomlistRoomType type; /**< The type of room. */
+ gchar *name; /**< The name of the room. */
+ GList *fields; /**< Other fields. */
+ PurpleRoomlistRoom *parent; /**< The parent room, or NULL. */
+ gboolean expanded_once; /**< A flag the UI uses to avoid multiple expand prpl cbs. */
+};
+
+/**
+ * A field a room might have.
+ */
+struct _PurpleRoomlistField {
+ PurpleRoomlistFieldType type; /**< The type of field. */
+ gchar *label; /**< The i18n user displayed name of the field. */
+ gchar *name; /**< The internal name of the field. */
+ gboolean hidden; /**< Hidden? */
+};
+
static PurpleRoomlistUiOps *ops = NULL;
/**************************************************************************/
@@ -127,6 +160,13 @@ void purple_roomlist_unref(PurpleRoomlis
purple_roomlist_destroy(list);
}
+PurpleAccount *purple_roomlist_get_account(PurpleRoomlist *list)
+{
+ g_return_val_if_fail(list != NULL, NULL);
+
+ return list->account;
+}
+
void purple_roomlist_set_fields(PurpleRoomlist *list, GList *fields)
{
g_return_if_fail(list != NULL);
@@ -234,6 +274,34 @@ GList * purple_roomlist_get_fields(Purpl
return list->fields;
}
+gpointer purple_roomlist_get_proto_data(PurpleRoomlist *list)
+{
+ g_return_val_if_fail(list != NULL, NULL);
+
+ return list->proto_data;
+}
+
+void purple_roomlist_set_proto_data(PurpleRoomlist *list, gpointer proto_data)
+{
+ g_return_if_fail(list != NULL);
+
+ list->proto_data = proto_data;
+}
+
+gpointer purple_roomlist_get_ui_data(PurpleRoomlist *list)
+{
+ g_return_val_if_fail(list != NULL, NULL);
+
+ return list->ui_data;
+}
+
+void purple_roomlist_set_ui_data(PurpleRoomlist *list, gpointer ui_data)
+{
+ g_return_if_fail(list != NULL);
+
+ list->ui_data = ui_data;
+}
+
/*@}*/
/**************************************************************************/
@@ -329,8 +397,22 @@ PurpleRoomlistRoom * purple_roomlist_roo
return room->parent;
}
-GList * purple_roomlist_room_get_fields(PurpleRoomlistRoom *room)
+gboolean purple_roomlist_room_get_expanded_once(PurpleRoomlistRoom *room)
{
+ g_return_val_if_fail(room != NULL, NULL);
+
+ return room->expanded_once;
+}
+
+void purple_roomlist_room_set_expanded_once(PurpleRoomlistRoom *room, gboolean expanded_once)
+{
+ g_return_val_if_fail(room != NULL, NULL);
+
+ room->expanded_once = expanded_once;
+}
+
+GList *purple_roomlist_room_get_fields(PurpleRoomlistRoom *room)
+{
return room->fields;
}
============================================================
--- libpurple/roomlist.h 4a338ddccc4e0a04fa0eb0590475e10b4abff12c
+++ libpurple/roomlist.h a0a532452b4c81a8a5e7a2d51439a09cdee788de
@@ -64,40 +64,6 @@ typedef enum
/**************************************************************************/
/**
- * Represents a list of rooms for a given connection on a given protocol.
- */
-struct _PurpleRoomlist {
- PurpleAccount *account; /**< The account this list belongs to. */
- GList *fields; /**< The fields. */
- GList *rooms; /**< The list of rooms. */
- gboolean in_progress; /**< The listing is in progress. */
- gpointer ui_data; /**< UI private data. */
- gpointer proto_data; /** Prpl private data. */
- guint ref; /**< The reference count. */
-};
-
-/**
- * Represents a room.
- */
-struct _PurpleRoomlistRoom {
- PurpleRoomlistRoomType type; /**< The type of room. */
- gchar *name; /**< The name of the room. */
- GList *fields; /**< Other fields. */
- PurpleRoomlistRoom *parent; /**< The parent room, or NULL. */
- gboolean expanded_once; /**< A flag the UI uses to avoid multiple expand prpl cbs. */
-};
-
-/**
- * A field a room might have.
- */
-struct _PurpleRoomlistField {
- PurpleRoomlistFieldType type; /**< The type of field. */
- gchar *label; /**< The i18n user displayed name of the field. */
- gchar *name; /**< The internal name of the field. */
- gboolean hidden; /**< Hidden? */
-};
-
-/**
* The room list ops to be filled out by the UI.
*/
struct _PurpleRoomlistUiOps {
@@ -163,6 +129,14 @@ void purple_roomlist_unref(PurpleRoomlis
void purple_roomlist_unref(PurpleRoomlist *list);
/**
+ * Retrieve the PurpleAccount that was given when the room list was
+ * created.
+ *
+ * @return The PurpleAccount tied to this room list.
+ */
+PurpleAccount *purple_roomlist_get_account(PurpleRoomlist *list);
+
+/**
* Set the different field types and their names for this protocol.
*
* This must be called before purple_roomlist_room_add().
@@ -241,12 +215,50 @@ void purple_roomlist_expand_category(Pur
/**
* Get the list of fields for a roomlist.
*
- * @param roomlist The roomlist, which must not be @c NULL.
+ * @param roomlist The roomlist, which must not be @c NULL.
* @constreturn A list of fields
* @since 2.4.0
*/
-GList * purple_roomlist_get_fields(PurpleRoomlist *roomlist);
+GList *purple_roomlist_get_fields(PurpleRoomlist *roomlist);
+/**
+ * Get the protocol data associated with this room list.
+ *
+ * @param roomlist The roomlist, which must not be @c NULL.
+ *
+ * @return The protocol data associated with this room list. This is a
+ * convenience field provided to the protocol plugin--it is not
+ * used the libuprple core.
+ */
+gpointer purple_roomlist_get_proto_data(PurpleRoomlist *list);
+
+/**
+ * Set the protocol data associated with this room list.
+ *
+ * @param list The roomlist, which must not be @c NULL.
+ * @param proto_data A pointer to associate with this room list.
+ */
+void purple_roomlist_set_proto_data(PurpleRoomlist *list, gpointer proto_data);
+
+/**
+ * Get the UI data associated with this room list.
+ *
+ * @param roomlist The roomlist, which must not be @c NULL.
+ *
+ * @return The UI data associated with this room list. This is a
+ * convenience field provided to the UIs--it is not
+ * used by the libuprple core.
+ */
+gpointer purple_roomlist_get_ui_data(PurpleRoomlist *list);
+
+/**
+ * Set the UI data associated with this room list.
+ *
+ * @param list The roomlist, which must not be @c NULL.
+ * @param UI_data A pointer to associate with this room list.
+ */
+void purple_roomlist_set_ui_data(PurpleRoomlist *list, gpointer ui_data);
+
/*@}*/
/**************************************************************************/
@@ -308,6 +320,23 @@ PurpleRoomlistRoom * purple_roomlist_roo
PurpleRoomlistRoom * purple_roomlist_room_get_parent(PurpleRoomlistRoom *room);
/**
+ * Get the value of the expanded_once flag.
+ *
+ * @param room The room, which must not be @c NULL.
+ *
+ * @return The value of the expanded_once flag.
+ */
+gboolean purple_roomlist_room_get_expanded_once(PurpleRoomlistRoom *room);
+
+/**
+ * Set the expanded_once flag.
+ *
+ * @param room The room, which must not be @c NULL.
+ * @param expanded_once The new value of the expanded_once flag.
+ */
+void purple_roomlist_room_set_expanded_once(PurpleRoomlistRoom *room, gboolean expanded_once);
+
+/**
* Get the list of fields for a room.
*
* @param room The room, which must not be @c NULL.
============================================================
--- libpurple/protocols/silc/chat.c ea6c53dd81fef7750bcfcb5b05fb23b6b6c19e8d
+++ libpurple/protocols/silc/chat.c 7a9bb661f1cd3c21884939c66c39458b27cdeff5
@@ -1419,7 +1419,8 @@ void silcpurple_roomlist_cancel(PurpleRo
void silcpurple_roomlist_cancel(PurpleRoomlist *list)
{
- PurpleConnection *gc = purple_account_get_connection(list->account);
+ PurpleAccount *account = purple_roomlist_get_account(list);
+ PurpleConnection *gc = purple_account_get_connection(account);
SilcPurple sg;
if (!gc)
============================================================
--- ChangeLog.API d0f039eb637238904b4411b9abdb3aab63053db8
+++ ChangeLog.API 66a7f5dcab63f39c3cd56ab717e595580914149f
@@ -8,6 +8,13 @@ version 3.0.0 (??/??/????):
* purple_notify_user_info_prepend_pair_plaintext
* purple_request_field_set_tooltip
* purple_request_field_get_tooltip
+ * purple_roomlist_get_account
+ * purple_roomlist_get_proto_data
+ * purple_roomlist_get_ui_data
+ * purple_roomlist_room_get_expanded_once
+ * purple_roomlist_room_set_expanded_once
+ * purple_roomlist_set_proto_data
+ * purple_roomlist_set_ui_data
Changed:
* purple_connection_error now takes a PurpleConnectionError
@@ -65,6 +72,9 @@ version 3.0.0 (??/??/????):
* PurpleConnectionUiOps.report_disconnect_reason
* struct _GtkIMHtmlFontDetail
* struct _PurpleRequestField
+ * struct _PurpleRoomlist
+ * struct _PurpleRoomlistField
+ * struct _PurpleRoomlistRoom
version 2.10.0:
libpurple:
============================================================
--- finch/gntroomlist.c 0eccbc6c4217925daa79267b56fe88f1eca588ae
+++ finch/gntroomlist.c 13ae5cb22786e7830e878fcaecb7ce0988accc44
@@ -41,6 +41,12 @@
#define PREF_ROOT "/finch/roomlist"
+#undef FINCH_GET_DATA
+#undef FINCH_SET_DATA
+#define FINCH_GET_DATA(obj) purple_roomlist_get_ui_data(obj)
+#define FINCH_SET_DATA(obj, data) purple_roomlist_set_ui_data(obj, data)
+
+
/* Yes, just one roomlist at a time. Let's not get greedy. Aight? */
struct _FinchRoomlist
{
@@ -146,9 +152,9 @@ roomlist_activated(GntWidget *widget)
purple_roomlist_room_join(froomlist.roomlist, room);
break;
case PURPLE_ROOMLIST_ROOMTYPE_CATEGORY:
- if (!room->expanded_once) {
+ if (!purple_roomlist_room_get_expanded_once(room)) {
purple_roomlist_expand_category(froomlist.roomlist, room);
- room->expanded_once = TRUE;
+ purple_roomlist_room_set_expanded_once(room, TRUE);
}
break;
}
More information about the Commits
mailing list