aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2017-08-06 14:28:00 +0200
committersteckbrief <steckbrief@chefmail.de>2017-08-06 14:28:00 +0200
commitbe1992ce897d3b0551e545646a3e0f45cc6dd8c2 (patch)
treec15c94ade61e5063095d8b429ae4acf85459493f /src/main/java/de/thedevstack/conversationsplus/xmpp/avatar
parentf8e083a32cb7232c9601f5011b14738d43bb3b06 (diff)
Implements XEP-0202 Entity Time, moves Software Version to xmpp package, moves namespace definitions for mam, carbons and avatar to xmpp package
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/xmpp/avatar')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacket.java8
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketGenerator.java16
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketParser.java4
3 files changed, 17 insertions, 11 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacket.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacket.java
new file mode 100644
index 00000000..86cb2274
--- /dev/null
+++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacket.java
@@ -0,0 +1,8 @@
+package de.thedevstack.conversationsplus.xmpp.avatar;
+
+/**
+ */
+public class AvatarPacket {
+ public static final String NAMESPACE_AVATAR_DATA = "urn:xmpp:avatar:data";
+ public static final String NAMESPACE_AVATAR_METADATA = "urn:xmpp:avatar:metadata";
+}
diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketGenerator.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketGenerator.java
index 4534e870..f9e04122 100644
--- a/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketGenerator.java
+++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketGenerator.java
@@ -9,11 +9,9 @@ import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket;
/**
* Generates the IQ Packets for handling Avatars
* as defined in XEP-0084.
- * @see {@link http://xmpp.org/extensions/xep-0084.html}
+ * @see http://xmpp.org/extensions/xep-0084.html
*/
public final class AvatarPacketGenerator {
- public static final String NAMESPACE_AVATAR_DATA = "urn:xmpp:avatar:data";
- public static final String NAMESPACE_AVATAR_METADATA = "urn:xmpp:avatar:metadata";
/**
* Generates an IqPacket for publishing avatar data.
@@ -37,9 +35,9 @@ public final class AvatarPacketGenerator {
public static IqPacket generatePublishAvatarPacket(Avatar avatar) {
final Element item = new Element("item");
item.setAttribute("id", avatar.sha1sum);
- final Element data = item.addChild("data", NAMESPACE_AVATAR_DATA);
+ final Element data = item.addChild("data", AvatarPacket.NAMESPACE_AVATAR_DATA);
data.setContent(avatar.image);
- return PubSubPacketGenerator.generatePubSubPublishPacket(NAMESPACE_AVATAR_DATA, item);
+ return PubSubPacketGenerator.generatePubSubPublishPacket(AvatarPacket.NAMESPACE_AVATAR_DATA, item);
}
/**
@@ -60,7 +58,7 @@ public final class AvatarPacketGenerator {
public static IqPacket generateRetrieveAvatarPacket(Avatar avatar) {
final Element item = new Element("item");
item.setAttribute("id", avatar.sha1sum);
- final IqPacket packet = PubSubPacketGenerator.generatePubSubRetrievePacket(NAMESPACE_AVATAR_DATA, item);
+ final IqPacket packet = PubSubPacketGenerator.generatePubSubRetrievePacket(AvatarPacket.NAMESPACE_AVATAR_DATA, item);
packet.setTo(avatar.owner);
return packet;
}
@@ -91,14 +89,14 @@ public final class AvatarPacketGenerator {
public static IqPacket generatePublishAvatarMetadataPacket(Avatar avatar) {
final Element item = new Element("item");
item.setAttribute("id", avatar.sha1sum);
- final Element metadata = item.addChild("metadata", NAMESPACE_AVATAR_METADATA);
+ final Element metadata = item.addChild("metadata", AvatarPacket.NAMESPACE_AVATAR_METADATA);
final Element info = metadata.addChild("info");
info.setAttribute("bytes", avatar.size);
info.setAttribute("id", avatar.sha1sum);
info.setAttribute("height", avatar.height);
info.setAttribute("width", avatar.height);
info.setAttribute("type", avatar.type);
- return PubSubPacketGenerator.generatePubSubPublishPacket(NAMESPACE_AVATAR_METADATA, item);
+ return PubSubPacketGenerator.generatePubSubPublishPacket(AvatarPacket.NAMESPACE_AVATAR_METADATA, item);
}
/**
@@ -108,7 +106,7 @@ public final class AvatarPacketGenerator {
* @return the IqPacket
*/
public static IqPacket generateRetrieveAvatarMetadataPacket(Jid to) {
- final IqPacket packet = PubSubPacketGenerator.generatePubSubRetrievePacket(NAMESPACE_AVATAR_METADATA, null);
+ final IqPacket packet = PubSubPacketGenerator.generatePubSubRetrievePacket(AvatarPacket.NAMESPACE_AVATAR_METADATA, null);
if (to != null) {
packet.setTo(to);
}
diff --git a/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketParser.java b/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketParser.java
index 175f54bd..e9f90898 100644
--- a/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketParser.java
+++ b/src/main/java/de/thedevstack/conversationsplus/xmpp/avatar/AvatarPacketParser.java
@@ -8,7 +8,7 @@ import de.thedevstack.conversationsplus.xmpp.stanzas.IqPacket;
/**
* Parses the IQ Packets for handling Avatars
* as defined in XEP-0084.
- * @see {@link http://xmpp.org/extensions/xep-0084.html}
+ * @see <a href="http://xmpp.org/extensions/xep-0084.html">http://xmpp.org/extensions/xep-0084.html</a>
*/
public class AvatarPacketParser {
/**
@@ -22,7 +22,7 @@ public class AvatarPacketParser {
if (null != items) {
Element item = items.findChild("item");
if (null != item) {
- base64Avatar = item.findChildContent("data", AvatarPacketGenerator.NAMESPACE_AVATAR_DATA);
+ base64Avatar = item.findChildContent("data", AvatarPacket.NAMESPACE_AVATAR_DATA);
}
}
return base64Avatar;