pidgin: fa663cc3: Use purple_conversation accessor methods...
andrew.victor at mxit.com
andrew.victor at mxit.com
Sat Oct 1 12:31:57 EDT 2011
----------------------------------------------------------------------
Revision: fa663cc35615b2035b66787a7f89127ae3ba2605
Parent: 26f34e91897b37c04c5520e69194fd33268009aa
Author: andrew.victor at mxit.com
Date: 10/01/11 12:21:16
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/fa663cc35615b2035b66787a7f89127ae3ba2605
Changelog:
Use purple_conversation accessor methods.
Changes against parent 26f34e91897b37c04c5520e69194fd33268009aa
patched pidgin/gtkconv.c
patched pidgin/gtksound.c
patched pidgin/gtkutils.c
-------------- next part --------------
============================================================
--- pidgin/gtkconv.c e08b9a4db7f235614197b23db863d34f73b54f7d
+++ pidgin/gtkconv.c 54d5465ce71ade2c4a39b496382d99c4ecc9f535
@@ -1093,7 +1093,8 @@ menu_save_as_cb(gpointer data, guint act
{
PidginWindow *win = data;
PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win);
- PurpleBuddy *buddy = purple_find_buddy(conv->account, purple_conversation_get_name(conv));
+ PurpleAccount *account = purple_conversation_get_account(conv);
+ PurpleBuddy *buddy = purple_find_buddy(account, purple_conversation_get_name(conv));
const char *name;
gchar *buf;
gchar *c;
@@ -1101,7 +1102,7 @@ menu_save_as_cb(gpointer data, guint act
if (buddy != NULL)
name = purple_buddy_get_contact_alias(buddy);
else
- name = purple_normalize(conv->account, purple_conversation_get_name(conv));
+ name = purple_normalize(account, purple_conversation_get_name(conv));
buf = g_strdup_printf("%s.html", name);
for (c = buf ; *c ; c++)
@@ -1644,6 +1645,7 @@ create_chat_menu(PurpleConversation *con
static GtkWidget *menu = NULL;
PurplePluginProtocolInfo *prpl_info = NULL;
PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
+ PurpleAccount *account = purple_conversation_get_account(conv);
gboolean is_me = FALSE;
GtkWidget *button;
PurpleBuddy *buddy = NULL;
@@ -1658,7 +1660,7 @@ create_chat_menu(PurpleConversation *con
if (menu)
gtk_widget_destroy(menu);
- if (!strcmp(purple_conv_chat_get_nick(chat), purple_normalize(conv->account, who)))
+ if (!strcmp(purple_conv_chat_get_nick(chat), purple_normalize(account, who)))
is_me = TRUE;
menu = gtk_menu_new();
@@ -1724,7 +1726,7 @@ create_chat_menu(PurpleConversation *con
}
if (!is_me && prpl_info && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) {
- if ((buddy = purple_find_buddy(conv->account, who)) != NULL)
+ if ((buddy = purple_find_buddy(account, who)) != NULL)
button = pidgin_new_item_from_stock(menu, _("Remove"), GTK_STOCK_REMOVE,
G_CALLBACK(menu_chat_add_remove_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL);
else
@@ -1745,8 +1747,8 @@ create_chat_menu(PurpleConversation *con
if (buddy != NULL)
{
- if (purple_account_is_connected(conv->account))
- pidgin_append_blist_node_proto_menu(menu, conv->account->gc,
+ if (purple_account_is_connected(account))
+ pidgin_append_blist_node_proto_menu(menu, account->gc,
(PurpleBlistNode *)buddy);
pidgin_append_blist_node_extended_menu(menu, (PurpleBlistNode *)buddy);
gtk_widget_show_all(menu);
@@ -2301,7 +2303,7 @@ pidgin_conv_switch_active_conversation(P
gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging)));
entry = GTK_IMHTML(gtkconv->entry);
- protocol_name = purple_account_get_protocol_name(conv->account);
+ protocol_name = purple_account_get_protocol_name(purple_conversation_get_account(conv));
gtk_imhtml_set_protocol_name(entry, protocol_name);
/* TODO WEBKIT: gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol_name); */
@@ -2601,7 +2603,7 @@ update_tab_icon(PurpleConversation *conv
status = infopane_status = pidgin_conv_get_icon_stock(conv);
if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
- PurpleBuddy *b = purple_find_buddy(conv->account, purple_conversation_get_name(conv));
+ PurpleBuddy *b = purple_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv));
if (b)
emblem = pidgin_blist_get_emblem((PurpleBlistNode*)b);
}
@@ -2622,7 +2624,7 @@ update_tab_icon(PurpleConversation *conv
g_object_unref(emblem);
if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_protocol_icons")) {
- emblem = pidgin_create_prpl_icon(gtkconv->active_conv->account, PIDGIN_PRPL_ICON_SMALL);
+ emblem = pidgin_create_prpl_icon(purple_conversation_get_account(gtkconv->active_conv), PIDGIN_PRPL_ICON_SMALL);
} else {
emblem = NULL;
}
@@ -2885,11 +2887,11 @@ icon_menu_save_cb(GtkWidget *widget, Pid
ext = purple_buddy_icon_get_extension(purple_conv_im_get_icon(PURPLE_CONV_IM(conv)));
- buf = g_strdup_printf("%s.%s", purple_normalize(conv->account, purple_conversation_get_name(conv)), ext);
+ buf = g_strdup_printf("%s.%s", purple_normalize(purple_conversation_get_account(conv), purple_conversation_get_name(conv)), ext);
purple_request_file(gtkconv, _("Save Icon"), buf, TRUE,
G_CALLBACK(saveicon_writefile_cb), NULL,
- conv->account, NULL, conv,
+ purple_conversation_get_account(conv), NULL, conv,
gtkconv);
g_free(buf);
@@ -3229,15 +3231,17 @@ populate_menu_with_options(GtkWidget *me
{
GList *list;
PurpleConversation *conv;
+ PurpleAccount *account;
PurpleBlistNode *node = NULL;
PurpleChat *chat = NULL;
PurpleBuddy *buddy = NULL;
gboolean ret;
conv = gtkconv->active_conv;
+ account = purple_conversation_get_account(conv);
if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
- chat = purple_blist_find_chat(conv->account, purple_conversation_get_name(conv));
+ chat = purple_blist_find_chat(account, purple_conversation_get_name(conv));
if ((chat == NULL) && (gtkconv->webview != NULL)) {
chat = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_chat");
@@ -3258,17 +3262,17 @@ populate_menu_with_options(GtkWidget *me
g_hash_table_replace(components, g_strdup("channel"),
g_strdup(purple_conversation_get_name(conv)));
}
- chat = purple_chat_new(conv->account, NULL, components);
+ chat = purple_chat_new(account, NULL, components);
purple_blist_node_set_flags((PurpleBlistNode *)chat,
PURPLE_BLIST_NODE_FLAG_NO_SAVE);
g_object_set_data_full(G_OBJECT(gtkconv->webview), "transient_chat",
chat, (GDestroyNotify)purple_blist_remove_chat);
}
} else {
- if (!purple_account_is_connected(conv->account))
+ if (!purple_account_is_connected(account))
return FALSE;
- buddy = purple_find_buddy(conv->account, purple_conversation_get_name(conv));
+ buddy = purple_find_buddy(account, purple_conversation_get_name(conv));
/* gotta remain bug-compatible :( libpurple < 2.0.2 didn't handle
* removing "isolated" buddy nodes well */
@@ -3278,7 +3282,7 @@ populate_menu_with_options(GtkWidget *me
}
if ((buddy == NULL) && (gtkconv->webview != NULL)) {
- buddy = purple_buddy_new(conv->account, purple_conversation_get_name(conv), NULL);
+ buddy = purple_buddy_new(account, purple_conversation_get_name(conv), NULL);
purple_blist_node_set_flags((PurpleBlistNode *)buddy,
PURPLE_BLIST_NODE_FLAG_NO_SAVE);
g_object_set_data_full(G_OBJECT(gtkconv->webview), "transient_buddy",
@@ -3300,8 +3304,8 @@ populate_menu_with_options(GtkWidget *me
/* XXX: */
}
} else if (node) {
- if (purple_account_is_connected(conv->account))
- pidgin_append_blist_node_proto_menu(menu, conv->account->gc, node);
+ if (purple_account_is_connected(account))
+ pidgin_append_blist_node_proto_menu(menu, account->gc, node);
pidgin_append_blist_node_extended_menu(menu, node);
}
@@ -3944,7 +3948,7 @@ generate_send_to_items(PidginWindow *win
gtk_widget_show(menu);
if (purple_conversation_get_type(gtkconv->active_conv) == PURPLE_CONV_TYPE_IM) {
- buds = purple_find_buddies(gtkconv->active_conv->account, gtkconv->active_conv->name);
+ buds = purple_find_buddies(purple_conversation_get_account(gtkconv->active_conv), purple_conversation_get_name(gtkconv->active_conv));
if (buds == NULL)
{
@@ -3969,7 +3973,7 @@ generate_send_to_items(PidginWindow *win
account = purple_buddy_get_account(buddy);
/* TODO WEBKIT: (I'm not actually sure if this is webkit-related --Mark Doliner) */
- if (purple_account_is_connected(account) /*|| account == gtkconv->active_conv->account*/)
+ if (purple_account_is_connected(account) /*|| account == purple_conversation_get_account(gtkconv->active_conv)*/)
{
/* Use the PurplePresence to get unique buddies. */
PurplePresence *presence = purple_buddy_get_presence(buddy);
@@ -4073,7 +4077,7 @@ add_chat_buddy_common(PurpleConversation
stock = get_chat_buddy_status_icon(chat, name, flags);
- if (!strcmp(purple_conv_chat_get_nick(chat), purple_normalize(conv->account, old_name != NULL ? old_name : name)))
+ if (!strcmp(purple_conv_chat_get_nick(chat), purple_normalize(purple_conversation_get_account(conv), old_name != NULL ? old_name : name)))
is_me = TRUE;
is_buddy = purple_conv_chat_cb_is_buddy(cb);
@@ -4450,6 +4454,7 @@ update_chat_alias(PurpleBuddy *buddy, Pu
{
PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
PurpleConvChat *chat = PURPLE_CONV_CHAT(conv);
+ PurpleAccount *account = purple_conversation_get_account(conv);
GtkTreeModel *model;
char *normalized_name;
GtkTreeIter iter;
@@ -4464,23 +4469,23 @@ update_chat_alias(PurpleBuddy *buddy, Pu
if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
return;
- normalized_name = g_strdup(purple_normalize(conv->account, buddy->name));
+ normalized_name = g_strdup(purple_normalize(account, buddy->name));
do {
char *name;
gtk_tree_model_get(model, &iter, CHAT_USERS_NAME_COLUMN, &name, -1);
- if (!strcmp(normalized_name, purple_normalize(conv->account, name))) {
+ if (!strcmp(normalized_name, purple_normalize(account, name))) {
const char *alias = name;
char *tmp;
char *alias_key = NULL;
PurpleBuddy *buddy2;
- if (strcmp(purple_conv_chat_get_nick(chat), purple_normalize(conv->account, name))) {
+ if (strcmp(purple_conv_chat_get_nick(chat), purple_normalize(account, name))) {
/* This user is not me, so look into updating the alias. */
- if ((buddy2 = purple_find_buddy(conv->account, name)) != NULL) {
+ if ((buddy2 = purple_find_buddy(account, name)) != NULL) {
alias = purple_buddy_get_contact_alias(buddy2);
}
@@ -4567,14 +4572,14 @@ buddy_cb_common(PurpleBuddy *buddy, Purp
if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter))
return;
- normalized_name = g_strdup(purple_normalize(conv->account, buddy->name));
+ normalized_name = g_strdup(purple_normalize(purple_conversation_get_account(conv), buddy->name));
do {
char *name;
gtk_tree_model_get(model, &iter, CHAT_USERS_NAME_COLUMN, &name, -1);
- if (!strcmp(normalized_name, purple_normalize(conv->account, name))) {
+ if (!strcmp(normalized_name, purple_normalize(purple_conversation_get_account(conv), name))) {
gtk_list_store_set(GTK_LIST_STORE(model), &iter,
CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL, -1);
g_free(name);
@@ -4776,7 +4781,7 @@ pidgin_conv_userlist_create_tooltip(GtkW
gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &who, -1);
prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl);
- node = (PurpleBlistNode*)(purple_find_buddy(conv->account, who));
+ node = (PurpleBlistNode*)(purple_find_buddy(purple_conversation_get_account(conv), who));
if (node && prpl_info && (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME))
pidgin_blist_draw_tooltip(node, gtkconv->infopane);
@@ -4891,11 +4896,11 @@ pidgin_conv_create_tooltip(GtkWidget *ti
conv = gtkconv->active_conv;
if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) {
- node = (PurpleBlistNode*)(purple_blist_find_chat(conv->account, purple_conversation_get_name(conv)));
+ node = (PurpleBlistNode*)(purple_blist_find_chat(purple_conversation_get_account(conv), purple_conversation_get_name(conv)));
if (!node)
node = g_object_get_data(G_OBJECT(gtkconv->webview), "transient_chat");
} else {
- node = (PurpleBlistNode*)(purple_find_buddy(conv->account, purple_conversation_get_name(conv)));
+ node = (PurpleBlistNode*)(purple_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv)));
#if 0
/* Using the transient blist nodes to show the tooltip doesn't quite work yet. */
if (!node)
@@ -4980,6 +4985,7 @@ replace_header_tokens(PurpleConversation
static char *
replace_header_tokens(PurpleConversation *conv, const char *text)
{
+ PurpleAccount *account = purple_conversation_get_account(conv);
GString *str;
const char *cur = text;
const char *prev = cur;
@@ -4996,12 +5002,12 @@ replace_header_tokens(PurpleConversation
replace = purple_conversation_get_name(conv);
} else if (g_str_has_prefix(cur, "%sourceName%")) {
- replace = purple_account_get_alias(conv->account);
+ replace = purple_account_get_alias(account);
if (replace == NULL)
- replace = purple_account_get_username(conv->account);
+ replace = purple_account_get_username(account);
} else if (g_str_has_prefix(cur, "%destinationName%")) {
- PurpleBuddy *buddy = purple_find_buddy(conv->account, purple_conversation_get_name(conv));
+ PurpleBuddy *buddy = purple_find_buddy(account, purple_conversation_get_name(conv));
if (buddy) {
replace = purple_buddy_get_alias(buddy);
} else {
@@ -5014,7 +5020,7 @@ replace_header_tokens(PurpleConversation
replace = purple_buddy_icon_get_full_path(icon);
} else if (g_str_has_prefix(cur, "%outgoingIconPath%")) {
- replace = purple_account_get_buddy_icon_path(conv->account);
+ replace = purple_account_get_buddy_icon_path(account);
} else if (g_str_has_prefix(cur, "%timeOpened")) {
const char *tmp = cur + strlen("%timeOpened");
@@ -5301,7 +5307,7 @@ setup_common_pane(PidginConversation *gt
gtk_widget_set_name(gtkconv->entry, "pidgin_conv_entry");
gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry),
- purple_account_get_protocol_name(conv->account));
+ purple_account_get_protocol_name(purple_conversation_get_account(conv)));
g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup",
G_CALLBACK(entry_popup_menu_cb), gtkconv);
@@ -5468,7 +5474,7 @@ pidgin_conv_find_gtkconv(PurpleConversat
static PidginConversation *
pidgin_conv_find_gtkconv(PurpleConversation * conv)
{
- PurpleBuddy *bud = purple_find_buddy(conv->account, purple_conversation_get_name(conv));
+ PurpleBuddy *bud = purple_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv));
PurpleContact *c;
PurpleBlistNode *cn, *bn;
@@ -6049,10 +6055,10 @@ replace_message_tokens(
} else if (g_str_has_prefix(cur, "%userIconPath%")) {
if (flags & PURPLE_MESSAGE_SEND) {
- if (purple_account_get_bool(conv->account, "use-global-buddyicon", TRUE)) {
+ if (purple_account_get_bool(purple_conversation_get_account(conv), "use-global-buddyicon", TRUE)) {
replace = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/accounts/buddyicon");
} else {
- PurpleStoredImage *img = purple_buddy_icons_find_account_icon(conv->account);
+ PurpleStoredImage *img = purple_buddy_icons_find_account_icon(purple_conversation_get_account(conv));
replace = purple_imgstore_get_filename(img);
}
if (replace == NULL || !g_file_test(replace, G_FILE_TEST_EXISTS)) {
@@ -6074,7 +6080,7 @@ replace_message_tokens(
replace = alias;
} else if (g_str_has_prefix(cur, "%service%")) {
- replace = purple_account_get_protocol_name(conv->account);
+ replace = purple_account_get_protocol_name(purple_conversation_get_account(conv));
} else {
cur++;
@@ -6265,7 +6271,7 @@ pidgin_conv_write_conv(PurpleConversatio
gtk_font_options |= GTK_IMHTML_NO_COLOURS | GTK_IMHTML_NO_FONTS | GTK_IMHTML_NO_SIZES | GTK_IMHTML_NO_FORMATTING;
/* this is gonna crash one day, I can feel it. */
- if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(conv->account)))->options &
+ if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(purple_conversation_get_account(conv))))->options &
OPT_PROTO_USE_POINTSIZE) {
gtk_font_options |= GTK_IMHTML_USE_POINTSIZE;
}
@@ -6705,7 +6711,7 @@ pidgin_conv_custom_smiley_add(PurpleConv
/* If possible add this smiley to the current theme.
* The addition is only temporary: custom smilies aren't saved to disk. */
- conv_sml = purple_account_get_protocol_name(conv->account);
+ conv_sml = purple_account_get_protocol_name(purple_conversation_get_account(conv));
gtkconv = PIDGIN_CONVERSATION(conv);
for (list = (struct smiley_list *)current_smiley_theme->list; list; list = list->next) {
@@ -6736,7 +6742,7 @@ pidgin_conv_custom_smiley_write(PurpleCo
const char *sml;
GError *error = NULL;
- sml = purple_account_get_protocol_name(conv->account);
+ sml = purple_account_get_protocol_name(purple_conversation_get_account(conv));
gtkconv = PIDGIN_CONVERSATION(conv);
smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile);
@@ -6781,7 +6787,7 @@ pidgin_conv_custom_smiley_close(PurpleCo
g_return_if_fail(conv != NULL);
g_return_if_fail(smile != NULL);
- sml = purple_account_get_protocol_name(conv->account);
+ sml = purple_account_get_protocol_name(purple_conversation_get_account(conv));
gtkconv = PIDGIN_CONVERSATION(conv);
smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile);
@@ -7009,7 +7015,7 @@ gray_stuff_out(PidginConversation *gtkco
if ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) &&
(gtkconv->u.im->anim))
{
- PurpleBuddy *buddy = purple_find_buddy(conv->account, purple_conversation_get_name(conv));
+ PurpleBuddy *buddy = purple_find_buddy(purple_conversation_get_account(conv), purple_conversation_get_name(conv));
window_icon =
gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim);
@@ -7901,10 +7907,10 @@ account_signed_off_cb(PurpleConnection *
if (PURPLE_CONNECTION_IS_CONNECTED(gc) &&
purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT &&
- conv->account == gc->account &&
+ purple_conversation_get_account(conv) == gc->account &&
purple_conversation_get_data(conv, "want-to-rejoin")) {
GHashTable *comps = NULL;
- PurpleChat *chat = purple_blist_find_chat(conv->account, purple_conversation_get_name(conv));
+ PurpleChat *chat = purple_blist_find_chat(purple_conversation_get_account(conv), purple_conversation_get_name(conv));
if (chat == NULL) {
if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL)
comps = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, purple_conversation_get_name(conv));
@@ -9384,13 +9390,13 @@ infopane_entry_activate(PidginConversati
return FALSE;
}
- if (!purple_account_is_connected(gtkconv->active_conv->account)) {
+ if (!purple_account_is_connected(purple_conversation_get_account(gtkconv->active_conv))) {
/* Do not allow aliasing someone on a disconnected account. */
return FALSE;
}
if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
- PurpleBuddy *buddy = purple_find_buddy(gtkconv->active_conv->account, purple_conversation_get_name(gtkconv->active_conv));
+ PurpleBuddy *buddy = purple_find_buddy(purple_conversation_get_account(gtkconv->active_conv), purple_conversation_get_name(gtkconv->active_conv));
if (!buddy)
/* This buddy isn't in your buddy list, so we can't alias him */
return FALSE;
============================================================
--- pidgin/gtkutils.c 936d5ce28bad69f8c8c415d17b1a86a399594032
+++ pidgin/gtkutils.c 1eecd73bf84282c70648a05f60e82215d1fbe2f7
@@ -3480,7 +3480,7 @@ save_file_cb(GtkWidget *item, const char
return TRUE;
purple_request_file(conv->active_conv, _("Save File"), NULL, TRUE,
G_CALLBACK(savefile_write_cb), NULL,
- conv->active_conv->account, NULL, conv->active_conv,
+ purple_conversation_get_account(conv->active_conv), NULL, conv->active_conv,
(void *)url);
return TRUE;
}
============================================================
--- pidgin/gtksound.c d8f11dd93dd2ca281fb2f6263ec8e4aabfd49d76
+++ pidgin/gtksound.c 3a0ce941d579254a111fec47d7214a90578d23ae
@@ -96,8 +96,8 @@ chat_nick_matches_name(PurpleConversatio
if (chat==NULL)
return ret;
- nick = g_strdup(purple_normalize(conv->account, purple_conv_chat_get_nick(chat)));
- name = g_strdup(purple_normalize(conv->account, aname));
+ nick = g_strdup(purple_normalize(purple_conversation_get_account(conv), purple_conv_chat_get_nick(chat)));
+ name = g_strdup(purple_normalize(purple_conversation_get_account(conv), aname));
if (g_utf8_collate(nick, name) == 0)
ret = TRUE;
More information about the Commits
mailing list