aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-07-12 11:13:18 +0200
committeriNPUTmice <daniel@gultsch.de>2014-07-12 11:13:18 +0200
commit99fe44a73753ff0eb5a0ebe5e89a4cfd5ee42a18 (patch)
treeafe3eba41b6345f08d8c6e0bc2b8b9a0b198e55b /src
parent99935dd630b59d6cff05714c888b01e4c88c6351 (diff)
cleanup for presence parser
Diffstat (limited to 'src')
-rw-r--r--src/eu/siacs/conversations/generator/MessageGenerator.java2
-rw-r--r--src/eu/siacs/conversations/generator/PresenceGenerator.java26
-rw-r--r--src/eu/siacs/conversations/ui/MucDetailsActivity.java2
3 files changed, 11 insertions, 19 deletions
diff --git a/src/eu/siacs/conversations/generator/MessageGenerator.java b/src/eu/siacs/conversations/generator/MessageGenerator.java
index 756a8738..5a216a7e 100644
--- a/src/eu/siacs/conversations/generator/MessageGenerator.java
+++ b/src/eu/siacs/conversations/generator/MessageGenerator.java
@@ -118,7 +118,7 @@ public class MessageGenerator {
return packet;
}
- public MessagePacket conversationSubject(Conversation conversation,String subject) {
+ public MessagePacket conferenceSubject(Conversation conversation,String subject) {
MessagePacket packet = new MessagePacket();
packet.setType(MessagePacket.TYPE_GROUPCHAT);
packet.setTo(conversation.getContactJid().split("/")[0]);
diff --git a/src/eu/siacs/conversations/generator/PresenceGenerator.java b/src/eu/siacs/conversations/generator/PresenceGenerator.java
index 1ca8cd05..a301392e 100644
--- a/src/eu/siacs/conversations/generator/PresenceGenerator.java
+++ b/src/eu/siacs/conversations/generator/PresenceGenerator.java
@@ -6,36 +6,28 @@ import eu.siacs.conversations.xmpp.stanzas.PresencePacket;
public class PresenceGenerator {
- public PresencePacket requestPresenceUpdatesFrom(Contact contact) {
+ private PresencePacket subscription(String type, Contact contact) {
PresencePacket packet = new PresencePacket();
- packet.setAttribute("type", "subscribe");
+ packet.setAttribute("type", type);
packet.setAttribute("to", contact.getJid());
packet.setAttribute("from", contact.getAccount().getJid());
return packet;
}
+
+ public PresencePacket requestPresenceUpdatesFrom(Contact contact) {
+ return subscription("subscribe", contact);
+ }
public PresencePacket stopPresenceUpdatesFrom(Contact contact) {
- PresencePacket packet = new PresencePacket();
- packet.setAttribute("type", "unsubscribe");
- packet.setAttribute("to", contact.getJid());
- packet.setAttribute("from", contact.getAccount().getJid());
- return packet;
+ return subscription("unsubscribe", contact);
}
public PresencePacket stopPresenceUpdatesTo(Contact contact) {
- PresencePacket packet = new PresencePacket();
- packet.setAttribute("type", "unsubscribed");
- packet.setAttribute("to", contact.getJid());
- packet.setAttribute("from", contact.getAccount().getJid());
- return packet;
+ return subscription("unsubscribed", contact);
}
public PresencePacket sendPresenceUpdatesTo(Contact contact) {
- PresencePacket packet = new PresencePacket();
- packet.setAttribute("type", "subscribed");
- packet.setAttribute("to", contact.getJid());
- packet.setAttribute("from", contact.getAccount().getJid());
- return packet;
+ return subscription("subscribed", contact);
}
public PresencePacket sendPresence(Account account) {
diff --git a/src/eu/siacs/conversations/ui/MucDetailsActivity.java b/src/eu/siacs/conversations/ui/MucDetailsActivity.java
index c94f1b11..8226e381 100644
--- a/src/eu/siacs/conversations/ui/MucDetailsActivity.java
+++ b/src/eu/siacs/conversations/ui/MucDetailsActivity.java
@@ -62,7 +62,7 @@ public class MucDetailsActivity extends XmppActivity {
String subject = mSubject.getText().toString();
MucOptions options = conversation.getMucOptions();
if (!subject.equals(options.getSubject())) {
- MessagePacket packet = xmppConnectionService.getMessageGenerator().conversationSubject(conversation, subject);
+ MessagePacket packet = xmppConnectionService.getMessageGenerator().conferenceSubject(conversation, subject);
xmppConnectionService.sendMessagePacket(conversation.getAccount(), packet);
finish();
}