KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jivesoftware > smackx > muc > Affiliate


1 /**
2  * $RCSfile$
3  * $Revision: 2429 $
4  * $Date: 2004-12-15 16:02:39 -0300 (Wed, 15 Dec 2004) $
5  *
6  * Copyright 2003-2004 Jive Software.
7  *
8  * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  */

20
21 package org.jivesoftware.smackx.muc;
22
23 import org.jivesoftware.smackx.packet.MUCAdmin;
24 import org.jivesoftware.smackx.packet.MUCOwner;
25
26 /**
27  * Represents an affiliation of a user to a given room. The affiliate's information will always have
28  * the bare jid of the real user and its affiliation. If the affiliate is an occupant of the room
29  * then we will also have information about the role and nickname of the user in the room.
30  *
31  * @author Gaston Dombiak
32  */

33 public class Affiliate {
34     // Fields that must have a value
35
private String JavaDoc jid;
36     private String JavaDoc affiliation;
37
38     // Fields that may have a value
39
private String JavaDoc role;
40     private String JavaDoc nick;
41
42     Affiliate(MUCOwner.Item item) {
43         super();
44         this.jid = item.getJid();
45         this.affiliation = item.getAffiliation();
46         this.role = item.getRole();
47         this.nick = item.getNick();
48     }
49
50     Affiliate(MUCAdmin.Item item) {
51         super();
52         this.jid = item.getJid();
53         this.affiliation = item.getAffiliation();
54         this.role = item.getRole();
55         this.nick = item.getNick();
56     }
57
58     /**
59      * Returns the bare JID of the affiliated user. This information will always be available.
60      *
61      * @return the bare JID of the affiliated user.
62      */

63     public String JavaDoc getJid() {
64         return jid;
65     }
66
67     /**
68      * Returns the affiliation of the afffiliated user. Possible affiliations are: "owner", "admin",
69      * "member", "outcast". This information will always be available.
70      *
71      * @return the affiliation of the afffiliated user.
72      */

73     public String JavaDoc getAffiliation() {
74         return affiliation;
75     }
76
77     /**
78      * Returns the current role of the affiliated user if the user is currently in the room.
79      * If the user is not present in the room then the answer will be null.
80      *
81      * @return the current role of the affiliated user in the room or null if the user is not in
82      * the room.
83      */

84     public String JavaDoc getRole() {
85         return role;
86     }
87
88     /**
89      * Returns the current nickname of the affiliated user if the user is currently in the room.
90      * If the user is not present in the room then the answer will be null.
91      *
92      * @return the current nickname of the affiliated user in the room or null if the user is not in
93      * the room.
94      */

95     public String JavaDoc getNick() {
96         return nick;
97     }
98 }
99
Popular Tags