=== modified file 'protocols/account.c'
--- protocols/account.c	2014-02-28 23:17:28 +0000
+++ protocols/account.c	2014-04-24 02:22:50 +0000
@@ -168,6 +168,12 @@
 		
 		g_free( acc->pass );
 		acc->pass = g_strdup( value );
+
+		/* Callback protocol's set password function only if account
+		   is online. */
+		if( acc->ic && acc->prpl->set_password )
+			acc->prpl->set_password( acc->ic, value );
+
 		return NULL;	/* password shouldn't be visible in plaintext! */
 	}
 	else if( strcmp( set->key, "tag" ) == 0 )

=== modified file 'protocols/jabber/iq.c'
--- protocols/jabber/iq.c	2013-02-21 19:15:59 +0000
+++ protocols/jabber/iq.c	2014-04-20 05:43:25 +0000
@@ -931,3 +931,19 @@
 	
 	return XT_HANDLED;
 }
+
+int jabber_iq_register_password( struct im_connection *ic, const char *password )
+{
+	struct jabber_data *jd = ic->proto_data;
+	struct xt_node *node;
+	int st;
+
+	node = xt_new_node( "query", NULL, NULL );
+	xt_add_attr( node, "xmlns", XMLNS_REGISTER );
+	xt_add_child( node, xt_new_node( "username", jd->username, NULL ) );
+	xt_add_child( node, xt_new_node( "password", password, NULL ) );
+	node = jabber_make_packet( "iq", "set", NULL, node );
+	st = jabber_write_packet( ic, node );
+	
+	return st;
+}

=== modified file 'protocols/jabber/jabber.c'
--- protocols/jabber/jabber.c	2013-04-20 13:05:55 +0000
+++ protocols/jabber/jabber.c	2014-04-24 02:22:02 +0000
@@ -53,6 +53,12 @@
 	0
 };
 
+static char * jabber_password_blacklist[] = {
+	"chat.facebook.com",
+	"talk.google.com",
+	0
+};
+
 static void jabber_init( account_t *acc )
 {
 	set_t *s;
@@ -579,6 +585,31 @@
 	return 1;
 }
 
+static void jabber_set_password_( void *data )
+{
+	struct im_connection *ic = (struct im_connection *)data;
+	jabber_iq_register_password( ic, ic->acc->pass );
+}
+
+static void jabber_ask_set_password_( struct im_connection *ic, char *pass )
+{
+	struct jabber_data *jd = ic->proto_data;
+	char *buf;
+	int i;
+
+	g_assert( jd->server == NULL );
+
+	for( i = 0; jabber_password_blacklist[i] > 0; i ++ )
+		if( g_strcasecmp( jd->server, jabber_password_blacklist[i] ) == 0 )
+			return;
+
+	buf = g_strdup_printf( "Notify the server of the password change?" );
+	query_add( (irc_t *) ic->bee->ui_data, ic, buf,
+	    jabber_set_password_, NULL, NULL, // callbacks
+	    ic ); // data
+	g_free( buf );
+}
+
 void jabber_chat_add_settings( account_t *acc, set_t **head )
 {
 	/* Meh. Stupid room passwords. Not trying to obfuscate/hide
@@ -652,6 +683,7 @@
 	ret->transfer_request = jabber_si_transfer_request;
 	ret->buddy_action_list = jabber_buddy_action_list;
 	ret->buddy_action = jabber_buddy_action;
+	ret->set_password = jabber_ask_set_password_;
 
 	register_protocol( ret );
 }

=== modified file 'protocols/jabber/jabber.h'
--- protocols/jabber/jabber.h	2013-02-21 19:15:59 +0000
+++ protocols/jabber/jabber.h	2014-04-20 04:33:47 +0000
@@ -221,6 +221,7 @@
 #define XMLNS_ROSTER       "jabber:iq:roster"
 
 /* Some supported extensions/legacy stuff */
+#define XMLNS_REGISTER     "jabber:iq:register"                                  /* XEP-0077 */
 #define XMLNS_AUTH         "jabber:iq:auth"                                      /* XEP-0078 */
 #define XMLNS_VERSION      "jabber:iq:version"                                   /* XEP-0092 */
 #define XMLNS_TIME_OLD     "jabber:iq:time"                                      /* XEP-0090 */
@@ -256,6 +257,7 @@
 xt_status jabber_iq_query_features( struct im_connection *ic, char *bare_jid );
 xt_status jabber_iq_query_server( struct im_connection *ic, char *jid, char *xmlns );
 void jabber_iq_version_send( struct im_connection *ic, struct jabber_buddy *bud, void *data );
+int jabber_iq_register_password( struct im_connection *ic, const char *password );
 
 /* si.c */
 int jabber_si_handle_request( struct im_connection *ic, struct xt_node *node, struct xt_node *sinode );

=== modified file 'protocols/nogaim.h'
--- protocols/nogaim.h	2013-02-21 19:15:59 +0000
+++ protocols/nogaim.h	2014-04-23 23:06:55 +0000
@@ -261,13 +261,16 @@
 	
 	GList *(* buddy_action_list) (struct bee_user *bu);
 	void *(* buddy_action) (struct bee_user *bu, const char *action, char * const args[], void *data);
-	
+
+	/* Implement callback if you want to perform some action when account
+	   password is changed. */
+	void (* set_password) (struct im_connection *, char *pass);
+
 	/* Some placeholders so eventually older plugins may cooperate with newer BitlBees. */
 	void *resv1;
 	void *resv2;
 	void *resv3;
 	void *resv4;
-	void *resv5;
 };
 
 /* im_api core stuff. */

