1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-23 06:42:05 +01:00

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
This commit is contained in:
Florian Schmaus 2013-02-07 19:08:05 +00:00 committed by flow
parent 6bbf425157
commit a686b4c092

View file

@ -1157,7 +1157,7 @@ public class MultiUserChat {
* XMPP user ID of the user who initiated the ban. * 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 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 * @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" * 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). * 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. * @throws XMPPException if an error occurs granting ownership privileges to a user.
*/ */
public void grantOwnership(Collection<String> jids) throws XMPPException { public void grantOwnership(Collection<String> 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. * @throws XMPPException if an error occurs granting ownership privileges to a user.
*/ */
public void grantOwnership(String jid) throws XMPPException { 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. * @throws XMPPException if an error occurs revoking ownership privileges from a user.
*/ */
public void revokeOwnership(Collection<String> jids) throws XMPPException { public void revokeOwnership(Collection<String> 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. * @throws XMPPException if an error occurs revoking ownership privileges from a user.
*/ */
public void revokeOwnership(String jid) throws XMPPException { 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) private void changeAffiliationByAdmin(String jid, String affiliation, String reason)
throws XMPPException { throws XMPPException {
MUCAdmin iq = new MUCAdmin(); MUCAdmin iq = new MUCAdmin();
@ -1632,7 +1640,7 @@ public class MultiUserChat {
* don't have enough privileges to get this information. * don't have enough privileges to get this information.
*/ */
public Collection<Affiliate> getOwners() throws XMPPException { public Collection<Affiliate> getOwners() throws XMPPException {
return getAffiliatesByOwner("owner"); return getAffiliatesByAdmin("owner");
} }
/** /**