From a654adc588aa3d82096216179c99db99e8233b33 Mon Sep 17 00:00:00 2001 From: Gaston Dombiak Date: Sat, 23 Oct 2004 17:10:50 +0000 Subject: [PATCH] Added ability to obtain the value of a given account attribute. SMACK-164 git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2397 b35dd754-fafc-0310-a699-88a17e54d16e --- .../jivesoftware/smack/AccountManager.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/source/org/jivesoftware/smack/AccountManager.java b/source/org/jivesoftware/smack/AccountManager.java index 390632f49..6d25c47ed 100644 --- a/source/org/jivesoftware/smack/AccountManager.java +++ b/source/org/jivesoftware/smack/AccountManager.java @@ -136,6 +136,25 @@ public class AccountManager { return Collections.EMPTY_LIST.iterator(); } + /** + * Returns the value of a given account attribute or null if the account + * attribute wasn't found. + * + * @param name the name of the account attribute to return its value. + * @return the value of the account attribute or null if an account + * attribute wasn't found for the requested name. + */ + public String getAccountAttribute(String name) { + try { + if (info == null) { + getRegistrationInfo(); + } + return (String) info.getAttributes().get(name); + } + catch (XMPPException xe) { } + return null; + } + /** * Returns the instructions for creating a new account, or null if there * are no instructions. If present, instructions should be displayed to the end-user