changeset 31912:ba00769a1493

jabber: Remember the last-used user directory. Closes #12451 Patch from Keith Moyer. committer: Paul Aurich <paul@darkrain42.org>
author pidgin@keithmoyer.com
date Sun, 10 Apr 2011 19:21:27 +0000
parents c62dc6d25802
children 277b7f1d6214 74e2492967be 12676cfd4a1e
files ChangeLog libpurple/protocols/jabber/buddy.c
diffstat 2 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Apr 10 02:35:17 2011 +0000
+++ b/ChangeLog	Sun Apr 10 19:21:27 2011 +0000
@@ -54,6 +54,10 @@
 	IRC:
 	* Add "authserv" service command.  (tomos) (#13337)
 
+	XMPP:
+	* Remember the previously entered user directory when searching.
+	  (Keith Moyer) (#12451)
+
 	Plugins:
 	* The Voice/Video Settings plugin now includes the ability to test
 	  microphone settings. (Jakub Adam) (#13182)
--- a/libpurple/protocols/jabber/buddy.c	Sun Apr 10 02:35:17 2011 +0000
+++ b/libpurple/protocols/jabber/buddy.c	Sun Apr 10 19:21:27 2011 +0000
@@ -2229,6 +2229,16 @@
 		return;
 	}
 
+	/* If the value provided isn't the disco#info default, persist it.  Otherwise,
+	   make sure we aren't persisting an old value */
+	if(js->user_directories && js->user_directories->data &&
+	   !strcmp(directory, js->user_directories->data)) {
+		purple_account_set_string(js->gc->account, "user_directory", "");
+	}
+	else {
+		purple_account_set_string(js->gc->account, "user_directory", directory);
+	}
+
 	iq = jabber_iq_new_query(js, JABBER_IQ_GET, "jabber:iq:search");
 	xmlnode_set_attrib(iq->node, "to", directory);
 
@@ -2241,10 +2251,13 @@
 {
 	PurpleConnection *gc = (PurpleConnection *) action->context;
 	JabberStream *js = purple_connection_get_protocol_data(gc);
+	const char *def_val = purple_account_get_string(js->gc->account, "user_directory", "");
+	if(!*def_val && js->user_directories)
+		def_val = js->user_directories->data;
 
 	purple_request_input(gc, _("Enter a User Directory"), _("Enter a User Directory"),
 			_("Select a user directory to search"),
-			js->user_directories ? js->user_directories->data : NULL,
+			def_val,
 			FALSE, FALSE, NULL,
 			_("Search Directory"), PURPLE_CALLBACK(jabber_user_search),
 			_("Cancel"), NULL,