pidgin: 726c5220: jabber: Remember the last-used user dire...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sun Apr 10 15:25:47 EDT 2011


----------------------------------------------------------------------
Revision: 726c5220207c01e8799797c7d6d4455d23159281
Parent:   3bc7f13a1d05ed6aa6f189dedf119bcdd4fa3d5c
Author:   pidgin at keithmoyer.com
Date:     04/10/11 15:21:27
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/726c5220207c01e8799797c7d6d4455d23159281

Changelog: 

jabber: Remember the last-used user directory.  Closes #12451

Patch from Keith Moyer.

Changes against parent 3bc7f13a1d05ed6aa6f189dedf119bcdd4fa3d5c

  patched  ChangeLog
  patched  libpurple/protocols/jabber/buddy.c

-------------- next part --------------
============================================================
--- ChangeLog	213f949d29156217690dd49289b8bb5e2df9a6f6
+++ ChangeLog	7fb7bde31ce0f6fe188727523aad3a5e5f7247de
@@ -54,6 +54,10 @@ version 2.8.0 (??/??/????):
 	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)
============================================================
--- libpurple/protocols/jabber/buddy.c	b085797c8a8af161ad4ee7d1cc442ab2e8db9990
+++ libpurple/protocols/jabber/buddy.c	cc8eb3d80d50e26c468775dec13f90e4bde17255
@@ -2229,6 +2229,16 @@ void jabber_user_search(JabberStream *js
 		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 @@ void jabber_user_search_begin(PurplePlug
 {
 	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,


More information about the Commits mailing list