changeset 17026:9a1d36a4573e

Fix a crash when something requests the blist status icon before the UI node has been rendered. The ticker plugin was doing this. Fixes #642.
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 11 May 2007 15:07:13 +0000
parents 2ff14d4361f4
children 2c5654d1a17a 7d73b6837641
files libpurple/plugins/perl/common/SavedStatuses.xs libpurple/plugins/perl/common/typemap pidgin/gtkblist.c pidgin/gtkstatusbox.c pidgin/plugins/ticker/Makefile.mingw
diffstat 5 files changed, 109 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/plugins/perl/common/SavedStatuses.xs	Fri May 11 04:21:03 2007 +0000
+++ b/libpurple/plugins/perl/common/SavedStatuses.xs	Fri May 11 15:07:13 2007 +0000
@@ -3,6 +3,15 @@
 MODULE = Purple::SavedStatus  PACKAGE = Purple::SavedStatus  PREFIX = purple_savedstatus_
 PROTOTYPES: ENABLE
 
+void
+purple_savedstatus_activate(saved_status)
+       Purple::SavedStatus saved_status
+
+void
+purple_savedstatus_activate_for_account(saved_status, account)
+	Purple::SavedStatus saved_status
+	Purple::Account account
+
 gboolean
 purple_savedstatus_delete(title)
 	const char *title
@@ -11,16 +20,57 @@
 purple_savedstatus_find(title)
 	const char *title
 
+Purple::SavedStatus
+purple_savedstatus_find_by_creation_time(creation_time)
+	time_t creation_time
+
+Purple::SavedStatus
+purple_savedstatus_find_transient_by_type_and_message(type, message)
+	Purple::StatusPrimitive type
+	const char *message
+
+time_t
+purple_savedstatus_get_creation_time(saved_status)
+	Purple::SavedStatus saved_status
+
+Purple::SavedStatus
+purple_savedstatus_get_current()
+
+Purple::SavedStatus
+purple_savedstatus_get_default ()
+
+Purple::SavedStatus
+purple_savedstatus_get_idleaway()
+
 const char *
 purple_savedstatus_get_message(saved_status)
 	Purple::SavedStatus saved_status
 
+Purple::SavedStatus
+purple_savedstatus_get_startup()
+
+Purple::SavedStatusSub
+purple_savedstatus_get_substatus(saved_status, account)
+	Purple::SavedStatus saved_status
+	Purple::Account account
+
 const char *
 purple_savedstatus_get_title(saved_status)
 	Purple::SavedStatus saved_status
 
 Purple::StatusPrimitive
 purple_savedstatus_get_type(saved_status)
+	const Purple::SavedStatus saved_status
+
+gboolean
+purple_savedstatus_has_substatuses(saved_status)
+	Purple::SavedStatus saved_status
+
+gboolean
+purple_savedstatus_is_idleaway()
+
+gboolean
+purple_savedstatus_is_transient(saved_status)
 	Purple::SavedStatus saved_status
 
 Purple::SavedStatus
@@ -29,12 +79,43 @@
 	Purple::StatusPrimitive type
 
 void
+purple_savedstatus_set_idleaway(idleaway)
+	gboolean idleaway
+
+void
 purple_savedstatus_set_message(status, message)
 	Purple::SavedStatus status
 	const char *message
 
-Purple::SavedStatus
-purple_savedstatus_get_current()
+void
+purple_savedstatus_set_substatus(status, account, type, message)
+	Purple::SavedStatus status
+	Purple::Account account
+	Purple::StatusType type
+	const char *message
+
+void
+purple_savedstatus_set_title(status, title)
+	Purple::SavedStatus status
+	const char *title
+
+void
+purple_savedstatus_set_type(status, type)
+	Purple::SavedStatus status
+	Purple::StatusPrimitive type
+
+const char *
+purple_savedstatus_substatus_get_message(substatus)
+	Purple::SavedStatusSub substatus
+
+const Purple::StatusType
+purple_savedstatus_substatus_get_type(substatus)
+	const Purple::SavedStatusSub substatus
+
+void
+purple_savedstatus_unset_substatus(saved_status, account)
+	Purple::SavedStatus saved_status
+	Purple::Account account
 
 MODULE = Purple::SavedStatus  PACKAGE = Purple::SavedStatuses  PREFIX = purple_savedstatuses_
 PROTOTYPES: ENABLE
@@ -52,6 +133,16 @@
 purple_savedstatuses_get_handle()
 
 void
+purple_savedstatuses_get_popular(how_many)
+	unsigned int how_many
+PREINIT:
+	GList *l;
+PPCODE:
+	for (l = purple_savedstatuses_get_popular(how_many); l != NULL; l = l->next) {
+		XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::SavedStatus")));
+	}
+
+void
 purple_savedstatuses_init()
 
 void
--- a/libpurple/plugins/perl/common/typemap	Fri May 11 04:21:03 2007 +0000
+++ b/libpurple/plugins/perl/common/typemap	Fri May 11 15:07:13 2007 +0000
@@ -137,7 +137,9 @@
 Purple::RoomlistRoomType			T_IV
 
 Purple::SavedStatus			T_PurpleObj
+const Purple::SavedStatus			T_PurpleObj
 Purple::SavedStatusSub			T_PurpleObj
