aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/eu/siacs/conversations/generator/MessageGenerator.java10
-rw-r--r--src/eu/siacs/conversations/parser/MessageParser.java15
-rw-r--r--src/eu/siacs/conversations/services/XmppConnectionService.java16
-rw-r--r--src/eu/siacs/conversations/ui/XmppActivity.java2
4 files changed, 27 insertions, 16 deletions
diff --git a/src/eu/siacs/conversations/generator/MessageGenerator.java b/src/eu/siacs/conversations/generator/MessageGenerator.java
index 5a216a7e..3195c953 100644
--- a/src/eu/siacs/conversations/generator/MessageGenerator.java
+++ b/src/eu/siacs/conversations/generator/MessageGenerator.java
@@ -128,4 +128,14 @@ public class MessageGenerator {
packet.setFrom(conversation.getAccount().getJid());
return packet;
}
+
+ public MessagePacket invite(Conversation conversation, String contact) {
+ MessagePacket packet = new MessagePacket();
+ packet.setType(MessagePacket.TYPE_NORMAL);
+ packet.setTo(contact);
+ packet.setFrom(conversation.getAccount().getFullJid());
+ Element x = packet.addChild("x", "jabber:x:conference");
+ x.setAttribute("jid", conversation.getContactJid().split("/")[0]);
+ return packet;
+ }
}
diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java
index 1b03f4ee..08930a3b 100644
--- a/src/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/eu/siacs/conversations/parser/MessageParser.java
@@ -221,8 +221,8 @@ public class MessageParser extends AbstractParser implements
updateLastseen(packet, account, false);
mXmppConnectionService.markMessage(account, fromParts[0], id,
Message.STATUS_SEND_RECEIVED);
- } else if (packet.hasChild("x")) {
- Element x = packet.findChild("x");
+ } else if (packet.hasChild("x","http://jabber.org/protocol/muc#user")) {
+ Element x = packet.findChild("x","http://jabber.org/protocol/muc#user");
if (x.hasChild("invite")) {
Conversation conversation = mXmppConnectionService
.findOrCreateConversation(account,
@@ -233,6 +233,17 @@ public class MessageParser extends AbstractParser implements
}
}
+ } else if (packet.hasChild("x", "jabber:x:conference")) {
+ Element x = packet.findChild("x", "jabber:x:conference");
+ String jid = x.getAttribute("jid");
+ if (jid!=null) {
+ Conversation conversation = mXmppConnectionService
+ .findOrCreateConversation(account,jid, true);
+ if (!conversation.getMucOptions().online()) {
+ mXmppConnectionService.joinMuc(conversation);
+ mXmppConnectionService.updateConversationUi();
+ }
+ }
}
}
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java
index 0ac1adf7..ad522fd9 100644
--- a/src/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/eu/siacs/conversations/services/XmppConnectionService.java
@@ -1223,19 +1223,9 @@ public class XmppConnectionService extends Service {
}).start();
}
- public void inviteToConference(Conversation conversation, String contactJid) {
- Account account = conversation.getAccount();
- MessagePacket packet = new MessagePacket();
- packet.setTo(conversation.getContactJid().split("/")[0]);
- packet.setFrom(account.getFullJid());
- Element x = new Element("x");
- x.setAttribute("xmlns", "http://jabber.org/protocol/muc#user");
- Element invite = new Element("invite");
- invite.setAttribute("to", contactJid);
- x.addChild(invite);
- packet.addChild(x);
- sendMessagePacket(account,packet);
- Log.d(LOGTAG,packet.toString());
+ public void invite(Conversation conversation, String contact) {
+ MessagePacket packet = mMessageGenerator.invite(conversation, contact);
+ sendMessagePacket(conversation.getAccount(),packet);
}
public boolean markMessage(Account account, String recipient, String uuid,
diff --git a/src/eu/siacs/conversations/ui/XmppActivity.java b/src/eu/siacs/conversations/ui/XmppActivity.java
index 2bf7cf5a..fc51abef 100644
--- a/src/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/eu/siacs/conversations/ui/XmppActivity.java
@@ -349,7 +349,7 @@ public abstract class XmppActivity extends Activity {
String conversationUuid = data.getStringExtra("conversation");
Conversation conversation = xmppConnectionService.findConversationByUuid(conversationUuid);
if (conversation.getMode() == Conversation.MODE_MULTI) {
- xmppConnectionService.inviteToConference(conversation, contactJid);
+ xmppConnectionService.invite(conversation, contactJid);
}
Log.d("xmppService","inviting "+contactJid+" to "+conversation.getName(true));
}