/**
 *
 * Copyright © 2014 Florian Schmaus
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.jivesoftware.smack.packet;

import org.jivesoftware.smack.util.XmlStringBuilder;

/**
 * 
 */
public class StreamOpen extends FullStreamElement {

    public static final String ELEMENT = "stream:stream";
    public static final String NAMESPACE = "jabber:client";
    public static final String VERSION = "1.0";

    private final String service;

    public StreamOpen(String service) {
       this.service = service;
    }

    @Override
    public String getNamespace() {
        return NAMESPACE;
    }

    @Override
    public String getElementName() {
        return ELEMENT;
    }

    @Override
    public XmlStringBuilder toXML() {
        XmlStringBuilder xml = new XmlStringBuilder(this);
        xml.attribute("to", service);
        xml.attribute("xmlns:stream", "http://etherx.jabber.org/streams");
        xml.attribute("version", VERSION);
        xml.rightAngleBracket();
        return xml;
    }

}

@@ -816,16 +816,17 @@
 tream%22;%0A
+%0A
     publ
@@ -848,16 +848,23 @@
  String 
+CLIENT_
 NAMESPAC
@@ -919,101 +919,710 @@
 ing 
-VERSION = %221.0%22;%0A%0A    private final String service;%0A%0A    public StreamOpen(String service
+SERVER_NAMESPACE = %22jabber:server%22;%0A%0A    /**%0A     * RFC 6120 %C2%A7 4.7.5%0A     */%0A    public static final String VERSION = %221.0%22;%0A%0A    /**%0A     * RFC 6120 %C2%A7 4.7.1%0A     */%0A    private final String from;%0A%0A    /**%0A     * RFC 6120 %C2%A7 4.7.2%0A     */%0A    private final String to;%0A%0A    /**%0A     * RFC 6120 %C2%A7 4.7.3%0A     */%0A    private final String id;%0A%0A    /**%0A     * RFC 6120 %C2%A7 4.7.4%0A     */%0A    private final String lang;%0A%0A    /**%0A     * RFC 6120 %C2%A7 4.8.2%0A     */%0A    private final String contentNamespace;%0A%0A    public StreamOpen(String to) %7B%0A       this(to, null, null, null, StreamContentNamespace.client);%0A    %7D%0A%0A    public StreamOpen(String to, String from, String id, String lang, StreamContentNamespace ns
 ) %7B%0A
+ 
     
@@ -1633,26 +1633,374 @@
 his.
-service = service;
+to = to;%0A        this.from = from;%0A        this.id = id;%0A        this.lang = lang;%0A        switch (ns) %7B%0A        case client:%0A            this.contentNamespace = CLIENT_NAMESPACE;%0A            break;%0A        case server:%0A            this.contentNamespace = SERVER_NAMESPACE;%0A            break;%0A        default:%0A            throw new IllegalStateException();%0A        %7D
 %0A   
@@ -2067,25 +2067,32 @@
  return 
-NAMESPACE
+contentNamespace
 ;%0A    %7D%0A
@@ -2317,15 +2317,10 @@
 o%22, 
-service
+to
 );%0A 
@@ -2452,54 +2452,245 @@
 xml.
-rightAngleBracket();%0A        return xml;%0A    %7D%0A
+optAttribute(%22from%22, from);%0A        xml.optAttribute(%22id%22, id);%0A        xml.xmllangAttribute(lang);%0A        xml.rightAngleBracket();%0A        return xml;%0A    %7D%0A%0A    public enum StreamContentNamespace %7B%0A        client,%0A        server;%0A    %7D
 %0A%7D%0A

Add all possible attributes to StreamOpen