diff libpurple/protocols/jabber/libxmpp.c @ 19998:7baa2bc64226

Cleanup the SASL init and add error checking.
author Daniel Atallah <daniel.atallah@gmail.com>
date Fri, 14 Sep 2007 00:01:47 +0000
parents 481749fc0b6b
children be2538a92099
line wrap: on
line diff
--- a/libpurple/protocols/jabber/libxmpp.c	Thu Sep 13 21:34:55 2007 +0000
+++ b/libpurple/protocols/jabber/libxmpp.c	Fri Sep 14 00:01:47 2007 +0000
@@ -28,6 +28,7 @@
 #include "internal.h"
 
 #include "accountopt.h"
+#include "debug.h"
 #include "version.h"
 
 #include "iq.h"
@@ -45,14 +46,11 @@
 
 static PurplePluginProtocolInfo prpl_info =
 {
+	OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_MAIL_CHECK |
 #ifdef HAVE_CYRUS_SASL
-	OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME |
-	OPT_PROTO_MAIL_CHECK | OPT_PROTO_PASSWORD_OPTIONAL |
+	OPT_PROTO_PASSWORD_OPTIONAL |
+#endif
 	OPT_PROTO_SLASH_COMMANDS_NATIVE,
-#else
-	OPT_PROTO_CHAT_TOPIC | OPT_PROTO_UNIQUE_CHATNAME | OPT_PROTO_MAIL_CHECK |
-	OPT_PROTO_SLASH_COMMANDS_NATIVE,
-#endif
 	NULL,							/* user_splits */
 	NULL,							/* protocol_options */
 	{"png", 32, 32, 96, 96, 8191, PURPLE_ICON_SCALE_SEND | PURPLE_ICON_SCALE_DISPLAY}, /* icon_spec */
@@ -194,6 +192,9 @@
 static void
 init_plugin(PurplePlugin *plugin)
 {
+#ifdef HAVE_CYRUS_SASL
+	int ret;
+#endif
 	PurpleAccountUserSplit *split;
 	PurpleAccountOption *option;
 	
@@ -236,7 +237,9 @@
 	
 	/* XXX - If any other plugin wants SASL this won't be good ... */
 #ifdef HAVE_CYRUS_SASL
-	sasl_client_init(NULL);
+	if ((ret = sasl_client_init(NULL)) != SASL_OK) {
+		purple_debug_error("xmpp", "Error (%d) initializing SASL.\n", ret);
+	}
 #endif
 	jabber_register_commands();