aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/generator/PresenceGenerator.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/generator/PresenceGenerator.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/generator/PresenceGenerator.java62
1 files changed, 0 insertions, 62 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/generator/PresenceGenerator.java b/src/main/java/de/thedevstack/conversationsplus/generator/PresenceGenerator.java
deleted file mode 100644
index f370c6e0..00000000
--- a/src/main/java/de/thedevstack/conversationsplus/generator/PresenceGenerator.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package de.thedevstack.conversationsplus.generator;
-
-import de.thedevstack.conversationsplus.entities.Account;
-import de.thedevstack.conversationsplus.entities.Contact;
-import de.thedevstack.conversationsplus.entities.Presence;
-import de.thedevstack.conversationsplus.xml.Element;
-import de.thedevstack.conversationsplus.xmpp.stanzas.PresencePacket;
-
-public class PresenceGenerator extends AbstractGenerator {
-
- private PresencePacket subscription(String type, Contact contact) {
- PresencePacket packet = new PresencePacket();
- packet.setAttribute("type", type);
- packet.setTo(contact.getJid());
- packet.setFrom(contact.getAccount().getJid().toBareJid());
- return packet;
- }
-
- public PresencePacket requestPresenceUpdatesFrom(Contact contact) {
- return subscription("subscribe", contact);
- }
-
- public PresencePacket stopPresenceUpdatesFrom(Contact contact) {
- return subscription("unsubscribe", contact);
- }
-
- public PresencePacket stopPresenceUpdatesTo(Contact contact) {
- return subscription("unsubscribed", contact);
- }
-
- public PresencePacket sendPresenceUpdatesTo(Contact contact) {
- return subscription("subscribed", contact);
- }
-
- public PresencePacket selfPresence(Account account, Presence.Status status) {
- PresencePacket packet = new PresencePacket();
- if(status.toShowString() != null) {
- packet.addChild("show").setContent(status.toShowString());
- }
- packet.setFrom(account.getJid());
- String sig = account.getPgpSignature();
- if (sig != null) {
- packet.addChild("x", "jabber:x:signed").setContent(sig);
- }
- String capHash = getCapHash();
- if (capHash != null) {
- Element cap = packet.addChild("c",
- "http://jabber.org/protocol/caps");
- cap.setAttribute("hash", "sha-1");
- cap.setAttribute("node", "http://conversations.im");
- cap.setAttribute("ver", capHash);
- }
- return packet;
- }
-
- public PresencePacket sendOfflinePresence(Account account) {
- PresencePacket packet = new PresencePacket();
- packet.setFrom(account.getJid());
- packet.setAttribute("type","unavailable");
- return packet;
- }
-}