• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2009 Jonas Ådahl.
3  * Copyright 2011-2013 Florian Schmaus
4  *
5  * All rights reserved. Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 package org.jivesoftware.smackx.entitycaps.packet;
19 
20 import org.jivesoftware.smack.packet.PacketExtension;
21 import org.jivesoftware.smackx.entitycaps.EntityCapsManager;
22 
23 public class CapsExtension implements PacketExtension {
24 
25     private String node, ver, hash;
26 
CapsExtension()27     public CapsExtension() {
28     }
29 
CapsExtension(String node, String version, String hash)30     public CapsExtension(String node, String version, String hash) {
31         this.node = node;
32         this.ver = version;
33         this.hash = hash;
34     }
35 
getElementName()36     public String getElementName() {
37         return EntityCapsManager.ELEMENT;
38     }
39 
getNamespace()40     public String getNamespace() {
41         return EntityCapsManager.NAMESPACE;
42     }
43 
getNode()44     public String getNode() {
45         return node;
46     }
47 
setNode(String node)48     public void setNode(String node) {
49         this.node = node;
50     }
51 
getVer()52     public String getVer() {
53         return ver;
54     }
55 
setVer(String ver)56     public void setVer(String ver) {
57         this.ver = ver;
58     }
59 
getHash()60     public String getHash() {
61         return hash;
62     }
63 
setHash(String hash)64     public void setHash(String hash) {
65         this.hash = hash;
66     }
67 
68     /*
69      *  <c xmlns='http://jabber.org/protocol/caps'
70      *  hash='sha-1'
71      *  node='http://code.google.com/p/exodus'
72      *  ver='QgayPKawpkPSDYmwT/WM94uAlu0='/>
73      *
74      */
toXML()75     public String toXML() {
76         String xml = "<" + EntityCapsManager.ELEMENT + " xmlns=\"" + EntityCapsManager.NAMESPACE + "\" " +
77             "hash=\"" + hash + "\" " +
78             "node=\"" + node + "\" " +
79             "ver=\"" + ver + "\"/>";
80 
81         return xml;
82     }
83 }
84