diff --git a/source/org/jivesoftware/smack/AccountManager.java b/source/org/jivesoftware/smack/AccountManager.java
index 57c7aecc5..0618aacc3 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 instructions for creating a new account, or null if there
+ * are no instructions. If present, instructions should be displayed to the end-user
+ * that will complete the registration process.
+ *
+ * @return the account creation instructions, or null if there are none.
+ */
+ public String getAccountInstructions() {
+ try {
+ if (info == null) {
+ getRegistrationInfo();
+ }
+ return info.getInstructions();
+ }
+ catch (XMPPException xe) {
+ return null;
+ }
+ }
+
/**
* Creates a new account using the specified username and password. The server may
* require a number of extra account attributes such as an email address and phone
@@ -149,6 +168,9 @@ public class AccountManager {
* @throws XMPPException if an error occurs creating the account.
*/
public void createAccount(String username, String password) throws XMPPException {
+ if (!supportsAccountCreation()) {
+ throw new XMPPException("Server does not support account creation.");
+ }
// Create a map for all the required attributes, but give them blank values.
Map attributes = new HashMap();
for (Iterator i=getAccountAttributes(); i.hasNext(); ) {
diff --git a/source/org/jivesoftware/smack/packet/Registration.java b/source/org/jivesoftware/smack/packet/Registration.java
index 01b809c5d..5898d8cbc 100644
--- a/source/org/jivesoftware/smack/packet/Registration.java
+++ b/source/org/jivesoftware/smack/packet/Registration.java
@@ -82,6 +82,7 @@ public class Registration extends IQ {
private String username = null;
private String password = null;
+ private String instructions = null;
private Map attributes = null;
/**
@@ -120,6 +121,26 @@ public class Registration extends IQ {
this.password = password;
}
+ /**
+ * Returns the registration instructions, or null if no instructions
+ * have been set. If present, instructions should be displayed to the end-user
+ * that will complete the registration process.
+ *
+ * @return the registration instructions, or null if there are none.
+ */
+ public String getInstructions() {
+ return instructions;
+ }
+
+ /**
+ * Sets the registration instructions.
+ *
+ * @param instructions the registration instructions.
+ */
+ public void setInstructions(String instructions) {
+ this.instructions = instructions;
+ }
+
/**
* Returns the map of String key/value pairs of account attributes.
*
@@ -147,6 +168,9 @@ public class Registration extends IQ {
if (password != null) {
buf.append("").append(password).append("");
}
+ if (instructions != null) {
+ buf.append("").append(instructions).append("");
+ }
if (attributes != null && attributes.size() > 0) {
Iterator fieldNames = attributes.keySet().iterator();
while (fieldNames.hasNext()) {
@@ -160,4 +184,4 @@ public class Registration extends IQ {
buf.append("");
return buf.toString();
}
-}
+}
\ No newline at end of file