2014-02-17 23:58:40 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Copyright the original author or authors
|
|
|
|
*
|
|
|
|
* 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.smackx.pubsub;
|
|
|
|
|
2014-03-21 09:51:52 +01:00
|
|
|
import org.jivesoftware.smack.util.XmlStringBuilder;
|
2014-02-17 23:58:40 +01:00
|
|
|
|
|
|
|
/**
|
2018-05-09 23:06:12 +02:00
|
|
|
* A stanza extension representing the <b>options</b> element.
|
|
|
|
*
|
2014-02-17 23:58:40 +01:00
|
|
|
* @author Robin Collier
|
|
|
|
*/
|
2018-04-06 10:21:46 +02:00
|
|
|
public class OptionsExtension extends NodeExtension {
|
2017-02-07 22:02:40 +01:00
|
|
|
protected String jid;
|
|
|
|
protected String id;
|
2015-03-17 11:33:02 +01:00
|
|
|
|
2018-04-06 10:21:46 +02:00
|
|
|
public OptionsExtension(String subscriptionJid) {
|
2017-02-07 22:02:40 +01:00
|
|
|
this(subscriptionJid, null, null);
|
|
|
|
}
|
2015-03-17 11:33:02 +01:00
|
|
|
|
2018-04-06 10:21:46 +02:00
|
|
|
public OptionsExtension(String subscriptionJid, String nodeId) {
|
2017-02-07 22:02:40 +01:00
|
|
|
this(subscriptionJid, nodeId, null);
|
|
|
|
}
|
2015-03-17 11:33:02 +01:00
|
|
|
|
2018-04-06 10:21:46 +02:00
|
|
|
public OptionsExtension(String jid, String nodeId, String subscriptionId) {
|
2017-02-07 22:02:40 +01:00
|
|
|
super(PubSubElementType.OPTIONS, nodeId);
|
|
|
|
this.jid = jid;
|
|
|
|
id = subscriptionId;
|
|
|
|
}
|
2015-03-17 11:33:02 +01:00
|
|
|
|
2018-04-06 10:21:46 +02:00
|
|
|
public String getJid() {
|
2017-02-07 22:02:40 +01:00
|
|
|
return jid;
|
|
|
|
}
|
2015-03-17 11:33:02 +01:00
|
|
|
|
2018-04-06 10:21:46 +02:00
|
|
|
public String getId() {
|
2017-02-07 22:02:40 +01:00
|
|
|
return id;
|
|
|
|
}
|
2014-02-17 23:58:40 +01:00
|
|
|
|
2014-03-21 09:51:52 +01:00
|
|
|
@Override
|
2020-06-14 16:52:13 +02:00
|
|
|
protected void addXml(XmlStringBuilder xml) {
|
|
|
|
xml.rightAngleBracket();
|
|
|
|
|
2014-03-21 09:51:52 +01:00
|
|
|
xml.halfOpenElement(getElementName());
|
|
|
|
xml.attribute("jid", jid);
|
|
|
|
xml.optAttribute("node", getNode());
|
|
|
|
xml.optAttribute("subid", id);
|
2020-06-14 16:52:13 +02:00
|
|
|
|
2014-03-21 09:51:52 +01:00
|
|
|
xml.closeEmptyElement();
|
2020-06-14 16:52:13 +02:00
|
|
|
xml.closeElement(this);
|
2014-03-21 09:51:52 +01:00
|
|
|
}
|
2014-02-17 23:58:40 +01:00
|
|
|
}
|