+const Purple::SavedStatusSub			T_PurpleObj
 Purple::SoundEventID			T_IV
 Purple::Sound::UiOps			T_PurpleObj
 
--- a/pidgin/gtkblist.c	Fri May 11 04:21:03 2007 +0000
+++ b/pidgin/gtkblist.c	Fri May 11 15:07:13 2007 +0000
@@ -2091,28 +2091,28 @@
 
 	if (width < 6 || height < 6)
 		return;
-	
+
 	/* Top left */
 	pixels[3] = 0;
 	pixels[7] = 0x80;
 	pixels[11] = 0xC0;
 	pixels[rowstride + 3] = 0x80;
 	pixels[rowstride * 2 + 3] = 0xC0;
-	
+
 	/* Top right */
 	pixels[width * 4 - 1] = 0;
 	pixels[width * 4 - 5] = 0x80;
 	pixels[width * 4 - 9] = 0xC0;
 	pixels[rowstride + (width * 4) - 1] = 0x80;
 	pixels[(2 * rowstride) + (width * 4) - 1] = 0xC0;
-	
+
 	/* Bottom left */
 	pixels[(height - 1) * rowstride + 3] = 0;
 	pixels[(height - 1) * rowstride + 7] = 0x80;
 	pixels[(height - 1) * rowstride + 11] = 0xC0;
 	pixels[(height - 2) * rowstride + 3] = 0x80;
 	pixels[(height - 3) * rowstride + 3] = 0xC0;
-	
+
 	/* Bottom right */
 	pixels[height * rowstride - 1] = 0;
 	pixels[(height - 1) * rowstride - 1] = 0x80;
@@ -3152,7 +3152,8 @@
 	if(PURPLE_BLIST_NODE_IS_CONTACT(node)) {
 		if(!gtknode->contact_expanded) {
 			buddy = purple_contact_get_priority_buddy((PurpleContact*)node);
-			gtkbuddynode = ((PurpleBlistNode*)buddy)->ui_data;
+			if (buddy != NULL)
+				gtkbuddynode = ((PurpleBlistNode*)buddy)->ui_data;
 		}
 	} else if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
 		buddy = (PurpleBuddy*)node;
--- a/pidgin/gtkstatusbox.c	Fri May 11 04:21:03 2007 +0000
+++ b/pidgin/gtkstatusbox.c	Fri May 11 15:07:13 2007 +0000
@@ -197,7 +197,7 @@
 	const char *message;
 
 	statustype = purple_status_type_find_with_id((GList *)purple_account_get_status_types(account),
-	                                           (char *)purple_status_type_get_id(purple_status_get_type(newstatus)));
+						     purple_status_type_get_id(purple_status_get_type(newstatus)));
 
 	for (l = purple_account_get_status_types(account); l != NULL; l = l->next) {
 		PurpleStatusType *status_type = (PurpleStatusType *)l->data;
@@ -1524,7 +1524,8 @@
 	if (ewidget != status_box->tree_view) {
 		if (ewidget == status_box->toggle_button &&
 		    status_box->popup_in_progress &&
-		    gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (status_box->toggle_button))) {
+			gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(status_box->toggle_button)))
+		{
 			pidgin_status_box_popdown (status_box);
 			return TRUE;
 		}
@@ -1743,14 +1744,11 @@
 						PURPLE_CALLBACK(current_savedstatus_changed_cb),
 						status_box);
 	purple_signal_connect(purple_accounts_get_handle(), "account-enabled", status_box,
-						PURPLE_CALLBACK(account_enabled_cb),
-						status_box);
+			      PURPLE_CALLBACK(account_enabled_cb), status_box);
 	purple_signal_connect(purple_accounts_get_handle(), "account-disabled", status_box,
-						PURPLE_CALLBACK(account_enabled_cb),
-						status_box);
+			      PURPLE_CALLBACK(account_enabled_cb), status_box);
 	purple_signal_connect(purple_accounts_get_handle(), "account-status-changed", status_box,
-						PURPLE_CALLBACK(account_status_changed_cb),
-						status_box);
+			      PURPLE_CALLBACK(account_status_changed_cb), status_box);
 
 	purple_prefs_connect_callback(status_box, PIDGIN_PREFS_ROOT "/conversations/spellcheck",
 								spellcheck_prefs_cb, status_box);
@@ -1969,8 +1967,7 @@
 		escaped_title = g_markup_escape_text(title, -1);
 		escaped_desc = g_markup_escape_text(desc, -1);
 		text = g_strdup_printf("%s - <span color=\"%s\" size=\"smaller\">%s</span>",
-					escaped_title,
-				       aa_color, escaped_desc);
+					escaped_title, aa_color, escaped_desc);
 		g_free(escaped_title);
 		g_free(escaped_desc);
 	}
--- a/pidgin/plugins/ticker/Makefile.mingw	Fri May 11 04:21:03 2007 +0000
+++ b/pidgin/plugins/ticker/Makefile.mingw	Fri May 11 15:07:13 2007 +0000
@@ -59,7 +59,7 @@
 
 all: $(TARGET).dll
 
-install: $(PIDGIN_INSTALL_PLUGINS_DIR)
+install: $(PIDGIN_INSTALL_PLUGINS_DIR) all
 	cp $(TARGET).dll $(PIDGIN_INSTALL_PLUGINS_DIR)
 
 $(OBJECTS): $(PIDGIN_CONFIG_H)