From a686b4c09291f1aef3d2c6b9db26c3c22049ef25 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Thu, 7 Feb 2013 19:08:05 +0000 Subject: [PATCH] Update MultiUserChat to use the correct namespace according to the latest version of XEP-0045. Newer versions for XEP-0045 (MUC) use muc#admin for all onwer related operations. Fixes SMACK-371. Credits and thanks go to Colby White for reporting this. git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13458 b35dd754-fafc-0310-a699-88a17e54d16e --- .../smackx/muc/MultiUserChat.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/source/org/jivesoftware/smackx/muc/MultiUserChat.java b/source/org/jivesoftware/smackx/muc/MultiUserChat.java index 17c6f713e..2caa970a1 100644 --- a/source/org/jivesoftware/smackx/muc/MultiUserChat.java +++ b/source/org/jivesoftware/smackx/muc/MultiUserChat.java @@ -1157,7 +1157,7 @@ public class MultiUserChat { * XMPP user ID of the user who initiated the ban. * * @param jid the bare XMPP user ID of the user to ban (e.g. "user@host.org"). - * @param reason the reason why the user was banned. + * @param reason the optional reason why the user was banned. * @throws XMPPException if an error occurs banning a user. In particular, a * 405 error can occur if a moderator or a user with an affiliation of "owner" or "admin" * was tried to be banned (i.e. Not Allowed error). @@ -1276,7 +1276,7 @@ public class MultiUserChat { * @throws XMPPException if an error occurs granting ownership privileges to a user. */ public void grantOwnership(Collection jids) throws XMPPException { - changeAffiliationByOwner(jids, "owner"); + changeAffiliationByAdmin(jids, "owner"); } /** @@ -1289,7 +1289,7 @@ public class MultiUserChat { * @throws XMPPException if an error occurs granting ownership privileges to a user. */ public void grantOwnership(String jid) throws XMPPException { - changeAffiliationByOwner(jid, "owner"); + changeAffiliationByAdmin(jid, "owner", null); } /** @@ -1301,7 +1301,7 @@ public class MultiUserChat { * @throws XMPPException if an error occurs revoking ownership privileges from a user. */ public void revokeOwnership(Collection jids) throws XMPPException { - changeAffiliationByOwner(jids, "admin"); + changeAffiliationByAdmin(jids, "admin"); } /** @@ -1313,7 +1313,7 @@ public class MultiUserChat { * @throws XMPPException if an error occurs revoking ownership privileges from a user. */ public void revokeOwnership(String jid) throws XMPPException { - changeAffiliationByOwner(jid, "admin"); + changeAffiliationByAdmin(jid, "admin", null); } /** @@ -1423,6 +1423,14 @@ public class MultiUserChat { } } + /** + * Tries to change the affiliation with an 'muc#admin' namespace + * + * @param jid + * @param affiliation + * @param reason the reason for the affiliation change (optional) + * @throws XMPPException + */ private void changeAffiliationByAdmin(String jid, String affiliation, String reason) throws XMPPException { MUCAdmin iq = new MUCAdmin(); @@ -1632,7 +1640,7 @@ public class MultiUserChat { * don't have enough privileges to get this information. */ public Collection getOwners() throws XMPPException { - return getAffiliatesByOwner("owner"); + return getAffiliatesByAdmin("owner"); } /**