mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-12-14 00:51:19 +01:00
Enable PacketExtensions for IQs
This is actually only part one, i.e. with this commit if the user adds a PacketExtension to an IQ it will be included in IQ.toXml(). Which was previously only the case if the IQ subclass explicitly included packet extensions. The second part of the change is to change the IQ provider, so that packet extensions are automatically parsed. Cases where PacketExtensions are used for Message and IQ are slightly changed. The IQ sublcass now only has a field with this PacketExtension (see for example bytestreams.ibb.packet.DataPacketExtension). Also changed hoxt API: Removed unnecessary indirection and made the API more Smack idiomatic.
This commit is contained in:
parent
a9c798f3bb
commit
9e797c1b17
93 changed files with 1347 additions and 1438 deletions
|
|
@ -43,6 +43,7 @@ public class Time extends IQ {
|
|||
private String tzo;
|
||||
|
||||
public Time() {
|
||||
super(ELEMENT, NAMESPACE);
|
||||
setType(Type.get);
|
||||
}
|
||||
|
||||
|
|
@ -53,6 +54,7 @@ public class Time extends IQ {
|
|||
* @param cal the time value.
|
||||
*/
|
||||
public Time(Calendar cal) {
|
||||
super(ELEMENT, NAMESPACE);
|
||||
tzo = XmppDateTime.asString(cal.getTimeZone());
|
||||
// Convert local time to the UTC time.
|
||||
utc = XmppDateTime.formatXEP0082Date(cal.getTime());
|
||||
|
|
@ -128,14 +130,17 @@ public class Time extends IQ {
|
|||
return time;
|
||||
}
|
||||
|
||||
public String getChildElementXML() {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
buf.append("<" + ELEMENT + " xmlns='" + NAMESPACE + "'>");
|
||||
@Override
|
||||
protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder buf) {
|
||||
buf.rightAngleBracket();
|
||||
|
||||
if (utc != null) {
|
||||
buf.append("<utc>").append(utc).append("</utc>");
|
||||
buf.append("<tzo>").append(tzo).append("</tzo>");
|
||||
} else {
|
||||
buf.setEmptyElement();
|
||||
}
|
||||
buf.append("</" + ELEMENT + ">");
|
||||
return buf.toString();
|
||||
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue