From 6b9219c5f4b81172edafae31b705fec3ef56b3f6 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Wed, 3 Sep 2014 19:35:45 +0200 Subject: added support for password protected muc - fixed #203 and fixed #395 --- .../siacs/conversations/services/XmppConnectionService.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/eu/siacs/conversations/services') diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index 98f278bd2..a294e970b 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -1059,6 +1059,10 @@ public class XmppConnectionService extends Service { packet.setAttribute("to", conversation.getMucOptions().getJoinJid()); Element x = new Element("x"); x.setAttribute("xmlns", "http://jabber.org/protocol/muc"); + if (conversation.getMucOptions().getPassword() != null) { + Element password = x.addChild("password"); + password.setContent(conversation.getMucOptions().getPassword()); + } String sig = account.getPgpSignature(); if (sig != null) { packet.addChild("status").setContent("online"); @@ -1090,6 +1094,13 @@ public class XmppConnectionService extends Service { public void setOnRenameListener(OnRenameListener listener) { this.renameListener = listener; } + + public void providePasswordForMuc(Conversation conversation, String password) { + if (conversation.getMode() == Conversation.MODE_MULTI) { + conversation.getMucOptions().setPassword(password); + joinMuc(conversation); + } + } public void renameInMuc(final Conversation conversation, final String nick) { final MucOptions options = conversation.getMucOptions(); -- cgit v1.2.3