author | Nikita Kozlov <nikita@mbdsys.com> |
Sun, 05 Dec 2010 18:45:47 +0100 | |
changeset 811 | 6cbb9b3117b7 |
parent 795 | b2572c048dd7 |
child 917 | a4bbcfbd0a91 |
permissions | -rwxr-xr-x |
794 | 1 |
/* |
2 |
BEEM is a videoconference application on the Android Platform. |
|
3 |
||
4 |
Copyright (C) 2009 by Frederic-Charles Barthelery, |
|
5 |
Jean-Manuel Da Silva, |
|
6 |
Nikita Kozlov, |
|
7 |
Philippe Lago, |
|
8 |
Jean Baptiste Vergely, |
|
9 |
Vincent Veronis. |
|
10 |
||
11 |
This file is part of BEEM. |
|
12 |
||
13 |
BEEM is free software: you can redistribute it and/or modify |
|
14 |
it under the terms of the GNU General Public License as published by |
|
15 |
the Free Software Foundation, either version 3 of the License, or |
|
16 |
(at your option) any later version. |
|
17 |
||
18 |
BEEM is distributed in the hope that it will be useful, |
|
19 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
20 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
21 |
GNU General Public License for more details. |
|
22 |
||
23 |
You should have received a copy of the GNU General Public License |
|
24 |
along with BEEM. If not, see <http://www.gnu.org/licenses/>. |
|
25 |
||
26 |
Please send bug reports with examples or suggestions to |
|
27 |
contact@beem-project.com or http://dev.beem-project.com/ |
|
28 |
||
29 |
Epitech, hereby disclaims all copyright interest in the program "Beem" |
|
30 |
written by Frederic-Charles Barthelery, |
|
31 |
Jean-Manuel Da Silva, |
|
32 |
Nikita Kozlov, |
|
33 |
Philippe Lago, |
|
34 |
Jean Baptiste Vergely, |
|
35 |
Vincent Veronis. |
|
36 |
||
37 |
Nicolas Sadirac, November 26, 2009 |
|
38 |
President of Epitech. |
|
39 |
||
40 |
Flavien Astraud, November 26, 2009 |
|
41 |
Head of the EIP Laboratory. |
|
42 |
||
43 |
*/ |
|
44 |
||
793
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
45 |
package com.beem.project.beem.smack.caps; |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
46 |
|
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
47 |
import org.jivesoftware.smack.packet.PacketExtension; |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
48 |
|
794 | 49 |
/** |
50 |
* This extension represents a capability of XEP-0115. |
|
51 |
* |
|
52 |
*/ |
|
793
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
53 |
public class CapsExtension implements PacketExtension { |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
54 |
|
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
55 |
private String mVer; |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
56 |
private String mHash; |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
57 |
private String mNode; |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
58 |
private String mExt; |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
59 |
|
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
60 |
|
794 | 61 |
/** |
62 |
* Create a CapsExtension. |
|
63 |
* |
|
64 |
* @param hash The value of the hash attribute. |
|
65 |
* @param node the value of the node attribute |
|
66 |
* @param ver the value of the ver attribute. |
|
67 |
*/ |
|
68 |
public CapsExtension(final String hash, final String node, final String ver) { |
|
793
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
69 |
mHash = hash; |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
70 |
mNode = node; |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
71 |
mVer = ver; |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
72 |
} |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
73 |
|
794 | 74 |
/** |
75 |
* Get the ver attribute value. |
|
76 |
* |
|
77 |
* @return the value of the ver attribute. |
|
78 |
*/ |
|
79 |
public String getVer() { |
|
793
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
80 |
return mVer; |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
81 |
} |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
82 |
|
794 | 83 |
/** |
84 |
* Get the hash attribute value. |
|
85 |
* |
|
86 |
* @return the value of the hash attribute. |
|
87 |
*/ |
|
88 |
public String getHash() { |
|
793
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
89 |
return mHash; |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
90 |
} |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
91 |
|
794 | 92 |
/** |
93 |
* Get the node attribute value. |
|
94 |
* |
|
95 |
* @return the value of the node attribute. |
|
96 |
*/ |
|
97 |
public String getNode() { |
|
793
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
98 |
return mNode; |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
99 |
} |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
100 |
|
794 | 101 |
/** |
102 |
* Get the ext attribute value. |
|
103 |
* |
|
104 |
* @return the value of the ext attribute. |
|
105 |
*/ |
|
106 |
public String getExt() { |
|
793
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
107 |
return mExt; |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
108 |
} |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
109 |
|
794 | 110 |
/** |
111 |
* Set the hash attribute. |
|
112 |
* |
|
113 |
* @param hash the value of hash |
|
114 |
*/ |
|
793
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
115 |
public void setHash(String hash) { |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
116 |
mHash = hash; |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
117 |
} |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
118 |
|
794 | 119 |
/** |
120 |
* Set the ver attribute. |
|
121 |
* |
|
122 |
* @param ver the value of ver |
|
123 |
*/ |
|
793
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
124 |
public void setVer(String ver) { |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
125 |
mVer = ver; |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
126 |
} |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
127 |
|
794 | 128 |
/** |
129 |
* Set the node attribute. |
|
130 |
* |
|
131 |
* @param node the value of node |
|
132 |
*/ |
|
793
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
133 |
public void setNode(String node) { |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
134 |
mNode = node; |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
135 |
} |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
136 |
|
794 | 137 |
/** |
138 |
* Set the ext attribute. |
|
139 |
* |
|
140 |
* @param ext the value of ext |
|
141 |
*/ |
|
793
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
142 |
public void setExt(String ext) { |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
143 |
mExt = ext; |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
144 |
} |
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
145 |
|
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
146 |
@Override |
794 | 147 |
public String getElementName() { |
793
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
148 |
return "c"; |
794 | 149 |
} |
150 |
||
151 |
@Override |
|
152 |
public String getNamespace() { |
|
153 |
return "http://jabber.org/protocol/caps"; |
|
154 |
} |
|
793
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
155 |
|
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
156 |
@Override |
794 | 157 |
public String toXML() { |
158 |
StringBuilder b = new StringBuilder("<"); |
|
159 |
b.append(getElementName()); |
|
160 |
b.append(" xmlns=\"").append(getNamespace()).append("\" "); |
|
161 |
if (mHash != null) { |
|
162 |
b.append("hash=\"").append(mHash).append("\" "); |
|
163 |
} |
|
164 |
if (mNode != null) |
|
165 |
b.append("node=\"").append(mNode).append("\" "); |
|
166 |
if (mVer != null) |
|
167 |
b.append("ver=\"").append(mVer).append("\" "); |
|
168 |
if (mExt != null) |
|
169 |
b.append("ext=\"").append(mExt).append("\" "); |
|
170 |
b.append("/>"); |
|
171 |
return b.toString(); |
|
172 |
} |
|
173 |
||
793
4fb9df09ffdf
#286 : Initial implementation of XEP-0115 : Entity Capabilities
Da Risk <darisk972@gmail.com>
parents:
diff
changeset
|
174 |
} |