001 /*
002 Copyright (C) 2003 Adam Olsen
003
004 This program is free software; you can redistribute it and/or modify
005 it under the terms of the GNU General Public License as published by
006 the Free Software Foundation; either version 1, or (at your option)
007 any later version.
008
009 This program is distributed in the hope that it will be useful,
010 but WITHOUT ANY WARRANTY; without even the implied warranty of
011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012 GNU General Public License for more details.
013
014 You should have received a copy of the GNU General Public License
015 along with this program; if not, write to the Free Software
016 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
017 */
018
019 package com.valhalla.jbother.jabber;
020
021 import org.jivesoftware.smackx.muc.MultiUserChat;
022 import org.jivesoftware.smackx.packet.MUCUser;
023
024 /**
025 * Tracks a users different presences and resources in a mu-conference room
026 *
027 * @author Adam Olsen
028 * @version 1.0
029 */
030 public class MUCBuddyStatus extends BuddyStatus {
031 private String affiliation = "";
032
033 private String role = "";
034
035 private MUCUser u = null;
036
037 private String jid = null;
038
039 private boolean isInRoom = false;
040
041 private MultiUserChat muc = null;
042
043 /**
044 * Default constructor
045 *
046 * @param userId
047 * the JID of the user this object represents
048 */
049 public MUCBuddyStatus(String userId) {
050 super(userId);
051 }
052
053 public void setMUC(MultiUserChat muc) {
054 this.muc = muc;
055 }
056
057 public MultiUserChat getMUC() {
058 return muc;
059 }
060
061 public void setIsInRoom(boolean is) {
062 this.isInRoom = is;
063 }
064
065 public boolean getIsInRoom() {
066 return isInRoom;
067 }
068
069 /**
070 * Sets the affiliation of this user
071 *
072 * @param affiliation
073 * the affiliation of this user
074 */
075 public void setAffiliation(String aff) {
076 this.affiliation = aff;
077 }
078
079 /**
080 * @return the users affiliation
081 */
082 public String getAffiliation() {
083 return affiliation;
084 }
085
086 /**
087 * Sets the role of this user
088 *
089 * @param role
090 * the role of this user
091 */
092 public void setRole(String role) {
093 this.role = role;
094 }
095
096 /**
097 * @return the role of this user
098 */
099 public String getRole() {
100 return role;
101 }
102
103 public void setMUCUser(MUCUser u) {
104 this.u = u;
105 }
106
107 public MUCUser getMUCUser() {
108 return u;
109 }
110
111 public String getJid() {
112 if (u == null)
113 return null;
114 MUCUser.Item item = u.getItem();
115 if (item == null)
116 return null;
117 return item.getJid();
118 }
119 }