aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/services
diff options
context:
space:
mode:
authorDaniel Gultsch <inputmice@siacs.eu>2015-01-07 18:34:24 +0100
committerDaniel Gultsch <inputmice@siacs.eu>2015-01-07 18:34:24 +0100
commit8d655f445a37acff288e39ec237395d303b7c3a2 (patch)
tree5f6db0c7479b5db6724f4fbd86e40326b03ac7aa /src/main/java/eu/siacs/conversations/services
parentd70b5f93f3b779bf135b2bfe615093a810841dca (diff)
more muc options
* show invite button only with admin privileges or on public conferences * Offer to ban user in public conferences. Thanks to @betheg for the awesome ground work for this
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services')
-rw-r--r--src/main/java/eu/siacs/conversations/services/XmppConnectionService.java30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
index 4ab2d42b2..5c16ef3f7 100644
--- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java
@@ -1316,6 +1316,7 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
packet.addChild("x", "jabber:x:signed").setContent(sig);
}
sendPresencePacket(account, packet);
+ fetchConferenceConfiguration(conversation);
if (!joinJid.equals(conversation.getJid())) {
conversation.setContactJid(joinJid);
databaseBackend.updateConversation(conversation);
@@ -1475,6 +1476,29 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
}
}
+ public void fetchConferenceConfiguration(final Conversation conversation) {
+ IqPacket request = new IqPacket(IqPacket.TYPE.GET);
+ request.setTo(conversation.getJid().toBareJid());
+ request.query("http://jabber.org/protocol/disco#info");
+ sendIqPacket(conversation.getAccount(), request, new OnIqPacketReceived() {
+ @Override
+ public void onIqPacketReceived(Account account, IqPacket packet) {
+ if (packet.getType() != IqPacket.TYPE.ERROR) {
+ ArrayList<String> features = new ArrayList<String>();
+ for (Element child : packet.query().getChildren()) {
+ if (child != null && child.getName().equals("feature")) {
+ String var = child.getAttribute("var");
+ if (var != null) {
+ features.add(var);
+ }
+ }
+ }
+ conversation.getMucOptions().updateFeatures(features);
+ }
+ }
+ });
+ }
+
public void pushConferenceConfiguration(final Conversation conversation,final Bundle options, final OnConferenceOptionsPushed callback) {
IqPacket request = new IqPacket(IqPacket.TYPE.GET);
request.setTo(conversation.getJid().toBareJid());
@@ -1520,14 +1544,14 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa
final Jid jid = user.toBareJid();
IqPacket request = this.mIqGenerator.changeAffiliation(conference, jid, affiliation.toString());
Log.d(Config.LOGTAG,request.toString());
- sendIqPacket(conference.getAccount(),request,new OnIqPacketReceived() {
+ sendIqPacket(conference.getAccount(), request, new OnIqPacketReceived() {
@Override
public void onIqPacketReceived(Account account, IqPacket packet) {
- Log.d(Config.LOGTAG,packet.toString());
+ Log.d(Config.LOGTAG, packet.toString());
if (packet.getType() == IqPacket.TYPE.RESULT) {
callback.onAffiliationChangedSuccessful(jid);
} else {
- callback.onAffiliationChangeFailed(jid,R.string.could_not_change_affiliation);
+ callback.onAffiliationChangeFailed(jid, R.string.could_not_change_affiliation);
}
}
});