1
0
Fork 0
mirror of https://github.com/vanitasvitae/Smack.git synced 2024-11-26 22:12: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:
Gaston Dombiak 2004-12-15 18:04:13 +00:00 committed by gaston
parent 5982f5e2bd
commit 8b03003fd7
2 changed files with 30 additions and 2 deletions

View file

@ -111,7 +111,8 @@ public class MUCOwner extends IQ {
private String affiliation; private String affiliation;
private String jid; private String jid;
private String nick; private String nick;
private String role;
/** /**
* Creates a new item child. * Creates a new item child.
* *
@ -172,6 +173,18 @@ public class MUCOwner extends IQ {
return nick; 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. * 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; 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() { public String toXML() {
StringBuffer buf = new StringBuffer(); StringBuffer buf = new StringBuffer();
buf.append("<item"); buf.append("<item");
@ -223,6 +248,9 @@ public class MUCOwner extends IQ {
if (getNick() != null) { if (getNick() != null) {
buf.append(" nick=\"").append(getNick()).append("\""); buf.append(" nick=\"").append(getNick()).append("\"");
} }
if (getRole() != null) {
buf.append(" role=\"").append(getRole()).append("\"");
}
if (getReason() == null && getActor() == null) { if (getReason() == null && getActor() == null) {
buf.append("/>"); buf.append("/>");
} }

View file

@ -36,7 +36,6 @@ public class MUCOwnerProvider implements IQProvider {
public IQ parseIQ(XmlPullParser parser) throws Exception { public IQ parseIQ(XmlPullParser parser) throws Exception {
MUCOwner mucOwner = new MUCOwner(); MUCOwner mucOwner = new MUCOwner();
boolean done = false; boolean done = false;
MUCOwner.Item item = null;
while (!done) { while (!done) {
int eventType = parser.next(); int eventType = parser.next();
if (eventType == XmlPullParser.START_TAG) { if (eventType == XmlPullParser.START_TAG) {
@ -66,6 +65,7 @@ public class MUCOwnerProvider implements IQProvider {
boolean done = false; boolean done = false;
MUCOwner.Item item = new MUCOwner.Item(parser.getAttributeValue("", "affiliation")); MUCOwner.Item item = new MUCOwner.Item(parser.getAttributeValue("", "affiliation"));
item.setNick(parser.getAttributeValue("", "nick")); item.setNick(parser.getAttributeValue("", "nick"));
item.setRole(parser.getAttributeValue("", "role"));
item.setJid(parser.getAttributeValue("", "jid")); item.setJid(parser.getAttributeValue("", "jid"));
while (!done) { while (!done) {
int eventType = parser.next(); int eventType = parser.next();