changeset 30621:92a5d4b38f21

jabber: Stricter checks on the send_raw prpl function. This (should) avoids a crash in the gtalkinvisible plugin as seen in a crash log from #pidgin. The plugin is trying to send a stanza as the (eventual) result of the signing-on signal, which is before prpl_info->login() is called. Call stack: jabber_send_raw protocols/jabber/jabber.c:443 jabber_prpl_send_raw protocols/jabber/jabber.c:548 6EA0122D plugins\gtalkinvisible.dll plugin_invisible_cb gtalkinvisible.c:147 67D0410B purple_signal_emit_vargs signals.c:465 67D04217 purple_signal_emit signals.c:436 67CFB75F purple_prpl_change_account_status prpl.c:389 67D09B3F status_has_changed status.c:669 67CC4409 purple_account_set_status_list account.c:1783 67CC4717 purple_account_set_status account.c:1752 67D00F18 purple_savedstatus_activate_for_account savedstatuses.c:1174 67D01899 purple_savedstatus_set_idleaway savedstatuses.c:887 67CE5D13 check_idleness idle.c:193 67D0410B purple_signal_emit_vargs signals.c:465 67D04217 purple_signal_emit signals.c:436 67CD9F34 _purple_connection_new connection.c:157 67CC56C1 purple_account_connect account.c:1216
author Paul Aurich <paul@darkrain42.org>
date Tue, 15 Jun 2010 22:41:37 +0000
parents bb835d43f29f
children d78a3f06b7a0
files libpurple/protocols/jabber/jabber.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/jabber.c	Tue Jun 15 01:33:28 2010 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Tue Jun 15 22:41:37 2010 +0000
@@ -543,6 +543,13 @@
 int jabber_prpl_send_raw(PurpleConnection *gc, const char *buf, int len)
 {
 	JabberStream *js = purple_connection_get_protocol_data(gc);
+
+	g_return_val_if_fail(js != NULL, -1);
+	/* TODO: It's probably worthwhile to restrict this to when the account
+	 * state is CONNECTED, but I can /almost/ envision reasons for wanting
+	 * to do things during the connection process.
+	 */
+
 	jabber_send_raw(js, buf, len);
 	return len;
 }