1 | /* |
---|
2 | * Jeti, a Java Jabber client, Copyright (C) 2001 E.S. de Boer |
---|
3 | * |
---|
4 | * This program is free software; you can redistribute it and/or modify |
---|
5 | * it under the terms of the GNU General Public License as published by |
---|
6 | * the Free Software Foundation; either version 2 of the License, or |
---|
7 | * (at your option) any later version. |
---|
8 | * |
---|
9 | * This program is distributed in the hope that it will be useful, |
---|
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | * GNU General Public License for more details. |
---|
13 | * |
---|
14 | * You should have received a copy of the GNU General Public License |
---|
15 | * along with this program; if not, write to the Free Software |
---|
16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
17 | * |
---|
18 | * For questions, comments etc, |
---|
19 | * use the website at http://jeti.jabberstudio.org |
---|
20 | * or mail/IM me at jeti@jabber.org |
---|
21 | * |
---|
22 | * Created on 9-jan-2005 |
---|
23 | */ |
---|
24 | |
---|
25 | package nu.fw.jeti.jabber; |
---|
26 | |
---|
27 | import java.util.List; |
---|
28 | |
---|
29 | import nu.fw.jeti.backend.roster.Roster; |
---|
30 | import nu.fw.jeti.backend.roster.SecondaryJIDStatus; |
---|
31 | import nu.fw.jeti.jabber.elements.Presence; |
---|
32 | |
---|
33 | /** |
---|
34 | * @author E.S. de Boer |
---|
35 | */ |
---|
36 | |
---|
37 | //stores jid + status |
---|
38 | |
---|
39 | //inconsistent with equals to make consistant add jid + equals if comletejids are same |
---|
40 | public class UnknownJIDStatus extends SecondaryJIDStatus |
---|
41 | { |
---|
42 | private JID jid; |
---|
43 | private String nickname; |
---|
44 | private String type; |
---|
45 | |
---|
46 | |
---|
47 | public UnknownJIDStatus(JID jid) |
---|
48 | { |
---|
49 | this(jid,null); |
---|
50 | } |
---|
51 | |
---|
52 | /** |
---|
53 | * Make jidStatus from jid and nickname |
---|
54 | * @param jid |
---|
55 | * @param nickname |
---|
56 | */ |
---|
57 | public UnknownJIDStatus(JID jid,String nickname) |
---|
58 | {//call update?? |
---|
59 | this.jid = jid; |
---|
60 | completeJID = jid; |
---|
61 | this.nickname = nickname; |
---|
62 | if(nickname == null || nickname.equals("")) |
---|
63 | { |
---|
64 | this.nickname = jid.getUser(); |
---|
65 | } |
---|
66 | show = Presence.NONE; |
---|
67 | JIDStatus server = Roster.getJIDStatus(new JID(jid.getDomain())); |
---|
68 | if(server == null) type =null; |
---|
69 | else type = server.getType(); |
---|
70 | } |
---|
71 | |
---|
72 | public String toString() |
---|
73 | {//jid |
---|
74 | return nickname; |
---|
75 | } |
---|
76 | |
---|
77 | public JID getJID(){return jid;} |
---|
78 | |
---|
79 | |
---|
80 | public void setStatus(String status) |
---|
81 | { |
---|
82 | this.status = status; |
---|
83 | } |
---|
84 | |
---|
85 | public String getNick() |
---|
86 | { |
---|
87 | return nickname; |
---|
88 | } |
---|
89 | |
---|
90 | public void setNick(String nick) |
---|
91 | { |
---|
92 | nickname = nick; |
---|
93 | } |
---|
94 | |
---|
95 | public String getType() |
---|
96 | { |
---|
97 | if(type == null) return "jabber"; |
---|
98 | return type; |
---|
99 | } |
---|
100 | |
---|
101 | public void setType(String type) |
---|
102 | { |
---|
103 | //System.out.println(type); |
---|
104 | this.type = type; |
---|
105 | } |
---|
106 | |
---|
107 | public String getSubscription(){return null;} |
---|
108 | |
---|
109 | public String getWaiting() |
---|
110 | { |
---|
111 | return null; |
---|
112 | } |
---|
113 | |
---|
114 | public int groupCount() |
---|
115 | { |
---|
116 | return 0; |
---|
117 | } |
---|
118 | |
---|
119 | public List getGroupsCopy() |
---|
120 | { |
---|
121 | return null; |
---|
122 | } |
---|
123 | |
---|
124 | public boolean isGroupPresent(String group) |
---|
125 | { |
---|
126 | return false; |
---|
127 | } |
---|
128 | |
---|
129 | public int compareTo(Object o) |
---|
130 | { |
---|
131 | return nickname.compareTo(((JIDStatus)o).getNick()); |
---|
132 | } |
---|
133 | |
---|
134 | } |
---|
135 | /* |
---|
136 | * Overrides for emacs |
---|
137 | * Local variables: |
---|
138 | * tab-width: 4 |
---|
139 | * End: |
---|
140 | */ |
---|