im.pidgin.pidgin: 060da60b29e46c9444ca537353c9a87c53711276

sadrul at pidgin.im sadrul at pidgin.im
Sat Jan 26 17:00:47 EST 2008


-----------------------------------------------------------------
Revision: 060da60b29e46c9444ca537353c9a87c53711276
Ancestor: a6fc0d6feae75ff26858a89fdbbdfd13b5faaf70
Author: sadrul at pidgin.im
Date: 2008-01-26T21:39:29
Branch: im.pidgin.pidgin

Modified files:
        finch/gntconn.c finch/gntconv.c finch/gntsound.c

ChangeLog: 

Update finch to not touch the internals of PurpleConversation.

-------------- next part --------------
============================================================
--- finch/gntconn.c	df9d51ab52634a3fbe00e36994678c77367983f5
+++ finch/gntconn.c	73ce18da86b2412b9315a83b05335f077eaab193
@@ -149,7 +149,7 @@ finch_connection_report_disconnect(Purpl
 	while (list) {
 		PurpleConversation *conv = list->data;
 		list = list->next;
-		if (conv->account != account ||
+		if (purple_conversation_get_account(conv) != account ||
 				purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv)))
 			continue;
 		purple_conversation_set_data(conv, "want-to-rejoin", GINT_TO_POINTER(TRUE));
============================================================
--- finch/gntconv.c	a323aa8f9f0aa961c43c894f38051c25fd165896
+++ finch/gntconv.c	796043b91b98f0071b9b50e12862d8af29e57227
@@ -71,6 +71,20 @@ static int color_timestamp;
 static int color_message_action;
 static int color_timestamp;
 
+static PurpleBuddy *
+find_buddy_for_conversation(PurpleConversation *conv)
+{
+	return purple_find_buddy(purple_conversation_get_account(conv),
+			purple_conversation_get_name(conv));
+}
+
+static PurpleChat *
+find_chat_for_conversation(PurpleConversation *conv)
+{
+	return purple_blist_find_chat(purple_conversation_get_account(conv),
+			purple_conversation_get_name(conv));
+}
+
 static PurpleBlistNode *
 get_conversation_blist_node(PurpleConversation *conv)
 {
@@ -78,11 +92,11 @@ get_conversation_blist_node(PurpleConver
 
 	switch (purple_conversation_get_type(conv)) {
 		case PURPLE_CONV_TYPE_IM:
-			node = (PurpleBlistNode*)purple_find_buddy(conv->account, conv->name);
+			node = (PurpleBlistNode*)find_buddy_for_conversation(conv);
 			node = node ? purple_blist_node_get_parent(node) : NULL;
 			break;
 		case PURPLE_CONV_TYPE_CHAT:
-			node = (PurpleBlistNode*)purple_blist_find_chat(conv->account, conv->name);
+			node = (PurpleBlistNode*)find_chat_for_conversation(conv);
 			break;
 		default:
 			break;
@@ -168,7 +182,7 @@ entry_key_pressed(GntWidget *w, FinchCon
 		}
 		g_free(error);
 	}
-	else if (!purple_account_is_connected(ggconv->active_conv->account))
+	else if (!purple_account_is_connected(purple_conversation_get_account(ggconv->active_conv)))
 	{
 		purple_conversation_write(ggconv->active_conv, "", _("Message was not sent, because you are not signed on."),
 				PURPLE_MESSAGE_ERROR | PURPLE_MESSAGE_NO_LOG, time(NULL));
@@ -316,7 +330,8 @@ account_signed_on_off(PurpleConnection *
 	GList *list = purple_get_ims();
 	while (list) {
 		PurpleConversation *conv = list->data;
-		PurpleConversation *cc = find_conv_with_contact(conv->account, conv->name);
+		PurpleConversation *cc = find_conv_with_contact(
+				purple_conversation_get_account(conv), purple_conversation_get_name(conv));
 		if (cc)
 			generate_send_to_menu(cc->ui_data);
 		list = list->next;
@@ -332,15 +347,15 @@ account_signed_on_off(PurpleConnection *
 			GHashTable *comps = NULL;
 
 			list = list->next;
-			if (conv->account != purple_connection_get_account(gc) ||
+			if (purple_conversation_get_account(conv) != purple_connection_get_account(gc) ||
 					!purple_conversation_get_data(conv, "want-to-rejoin"))
 				continue;
 
-			chat = purple_blist_find_chat(conv->account, conv->name);
+			chat = find_chat_for_conversation(conv);
 			if (chat == NULL) {
 				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);
+					comps = info->chat_info_defaults(gc, purple_conversation_get_name(conv));
 			} else {
 				comps = chat->components;
 			}
@@ -415,15 +430,11 @@ toggle_logging_cb(GntMenuItem *item, gpo
 
 		purple_conversation_write(conv, NULL,
 				_("Logging started. Future messages in this conversation will be logged."),
-				conv->logs ? (PURPLE_MESSAGE_SYSTEM) :
-				(PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG),
-				time(NULL));
+				PURPLE_MESSAGE_SYSTEM, time(NULL));
 	} else {
 		purple_conversation_write(conv, NULL,
 				_("Logging stopped. Future messages in this conversation will not be logged."),
-				conv->logs ? (PURPLE_MESSAGE_SYSTEM) :
-				(PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG),
-				time(NULL));
+				PURPLE_MESSAGE_SYSTEM, time(NULL));
 
 		/* Disable the logging second, so that the above message can be logged. */
 		purple_conversation_set_logging(conv, FALSE);
@@ -464,7 +475,8 @@ generate_send_to_menu(FinchConv *ggc)
 	GSList *buds;
 	GList *list = NULL;
 
-	buds = purple_find_buddies(ggc->active_conv->account, ggc->active_conv->name);
+	buds = purple_find_buddies(purple_conversation_get_account(ggc->active_conv),
+			purple_conversation_get_name(ggc->active_conv));
 	if (!buds)
 		return;
 
@@ -608,7 +620,8 @@ finch_create_conversation(PurpleConversa
 	if (ggc)
 		return;
 
-	cc = find_conv_with_contact(conv->account, conv->name);
+	account = purple_conversation_get_account(conv);
+	cc = find_conv_with_contact(account, purple_conversation_get_name(conv));
 	if (cc && cc->ui_data)
 		ggc = cc->ui_data;
 	else
@@ -629,7 +642,6 @@ finch_create_conversation(PurpleConversa
 		return;
 	}
 
-	account = purple_conversation_get_account(conv);
 	type = purple_conversation_get_type(conv);
 	title = get_conversation_title(conv, account);
 
@@ -638,7 +650,7 @@ finch_create_conversation(PurpleConversa
 	gnt_box_set_toplevel(GNT_BOX(ggc->window), TRUE);
 	gnt_box_set_pad(GNT_BOX(ggc->window), 0);
 
-	switch(conv->type){
+	switch (purple_conversation_get_type(conv)) {
 		case PURPLE_CONV_TYPE_UNKNOWN:
 			gnt_widget_set_name(ggc->window, "conversation-window-unknown" );
 			break;
============================================================
--- finch/gntsound.c	b7313f38a35027b7d2509c8faf61179003cc4b9a
+++ finch/gntsound.c	46c79458ec72c1375ae63a6c8c57a9177f85cc2b
@@ -142,13 +142,15 @@ chat_nick_matches_name(PurpleConversatio
 	char *nick = NULL;
 	char *name = NULL;
 	gboolean ret = FALSE;
-	chat = purple_conversation_get_chat_data(conv);
+	PurpleAccount *account;
 
+	chat = purple_conversation_get_chat_data(conv);
 	if (chat == NULL)
 		return ret;
 
-	nick = g_strdup(purple_normalize(conv->account, chat->nick));
-	name = g_strdup(purple_normalize(conv->account, aname));
+	account = purple_conversation_get_account(conv);
+	nick = g_strdup(purple_normalize(account, chat->nick));
+	name = g_strdup(purple_normalize(account, aname));
 
 	if (g_utf8_collate(nick, name) == 0)
 		ret = TRUE;


More information about the Commits mailing list