diff options
author | Daniel Gultsch <inputmice@siacs.eu> | 2015-01-07 15:03:29 +0100 |
---|---|---|
committer | Daniel Gultsch <inputmice@siacs.eu> | 2015-01-07 15:03:29 +0100 |
commit | ef525fb10e672b23219fdf180d310de9f6ce59d3 (patch) | |
tree | 52a3b28456e574cb308c96d3040060be8924207a /src/main/java/eu/siacs/conversations/services | |
parent | 81e9afdf192aa925f1dc18a1b5e1d666ab153342 (diff) |
basic affiliation changes in muc
Diffstat (limited to 'src/main/java/eu/siacs/conversations/services')
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/XmppConnectionService.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 5d314ecf6..4ab2d42b2 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1516,6 +1516,28 @@ public class XmppConnectionService extends Service implements OnPhoneContactsLoa }); } + public void changeAffiliationInConference(final Conversation conference, Jid user, MucOptions.Affiliation affiliation, final OnAffiliationChanged callback) { + 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() { + @Override + public void onIqPacketReceived(Account account, IqPacket packet) { + 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); + } + } + }); + } + + public interface OnAffiliationChanged { + public void onAffiliationChangedSuccessful(Jid jid); + public void onAffiliationChangeFailed(Jid jid, int resId); + } + public void disconnect(Account account, boolean force) { if ((account.getStatus() == Account.State.ONLINE) || (account.getStatus() == Account.State.DISABLED)) { |