mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-23 04:22:05 +01:00
Added "role" attribute to MUCOwner.Item. SMACK-33
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2428 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
5982f5e2bd
commit
8b03003fd7
2 changed files with 30 additions and 2 deletions
|
@ -111,6 +111,7 @@ public class MUCOwner extends IQ {
|
|||
private String affiliation;
|
||||
private String jid;
|
||||
private String nick;
|
||||
private String role;
|
||||
|
||||
/**
|
||||
* Creates a new item child.
|
||||
|
@ -172,6 +173,18 @@ public class MUCOwner extends IQ {
|
|||
return nick;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the temporary position or privilege level of an occupant within a room. The
|
||||
* possible roles are "moderator", "participant", and "visitor" (it is also possible to
|
||||
* have no defined role). A role lasts only for the duration of an occupant's visit to
|
||||
* a room.
|
||||
*
|
||||
* @return the privilege level of an occupant within a room.
|
||||
*/
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the actor (JID of an occupant in the room) that was kicked or banned.
|
||||
*
|
||||
|
@ -211,6 +224,18 @@ public class MUCOwner extends IQ {
|
|||
this.nick = nick;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the temporary position or privilege level of an occupant within a room. The
|
||||
* possible roles are "moderator", "participant", and "visitor" (it is also possible to
|
||||
* have no defined role). A role lasts only for the duration of an occupant's visit to
|
||||
* a room.
|
||||
*
|
||||
* @param role the new privilege level of an occupant within a room.
|
||||
*/
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String toXML() {
|
||||
StringBuffer buf = new StringBuffer();
|
||||
buf.append("<item");
|
||||
|
@ -223,6 +248,9 @@ public class MUCOwner extends IQ {
|
|||
if (getNick() != null) {
|
||||
buf.append(" nick=\"").append(getNick()).append("\"");
|
||||
}
|
||||
if (getRole() != null) {
|
||||
buf.append(" role=\"").append(getRole()).append("\"");
|
||||
}
|
||||
if (getReason() == null && getActor() == null) {
|
||||
buf.append("/>");
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ public class MUCOwnerProvider implements IQProvider {
|
|||
public IQ parseIQ(XmlPullParser parser) throws Exception {
|
||||
MUCOwner mucOwner = new MUCOwner();
|
||||
boolean done = false;
|
||||
MUCOwner.Item item = null;
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
if (eventType == XmlPullParser.START_TAG) {
|
||||
|
@ -66,6 +65,7 @@ public class MUCOwnerProvider implements IQProvider {
|
|||
boolean done = false;
|
||||
MUCOwner.Item item = new MUCOwner.Item(parser.getAttributeValue("", "affiliation"));
|
||||
item.setNick(parser.getAttributeValue("", "nick"));
|
||||
item.setRole(parser.getAttributeValue("", "role"));
|
||||
item.setJid(parser.getAttributeValue("", "jid"));
|
||||
while (!done) {
|
||||
int eventType = parser.next();
|
||||
|
|
Loading…
Reference in a new issue