im.pidgin.pidgin: a6fc0d6feae75ff26858a89fdbbdfd13b5faaf70
sadrul at pidgin.im
sadrul at pidgin.im
Sat Jan 26 17:00:51 EST 2008
-----------------------------------------------------------------
Revision: a6fc0d6feae75ff26858a89fdbbdfd13b5faaf70
Ancestor: e434795e65b6b517f87e2bc5a7b5ce1b51ee0792
Author: sadrul at pidgin.im
Date: 2008-01-26T21:13:46
Branch: im.pidgin.pidgin
Modified files:
ChangeLog.API finch/gntblist.c finch/gntconn.c
finch/gntconv.c finch/gntroomlist.c libpurple/connection.c
libpurple/connection.h
ChangeLog:
Add accessor and update finch to not touch the internals of PurpleConnection.
-------------- next part --------------
============================================================
--- ChangeLog.API 4c3735bb44480dae63b5ba97ad431065215058d3
+++ ChangeLog.API cb770c07447f3542bc8c531175ab00daaaf41544
@@ -35,9 +35,11 @@ version 2.4.0 (??/??/????):
* purple_blist_node_get_first_child
* purple_blist_node_get_sibling_next
* purple_blist_node_get_sibling_prev
- * purple_chat_get_account
* Added last_received to PurpleConnection, the time_t of the
last received packet.
+ * Added some more accessor functions:
+ * purple_chat_get_account
+ * purple_connection_get_prpl
Pidgin:
Added:
============================================================
--- finch/gntblist.c d5db0530516a95edf16b90521c290943e70fd028
+++ finch/gntblist.c ea20044d5881f50ddd73af7b770b74f26959616a
@@ -629,6 +629,7 @@ add_chat_cb(void *data, PurpleRequestFie
GHashTable *hash = NULL;
PurpleConnection *gc;
gboolean autojoin;
+ PurplePluginProtocolInfo *info;
account = purple_request_fields_get_account(allfields, "account");
name = purple_request_fields_get_string(allfields, "name");
@@ -638,15 +639,15 @@ add_chat_cb(void *data, PurpleRequestFie
if (!purple_account_is_connected(account) || !name || !*name)
return;
-
+
if (!group || !*group)
group = _("Chats");
gc = purple_account_get_connection(account);
+ info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
+ if (info->chat_info_defaults != NULL)
+ hash = info->chat_info_defaults(gc, name);
- if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL)
- hash = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, name);
-
chat = purple_chat_new(account, name, hash);
if (chat != NULL) {
@@ -988,7 +989,7 @@ append_proto_menu(GntMenu *menu, PurpleC
append_proto_menu(GntMenu *menu, PurpleConnection *gc, PurpleBlistNode *node)
{
GList *list;
- PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+ PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
if(!prpl_info || !prpl_info->blist_node_menu)
return;
@@ -1048,7 +1049,7 @@ chat_components_edit(PurpleBlistNode *se
purple_request_fields_add_group(fields, group);
gc = purple_account_get_connection(chat->account);
- parts = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info(gc);
+ parts = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->chat_info(gc);
for (iter = parts; iter; iter = iter->next) {
pce = iter->data;
@@ -1169,7 +1170,7 @@ create_buddy_menu(GntMenu *menu, PurpleB
PurplePluginProtocolInfo *prpl_info;
PurpleConnection *gc = purple_account_get_connection(buddy->account);
- prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+ prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
if (prpl_info && prpl_info->get_info)
{
add_custom_action(menu, _("Get Info"),
@@ -2419,7 +2420,7 @@ reconstruct_accounts_menu(void)
if (!gc || !PURPLE_CONNECTION_IS_CONNECTED(gc))
continue;
- prpl = gc->prpl;
+ prpl = purple_connection_get_prpl(gc);
if (PURPLE_PLUGIN_HAS_ACTIONS(prpl)) {
item = gnt_menuitem_new(purple_account_get_username(account));
@@ -2552,12 +2553,13 @@ join_chat_select_cb(gpointer data, Purpl
if (!purple_account_is_connected(account))
return;
- gc = purple_account_get_connection(account);
+ gc = purple_account_get_connection(account);
purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name);
chat = purple_blist_find_chat(account, name);
if (chat == NULL) {
- if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults != NULL)
- hash = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info_defaults(gc, name);
+ PurplePluginProtocolInfo *info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
+ if (info->chat_info_defaults != NULL)
+ hash = info->chat_info_defaults(gc, name);
} else {
hash = chat->components;
}
============================================================
--- finch/gntconn.c e493b322ab0567b64b7dccae254073dc22ffdf70
+++ finch/gntconn.c df9d51ab52634a3fbe00e36994678c77367983f5
@@ -101,13 +101,14 @@ static void
}
static void
-finch_connection_report_disconnect(PurpleConnection *gc, const char *text)
+finch_connection_report_disconnect(PurpleConnection *gc, PurpleConnectionError reason,
+ const char *text)
{
FinchAutoRecon *info;
PurpleAccount *account = purple_connection_get_account(gc);
GList *list;
- if (!gc->wants_to_die) {
+ if (!purple_connection_error_is_fatal(reason)) {
info = g_hash_table_lookup(hash, account);
if (info == NULL) {
@@ -179,12 +180,12 @@ static PurpleConnectionUiOps ops =
NULL, /* connected */
NULL, /* disconnected */
NULL, /* notice */
- finch_connection_report_disconnect,
+ NULL,
NULL, /* network_connected */
NULL, /* network_disconnected */
+ finch_connection_report_disconnect,
NULL,
NULL,
- NULL,
NULL
};
============================================================
--- finch/gntconv.c cab40bda2c1af4ecf545d2a4a58fa0dc0baac63d
+++ finch/gntconv.c a323aa8f9f0aa961c43c894f38051c25fd165896
@@ -332,14 +332,15 @@ account_signed_on_off(PurpleConnection *
GHashTable *comps = NULL;
list = list->next;
- if (conv->account != gc->account ||
+ if (conv->account != purple_connection_get_account(gc) ||
!purple_conversation_get_data(conv, "want-to-rejoin"))
continue;
chat = purple_blist_find_chat(conv->account, conv->name);
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, conv->name);
+ PurplePluginProtocolInfo *info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
+ if (info->chat_info_defaults != NULL)
+ comps = info->chat_info_defaults(gc, conv->name);
} else {
comps = chat->components;
}
@@ -532,7 +533,8 @@ gg_create_menu(FinchConv *ggc)
if (purple_conversation_get_type(ggc->active_conv) == PURPLE_CONV_TYPE_IM) {
PurpleAccount *account = purple_conversation_get_account(ggc->active_conv);
PurpleConnection *gc = purple_account_get_connection(account);
- PurplePluginProtocolInfo *pinfo = gc ? PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl) : NULL;
+ PurplePluginProtocolInfo *pinfo =
+ gc ? PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)) : NULL;
if (pinfo && pinfo->get_info) {
item = gnt_menuitem_new(_("Get Info"));
============================================================
--- finch/gntroomlist.c 4375fb5361c4792acdc3eb6ac90caf3712f47ed5
+++ finch/gntroomlist.c 1143715e85053bc25d4d629ad71678ec8da8ef0b
@@ -116,7 +116,7 @@ static void fl_add_chat(GntWidget *butto
if (gc == NULL || room == NULL)
return;
- prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+ prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
if(prpl_info != NULL && prpl_info->roomlist_room_serialize)
name = prpl_info->roomlist_room_serialize(room);
@@ -238,7 +238,7 @@ reset_account_list(PurpleAccount *accoun
PurplePluginProtocolInfo *prpl_info = NULL;
PurpleConnection *gc = list->data;
- prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
+ prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc));
if (prpl_info->roomlist_get_list != NULL) {
PurpleAccount *account = purple_connection_get_account(gc);
char *text = g_strdup_printf("%s (%s)",
============================================================
--- libpurple/connection.c 5bfc801e70e2f946757923b12e3a09b05003d4be
+++ libpurple/connection.c 99d100199ff71455d6a80af4dbfb7226e5ae2fb1
@@ -424,6 +424,14 @@ purple_connection_get_account(const Purp
return gc->account;
}
+PurplePlugin *
+purple_connection_get_prpl(const PurpleConnection *gc)
+{
+ g_return_val_if_fail(gc != NULL, NULL);
+
+ return gc->prpl;
+}
+
const char *
purple_connection_get_password(const PurpleConnection *gc)
{
============================================================
--- libpurple/connection.h c047a7173fe3e6f351c00be7b2f37a0345ee7413
+++ libpurple/connection.h 6994e861c5d1766b186b507f4fa2977553130141
@@ -364,7 +364,7 @@ PurpleConnectionState purple_connection_
* @return TRUE if the account is connected, otherwise returns FALSE.
*/
#define PURPLE_CONNECTION_IS_CONNECTED(gc) \
- (gc->state == PURPLE_CONNECTED)
+ (purple_connection_get_state(gc) == PURPLE_CONNECTED)
/**
* Returns the connection's account.
@@ -376,6 +376,15 @@ PurpleAccount *purple_connection_get_acc
PurpleAccount *purple_connection_get_account(const PurpleConnection *gc);
/**
+ * Returns the protocol plugin managing a connection.
+ *
+ * @param gc The connection.
+ *
+ * @return The protocol plugin.
+ */
+PurplePlugin * purple_connection_get_prpl(const PurpleConnection *gc);
+
+/**
* Returns the connection's password.
*
* @param gc The connection.
More information about the Commits
mailing list