Commit 8cae5283 authored by guus's avatar guus

Applying patch provided by Steven te Brinke. XEP-0091 is replaced by XEP-0203,...

Applying patch provided by Steven te Brinke. XEP-0091 is replaced by XEP-0203, so Steven added support for XEP-0203 without removing support for XEP-0091 for backward compatibility. (OF-372)

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@11798 b35dd754-fafc-0310-a699-88a17e54d16e
parent 75936f70
...@@ -130,11 +130,11 @@ Suite</a>.</p> ...@@ -130,11 +130,11 @@ Suite</a>.</p>
<br> <br>
<a name="jeps"></a> <a name="jeps"></a>
<h2>List of JEPs Supported</h2> <h2>List of XEPs Supported</h2>
<p>The table below lists all JEPs supported by Openfire and indicates which JEPs are part of the <p>The table below lists all XEPs supported by Openfire and indicates which XEPs are part of the
<a href="#basic">Basic</a> or <a href="#intermediate">Intermediate</a> Protocol Suites listed above. <a href="#basic">Basic</a> or <a href="#intermediate">Intermediate</a> Protocol Suites listed above.
JEPs that only require client-side support are omitted.</p> XEPs that only require client-side support are omitted.</p>
<table class="dbtable"> <table class="dbtable">
<tr> <tr>
...@@ -159,10 +159,10 @@ JEPs that only require client-side support are omitted.</p> ...@@ -159,10 +159,10 @@ JEPs that only require client-side support are omitted.</p>
<td><a href="http://www.xmpp.org/extensions/xep-0045.html">XEP-0045</a>: Multi-User Chat</td> <td><a href="http://www.xmpp.org/extensions/xep-0045.html">XEP-0045</a>: Multi-User Chat</td>
<td>Intermediate</td> <td>Intermediate</td>
</tr><tr> </tr><tr>
<td><a href="http://www.xmpp.org/xeps/xep-0049.html">XEP-0049</a>: Private XML Storage</td> <td><a href="http://www.xmpp.org/extensions/xep-0049.html">XEP-0049</a>: Private XML Storage</td>
<td>-</td> <td>-</td>
</tr><tr> </tr><tr>
<td><a href="http://www.xmpp.org/jeps/xep-0050.html">XEP-0050</a>: Ad-Hoc Commands</td> <td><a href="http://www.xmpp.org/extensions/xep-0050.html">XEP-0050</a>: Ad-Hoc Commands</td>
<td>-</td> <td>-</td>
</tr><tr> </tr><tr>
<td><a href="http://www.xmpp.org/extensions/xep-0054.html">XEP-0054</a>: vcard-temp</td> <td><a href="http://www.xmpp.org/extensions/xep-0054.html">XEP-0054</a>: vcard-temp</td>
...@@ -177,7 +177,7 @@ JEPs that only require client-side support are omitted.</p> ...@@ -177,7 +177,7 @@ JEPs that only require client-side support are omitted.</p>
<td><a href="http://www.xmpp.org/extensions/xep-0060.html">XEP-0060</a>: Publish-Subscribe</td> <td><a href="http://www.xmpp.org/extensions/xep-0060.html">XEP-0060</a>: Publish-Subscribe</td>
<td>-</td> <td>-</td>
</tr><tr> </tr><tr>
<td><a href="http://www.jabber.org/jeps/xep-0065.html">XEP-0065</a>: SOCKS5 Bytestreams</td> <td><a href="http://www.xmpp.org/extensions/xep-0065.html">XEP-0065</a>: SOCKS5 Bytestreams</td>
<td>Intermediate</td> <td>Intermediate</td>
</tr><tr> </tr><tr>
<td><a href="http://www.xmpp.org/extensions/xep-0077.html">XEP-0077</a>: In-Band Registration</td> <td><a href="http://www.xmpp.org/extensions/xep-0077.html">XEP-0077</a>: In-Band Registration</td>
...@@ -195,7 +195,7 @@ JEPs that only require client-side support are omitted.</p> ...@@ -195,7 +195,7 @@ JEPs that only require client-side support are omitted.</p>
<td><a href="http://www.xmpp.org/extensions/xep-0090.html">XEP-0090</a>: Entity Time</td> <td><a href="http://www.xmpp.org/extensions/xep-0090.html">XEP-0090</a>: Entity Time</td>
<td>-</td> <td>-</td>
</tr><tr> </tr><tr>
<td><a href="http://www.xmpp.org/extensions/xep-0091.html">XEP-0091</a>: Delayed Delivery</td> <td><a href="http://www.xmpp.org/extensions/xep-0091.html">XEP-0091</a>: Legacy Delayed Delivery</td>
<td>-</td> <td>-</td>
</tr><tr> </tr><tr>
<td><a href="http://www.xmpp.org/extensions/xep-0092.html">XEP-0092</a>: Software Version</td> <td><a href="http://www.xmpp.org/extensions/xep-0092.html">XEP-0092</a>: Software Version</td>
...@@ -230,6 +230,9 @@ JEPs that only require client-side support are omitted.</p> ...@@ -230,6 +230,9 @@ JEPs that only require client-side support are omitted.</p>
</tr><tr> </tr><tr>
<td><a href="http://www.xmpp.org/extensions/xep-0175.html">XEP-0175</a>: Best Practices for Use of SASL ANONYMOUS</td> <td><a href="http://www.xmpp.org/extensions/xep-0175.html">XEP-0175</a>: Best Practices for Use of SASL ANONYMOUS</td>
<td>-</td> <td>-</td>
</tr><tr>
<td><a href="http://www.xmpp.org/extensions/xep-0203.html">XEP-0203</a>: Delayed Delivery</td>
<td>-</td>
</tr> </tr>
</table> </table>
<br> <br>
......
...@@ -89,6 +89,7 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene ...@@ -89,6 +89,7 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene
private Cache<String, Integer> sizeCache; private Cache<String, Integer> sizeCache;
private FastDateFormat dateFormat; private FastDateFormat dateFormat;
private FastDateFormat dateFormatOld;
/** /**
* Pattern to use for detecting invalid XML characters. Invalid XML characters will * Pattern to use for detecting invalid XML characters. Invalid XML characters will
* be removed from the stored offline messages. * be removed from the stored offline messages.
...@@ -114,7 +115,9 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene ...@@ -114,7 +115,9 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene
*/ */
public OfflineMessageStore() { public OfflineMessageStore() {
super("Offline Message Store"); super("Offline Message Store");
dateFormat = FastDateFormat.getInstance(JiveConstants.XMPP_DELAY_DATETIME_FORMAT, dateFormat = FastDateFormat.getInstance(JiveConstants.XMPP_DATETIME_FORMAT,
TimeZone.getTimeZone("UTC"));
dateFormatOld = FastDateFormat.getInstance(JiveConstants.XMPP_DELAY_DATETIME_FORMAT,
TimeZone.getTimeZone("UTC")); TimeZone.getTimeZone("UTC"));
sizeCache = CacheFactory.createCache("Offline Message Size"); sizeCache = CacheFactory.createCache("Offline Message Size");
} }
...@@ -216,10 +219,15 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene ...@@ -216,10 +219,15 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene
message = new OfflineMessage(creationDate, message = new OfflineMessage(creationDate,
xmlReader.read(new StringReader(msgXML)).getRootElement()); xmlReader.read(new StringReader(msgXML)).getRootElement());
} }
// Add a delayed delivery (JEP-0091) element to the message.
Element delay = message.addChildElement("x", "jabber:x:delay"); // Add a delayed delivery (XEP-0203) element to the message.
Element delay = message.addChildElement("delay", "urn:xmpp:delay");
delay.addAttribute("from", XMPPServer.getInstance().getServerInfo().getXMPPDomain()); delay.addAttribute("from", XMPPServer.getInstance().getServerInfo().getXMPPDomain());
delay.addAttribute("stamp", dateFormat.format(creationDate)); delay.addAttribute("stamp", dateFormat.format(creationDate));
// Add a legacy delayed delivery (XEP-0091) element to the message. XEP is obsolete and support should be dropped in future.
delay = message.addChildElement("x", "jabber:x:delay");
delay.addAttribute("from", XMPPServer.getInstance().getServerInfo().getXMPPDomain());
delay.addAttribute("stamp", dateFormatOld.format(creationDate));
messages.add(message); messages.add(message);
} }
// Check if the offline messages loaded should be deleted, and that there are // Check if the offline messages loaded should be deleted, and that there are
...@@ -279,10 +287,14 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene ...@@ -279,10 +287,14 @@ public class OfflineMessageStore extends BasicModule implements UserEventListene
String msgXML = rs.getString(1); String msgXML = rs.getString(1);
message = new OfflineMessage(creationDate, message = new OfflineMessage(creationDate,
xmlReader.read(new StringReader(msgXML)).getRootElement()); xmlReader.read(new StringReader(msgXML)).getRootElement());
// Add a delayed delivery (JEP-0091) element to the message. // Add a delayed delivery (XEP-0203) element to the message.
Element delay = message.addChildElement("x", "jabber:x:delay"); Element delay = message.addChildElement("delay", "urn:xmpp:delay");
delay.addAttribute("from", XMPPServer.getInstance().getServerInfo().getXMPPDomain()); delay.addAttribute("from", XMPPServer.getInstance().getServerInfo().getXMPPDomain());
delay.addAttribute("stamp", dateFormat.format(creationDate)); delay.addAttribute("stamp", dateFormat.format(creationDate));
// Add a legacy delayed delivery (XEP-0091) element to the message. XEP is obsolete and support should be dropped in future.
delay = message.addChildElement("x", "jabber:x:delay");
delay.addAttribute("from", XMPPServer.getInstance().getServerInfo().getXMPPDomain());
delay.addAttribute("stamp", dateFormatOld.format(creationDate));
} }
} }
catch (Exception e) { catch (Exception e) {
......
...@@ -41,6 +41,8 @@ import java.util.TimeZone; ...@@ -41,6 +41,8 @@ import java.util.TimeZone;
public final class MUCRoomHistory { public final class MUCRoomHistory {
private static final FastDateFormat UTC_FORMAT = FastDateFormat private static final FastDateFormat UTC_FORMAT = FastDateFormat
.getInstance(JiveConstants.XMPP_DATETIME_FORMAT, TimeZone.getTimeZone("UTC"));
private static final FastDateFormat UTC_FORMAT_OLD = FastDateFormat
.getInstance(JiveConstants.XMPP_DELAY_DATETIME_FORMAT, TimeZone.getTimeZone("UTC")); .getInstance(JiveConstants.XMPP_DELAY_DATETIME_FORMAT, TimeZone.getTimeZone("UTC"));
private MUCRoom room; private MUCRoom room;
...@@ -107,14 +109,17 @@ public final class MUCRoomHistory { ...@@ -107,14 +109,17 @@ public final class MUCRoomHistory {
} }
// Add the delay information to the message // Add the delay information to the message
Element delayInformation = packetToAdd.addChildElement("x", "jabber:x:delay"); Element delayInformation = packetToAdd.addChildElement("delay", "urn:xmpp:delay");
Element delayInformationOld = packetToAdd.addChildElement("x", "jabber:x:delay");
Date current = new Date(); Date current = new Date();
delayInformation.addAttribute("stamp", UTC_FORMAT.format(current)); delayInformation.addAttribute("stamp", UTC_FORMAT.format(current));
delayInformationOld.addAttribute("stamp", UTC_FORMAT_OLD.format(current));
if (room.canAnyoneDiscoverJID()) { if (room.canAnyoneDiscoverJID()) {
// Set the Full JID as the "from" attribute // Set the Full JID as the "from" attribute
try { try {
MUCRole role = room.getOccupant(packet.getFrom().getResource()); MUCRole role = room.getOccupant(packet.getFrom().getResource());
delayInformation.addAttribute("from", role.getUserAddress().toString()); delayInformation.addAttribute("from", role.getUserAddress().toString());
delayInformationOld.addAttribute("from", role.getUserAddress().toString());
} }
catch (UserNotFoundException e) { catch (UserNotFoundException e) {
// Ignore. // Ignore.
...@@ -123,6 +128,7 @@ public final class MUCRoomHistory { ...@@ -123,6 +128,7 @@ public final class MUCRoomHistory {
else { else {
// Set the Room JID as the "from" attribute // Set the Room JID as the "from" attribute
delayInformation.addAttribute("from", packet.getFrom().toString()); delayInformation.addAttribute("from", packet.getFrom().toString());
delayInformationOld.addAttribute("from", packet.getFrom().toString());
} }
historyStrategy.addMessage(packetToAdd); historyStrategy.addMessage(packetToAdd);
} }
...@@ -172,15 +178,19 @@ public final class MUCRoomHistory { ...@@ -172,15 +178,19 @@ public final class MUCRoomHistory {
} }
// Add the delay information to the message // Add the delay information to the message
Element delayInformation = message.addChildElement("x", "jabber:x:delay"); Element delayInformation = message.addChildElement("delay", "urn:xmpp:delay");
Element delayInformationOld = message.addChildElement("x", "jabber:x:delay");
delayInformation.addAttribute("stamp", UTC_FORMAT.format(sentDate)); delayInformation.addAttribute("stamp", UTC_FORMAT.format(sentDate));
delayInformationOld.addAttribute("stamp", UTC_FORMAT_OLD.format(sentDate));
if (room.canAnyoneDiscoverJID()) { if (room.canAnyoneDiscoverJID()) {
// Set the Full JID as the "from" attribute // Set the Full JID as the "from" attribute
delayInformation.addAttribute("from", senderJID); delayInformation.addAttribute("from", senderJID);
delayInformationOld.addAttribute("from", senderJID);
} }
else { else {
// Set the Room JID as the "from" attribute // Set the Room JID as the "from" attribute
delayInformation.addAttribute("from", room.getRole().getRoleAddress().toString()); delayInformation.addAttribute("from", room.getRole().getRoleAddress().toString());
delayInformationOld.addAttribute("from", room.getRole().getRoleAddress().toString());
} }
historyStrategy.addMessage(message); historyStrategy.addMessage(message);
} }
......
...@@ -57,6 +57,7 @@ import org.jivesoftware.openfire.roster.RosterItem; ...@@ -57,6 +57,7 @@ import org.jivesoftware.openfire.roster.RosterItem;
import org.jivesoftware.openfire.session.ClientSession; import org.jivesoftware.openfire.session.ClientSession;
import org.jivesoftware.openfire.user.UserNotFoundException; import org.jivesoftware.openfire.user.UserNotFoundException;
import org.jivesoftware.util.FastDateFormat; import org.jivesoftware.util.FastDateFormat;
import org.jivesoftware.util.JiveConstants;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.StringUtils; import org.jivesoftware.util.StringUtils;
import org.jivesoftware.util.cache.Cacheable; import org.jivesoftware.util.cache.Cacheable;
...@@ -166,7 +167,7 @@ public class PEPService implements PubSubService, Cacheable { ...@@ -166,7 +167,7 @@ public class PEPService implements PubSubService, Cacheable {
private PublishedItemTask publishedItemTask; private PublishedItemTask publishedItemTask;
static { static {
fastDateFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", TimeZone.getTimeZone("UTC")); fastDateFormat = FastDateFormat.getInstance(JiveConstants.XMPP_DATETIME_FORMAT, TimeZone.getTimeZone("UTC"));
} }
/** /**
...@@ -544,7 +545,7 @@ public class PEPService implements PubSubService, Cacheable { ...@@ -544,7 +545,7 @@ public class PEPService implements PubSubService, Cacheable {
notification.setBody(LocaleUtils.getLocalizedString("pubsub.notification.message.body")); notification.setBody(LocaleUtils.getLocalizedString("pubsub.notification.message.body"));
} }
// Include date when published item was created // Include date when published item was created
notification.getElement().addElement("x", "jabber:x:delay").addAttribute("stamp", fastDateFormat.format(leafLastPublishedItem.getCreationDate())); notification.getElement().addElement("delay", "urn:xmpp:delay").addAttribute("stamp", fastDateFormat.format(leafLastPublishedItem.getCreationDate()));
// Send the event notification to the subscriber // Send the event notification to the subscriber
this.sendNotification(subscription.getNode(), notification, subscription.getJID()); this.sendNotification(subscription.getNode(), notification, subscription.getJID());
} }
......
...@@ -31,6 +31,7 @@ import java.util.TimeZone; ...@@ -31,6 +31,7 @@ import java.util.TimeZone;
import org.dom4j.Element; import org.dom4j.Element;
import org.jivesoftware.util.FastDateFormat; import org.jivesoftware.util.FastDateFormat;
import org.jivesoftware.util.JiveConstants;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.LocaleUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -146,7 +147,7 @@ public class NodeSubscription { ...@@ -146,7 +147,7 @@ public class NodeSubscription {
dateFormat = new SimpleDateFormat("yyyy-MM-DD'T'HH:mm:ss.SSS'Z'"); dateFormat = new SimpleDateFormat("yyyy-MM-DD'T'HH:mm:ss.SSS'Z'");
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
fastDateFormat = FastDateFormat fastDateFormat = FastDateFormat
.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", TimeZone.getTimeZone("UTC")); .getInstance(JiveConstants.XMPP_DATETIME_FORMAT, TimeZone.getTimeZone("UTC"));
} }
/** /**
...@@ -830,7 +831,7 @@ public class NodeSubscription { ...@@ -830,7 +831,7 @@ public class NodeSubscription {
notification.setBody(LocaleUtils.getLocalizedString("pubsub.notification.message.body")); notification.setBody(LocaleUtils.getLocalizedString("pubsub.notification.message.body"));
} }
// Include date when published item was created // Include date when published item was created
notification.getElement().addElement("x", "jabber:x:delay") notification.getElement().addElement("delay", "urn:xmpp:delay")
.addAttribute("stamp", fastDateFormat.format(publishedItem.getCreationDate())); .addAttribute("stamp", fastDateFormat.format(publishedItem.getCreationDate()));
// Send the event notification to the subscriber // Send the event notification to the subscriber
service.sendNotification(node, notification, jid); service.sendNotification(node, notification, jid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment