diff options
author | Gurmeen Bindra <gurmeen.bindra@isode.com> | 2012-04-17 08:59:20 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2012-04-19 10:45:48 (GMT) |
commit | c040dd31cf285f9e2ffddab859586badf6ae059e (patch) | |
tree | 0f24f533afce95dd85da16a01733d7f7f42087bb /src/com/isode/stroke/elements/MUCOccupant.java | |
parent | cb7cb7fdb0564bd7c27680b371588a45277c000a (diff) | |
download | stroke-c040dd31cf285f9e2ffddab859586badf6ae059e.zip stroke-c040dd31cf285f9e2ffddab859586badf6ae059e.tar.bz2 |
Port elements for MUC Administration
This patch ports basic elements from swiftern to stroke.
This includes various types od MUC Payloads.
Test-information:
the junits for the parsers (still WIP) code works fine.
Diffstat (limited to 'src/com/isode/stroke/elements/MUCOccupant.java')
-rw-r--r-- | src/com/isode/stroke/elements/MUCOccupant.java | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/src/com/isode/stroke/elements/MUCOccupant.java b/src/com/isode/stroke/elements/MUCOccupant.java new file mode 100644 index 0000000..d9b6048 --- /dev/null +++ b/src/com/isode/stroke/elements/MUCOccupant.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2012, Isode Limited, London, England. + * All rights reserved. + */ +/* + * Copyright (c) 2010, Kevin Smith + * All rights reserved. + */ +package com.isode.stroke.elements; + +import com.isode.stroke.jid.JID; + +/** + * Class representing a MUC Occupant + * + */ +public class MUCOccupant { + + /** + * MUC Role + * + */ + public enum Role { + Moderator("moderator"), + Participant("participant"), + Visitor("visitor"), + NoRole("none"); + + Role(String name) { + this.nodeName = name; + } + + public String nodeName; + }; + + /** + * MUC Affiliation of the user + * + */ + public enum Affiliation { + Owner("owner"), + Admin("admin"), + Member("member"), + Outcast("outcast"), + NoAffiliation("none"); + + public String nodeName; + + Affiliation(String name) { + this.nodeName = name; + } + }; + + /** + * Create the MUC Occupant object + * @param nick nick name, not null + * @param role MUC Role, not null + * @param affiliation MUC Affiliation, not null + */ + public MUCOccupant(String nick, Role role, Affiliation affiliation) { + this.nick_ = nick; + this.role_ = role; + this.affiliation_ = affiliation; + } + + /** + * Create a copy of the given MUC Occupant + * @param other object to copy from + */ + public MUCOccupant(MUCOccupant other) { + this.nick_ = other.nick_; + this.role_ = other.role_; + this.affiliation_ = other.affiliation_; + this.realJID_ = new JID(other.realJID_ != null ? other.realJID_.toString() : ""); + } + + /** + * Get the nick name + * @return nick name, not null + */ + public String getNick() { + return nick_; + } + + /** + * Get the role + * @return role, not null + */ + public Role getRole(){ + return role_; + } + + /** + * Get the affiliation of the user + * @return affiliation , not null + */ + public Affiliation getAffiliation() { + return affiliation_; + } + + /** + * Get the real Jabber ID of the user + * @return real Jabber ID, not null if set + */ + public JID getRealJID(){ + return realJID_; + } + + /** + * Set the real Jabber ID + * @param jid Jabber ID, not null + */ + public void setRealJID(JID jid) { + this.realJID_ = jid; + } + + /** + * Set the nick name of the user + * @param nick nick name, not null + */ + public void setNick(String nick) { + this.nick_ = nick; + } + + private String nick_; + private Role role_; + private Affiliation affiliation_; + private JID realJID_; + /* If you add a field, remember to update the const copy constructor */ +} |