Username and password are optional in Registration. SMACK-62

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2503 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Gaston Dombiak 2005-06-17 22:28:12 +00:00 committed by gaston
parent 8a48d3d11e
commit 2271ca730e
2 changed files with 6 additions and 48 deletions

View File

@ -187,8 +187,8 @@ public class AccountManager {
Registration reg = new Registration();
reg.setType(IQ.Type.SET);
reg.setTo(connection.getHost());
reg.setUsername(username);
reg.setPassword(password);
attributes.put("username",username);
attributes.put("password",password);
reg.setAttributes(attributes);
PacketFilter filter = new AndFilter(new PacketIDFilter(reg.getPacketID()),
new PacketTypeFilter(IQ.class));
@ -217,8 +217,10 @@ public class AccountManager {
Registration reg = new Registration();
reg.setType(IQ.Type.SET);
reg.setTo(connection.getHost());
reg.setUsername(StringUtils.parseName(connection.getUser()));
reg.setPassword(newPassword);
HashMap map = new HashMap();
map.put("username",StringUtils.parseName(connection.getUser()));
map.put("password",newPassword);
reg.setAttributes(map);
PacketFilter filter = new AndFilter(new PacketIDFilter(reg.getPacketID()),
new PacketTypeFilter(IQ.class));
PacketCollector collector = connection.createPacketCollector(filter);

View File

@ -48,47 +48,9 @@ import java.util.Iterator;
*/
public class Registration extends IQ {
private String username = null;
private String password = null;
private String instructions = null;
private Map attributes = null;
/**
* Returns the username, or <tt>null</tt> if no username has ben set.
*
* @return the username.
*/
public String getUsername() {
return username;
}
/**
* Sets the username.
*
* @param username the username.
*/
public void setUsername(String username) {
this.username = username;
}
/**
* Returns the password, or <tt>null</tt> if no password has been set.
*
* @return the password.
*/
public String getPassword() {
return password;
}
/**
* Sets the password.
*
* @param password the password.
*/
public void setPassword(String password) {
this.password = password;
}
/**
* Returns the registration instructions, or <tt>null</tt> if no instructions
* have been set. If present, instructions should be displayed to the end-user
@ -130,12 +92,6 @@ public class Registration extends IQ {
public String getChildElementXML() {
StringBuffer buf = new StringBuffer();
buf.append("<query xmlns=\"jabber:iq:register\">");
if (username != null) {
buf.append("<username>").append(username).append("</username>");
}
if (password != null) {
buf.append("<password>").append(password).append("</password>");
}
if (instructions != null) {
buf.append("<instructions>").append(instructions).append("</instructions>");
}