// Path: asmack/org/jivesoftware/smack/filter/AndFilter.java
// public class AndFilter implements PacketFilter {
// 
//     /**
//      * The list of filters.
//      */
//     private List<PacketFilter> filters = new ArrayList<PacketFilter>();
// 
//     /**
//      * Creates an empty AND filter. Filters should be added using the
//      * {@link #addFilter(PacketFilter)} method.
//      */
//     public AndFilter() {
// 
//     }
// 
//     /**
//      * Creates an AND filter using the specified filters.
//      *
//      * @param filters the filters to add.
//      */
//     public AndFilter(PacketFilter... filters) {
//         if (filters == null) {
//             throw new IllegalArgumentException("Parameter cannot be null.");
//         }
//         for(PacketFilter filter : filters) {
//             if(filter == null) {
//                 throw new IllegalArgumentException("Parameter cannot be null.");
//             }
//             this.filters.add(filter);
//         }
//     }
// 
//     /**
//      * Adds a filter to the filter list for the AND operation. A packet
//      * will pass the filter if all of the filters in the list accept it.
//      *
//      * @param filter a filter to add to the filter list.
//      */
//     public void addFilter(PacketFilter filter) {
//         if (filter == null) {
//             throw new IllegalArgumentException("Parameter cannot be null.");
//         }
//         filters.add(filter);
//     }
// 
//     public boolean accept(Packet packet) {
//         for (PacketFilter filter : filters) {
//             if (!filter.accept(packet)) {
//                 return false;
//             }
//         }
//         return true;
//     }
// 
//     public String toString() {
//         return filters.toString();
//     }
// }


import org.jivesoftware.smack.filter.PacketTypeFilter;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Registration;
import org.jivesoftware.smack.util.StringUtils;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import org.jivesoftware.smack.filter.AndFilter;
import org.jivesoftware.smack.filter.PacketFilter;
import org.jivesoftware.smack.filter.PacketIDFilter;
            attributes.put(attributeName, "");
        }
        createAccount(username, password, attributes);
    }

    /**
     * Creates a new account using the specified username, password and account attributes.
     * The attributes Map must contain only String name/value pairs and must also have values
     * for all required attributes.
     *
     * @param username the username.
     * @param password the password.
     * @param attributes the account attributes.
     * @throws XMPPException if an error occurs creating the account.
     * @see #getAccountAttributes()
     */
    public void createAccount(String username, String password, Map<String, String> attributes)
            throws XMPPException
    {
        if (!supportsAccountCreation()) {
            throw new XMPPException("Server does not support account creation.");
        }
        Registration reg = new Registration();
        reg.setType(IQ.Type.SET);
        reg.setTo(connection.getServiceName());
        reg.setUsername(username);
        reg.setPassword(password);
        for(String s : attributes.keySet()){
        	reg.addAttribute(s, attributes.get(s));
        }
// Path: asmack/org/jivesoftware/smack/filter/AndFilter.java
// public class AndFilter implements PacketFilter {
// 
//     /**
//      * The list of filters.
//      */
//     private List<PacketFilter> filters = new ArrayList<PacketFilter>();
// 
//     /**
//      * Creates an empty AND filter. Filters should be added using the
//      * {@link #addFilter(PacketFilter)} method.
//      */
//     public AndFilter() {
// 
//     }
// 
//     /**
//      * Creates an AND filter using the specified filters.
//      *
//      * @param filters the filters to add.
//      */
//     public AndFilter(PacketFilter... filters) {
//         if (filters == null) {
//             throw new IllegalArgumentException("Parameter cannot be null.");
//         }
//         for(PacketFilter filter : filters) {
//             if(filter == null) {
//                 throw new IllegalArgumentException("Parameter cannot be null.");
//             }
//             this.filters.add(filter);
//         }
//     }
// 
//     /**
//      * Adds a filter to the filter list for the AND operation. A packet
//      * will pass the filter if all of the filters in the list accept it.
//      *
//      * @param filter a filter to add to the filter list.
//      */
//     public void addFilter(PacketFilter filter) {
//         if (filter == null) {
//             throw new IllegalArgumentException("Parameter cannot be null.");
//         }
//         filters.add(filter);
//     }
// 
//     public boolean accept(Packet packet) {
//         for (PacketFilter filter : filters) {
//             if (!filter.accept(packet)) {
//                 return false;
//             }
//         }
//         return true;
//     }
// 
//     public String toString() {
//         return filters.toString();
//     }
// }


// Path: asmack/org/jivesoftware/smack/AccountManager.java
import org.jivesoftware.smack.filter.PacketTypeFilter;
import org.jivesoftware.smack.packet.IQ;
import org.jivesoftware.smack.packet.Registration;
import org.jivesoftware.smack.util.StringUtils;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import org.jivesoftware.smack.filter.AndFilter;
import org.jivesoftware.smack.filter.PacketFilter;
import org.jivesoftware.smack.filter.PacketIDFilter;

            attributes.put(attributeName, "");
        }
        createAccount(username, password, attributes);
    }

    /**
     * Creates a new account using the specified username, password and account attributes.
     * The attributes Map must contain only String name/value pairs and must also have values
     * for all required attributes.
     *
     * @param username the username.
     * @param password the password.
     * @param attributes the account attributes.
     * @throws XMPPException if an error occurs creating the account.
     * @see #getAccountAttributes()
     */
    public void createAccount(String username, String password, Map<String, String> attributes)
            throws XMPPException
    {
        if (!supportsAccountCreation()) {
            throw new XMPPException("Server does not support account creation.");
        }
        Registration reg = new Registration();
        reg.setType(IQ.Type.SET);
        reg.setTo(connection.getServiceName());
        reg.setUsername(username);
        reg.setPassword(password);
        for(String s : attributes.keySet()){
        	reg.addAttribute(s, attributes.get(s));
        }
        PacketFilter filter = new AndFilter(new PacketIDFilter(reg.getPacketID()),