00001
00002
00003
00004
00005
00006
00007 #pragma once
00008
00009 #include <vector>
00010 #include <string>
00011
00012 #include <Swiften/Base/API.h>
00013 #include <Swiften/Elements/Payload.h>
00014 #include <Swiften/Elements/Form.h>
00015
00016 namespace Swift {
00020 class SWIFTEN_API DiscoInfo : public Payload {
00021 public:
00022 typedef boost::shared_ptr<DiscoInfo> ref;
00023
00024 static const std::string ChatStatesFeature;
00025 static const std::string SecurityLabelsFeature;
00026 static const std::string SecurityLabelsCatalogFeature;
00027 static const std::string JabberSearchFeature;
00028 static const std::string CommandsFeature;
00029 static const std::string MessageCorrectionFeature;
00030 static const std::string JingleFeature;
00031 static const std::string JingleFTFeature;
00032 static const std::string JingleTransportsIBBFeature;
00033 static const std::string JingleTransportsS5BFeature;
00034 static const std::string Bytestream;
00035 static const std::string MessageDeliveryReceiptsFeature;
00036 static const std::string WhiteboardFeature;
00037
00038 class Identity {
00039 public:
00040 Identity(const std::string& name, const std::string& category = "client", const std::string& type = "pc", const std::string& lang = "") : name_(name), category_(category), type_(type), lang_(lang) {
00041 }
00042
00043 const std::string& getCategory() const {
00044 return category_;
00045 }
00046
00047 const std::string& getType() const {
00048 return type_;
00049 }
00050
00051 const std::string& getLanguage() const {
00052 return lang_;
00053 }
00054
00055 const std::string& getName() const {
00056 return name_;
00057 }
00058
00059
00060 bool operator<(const Identity& other) const;
00061
00062 private:
00063 std::string name_;
00064 std::string category_;
00065 std::string type_;
00066 std::string lang_;
00067 };
00068
00069 DiscoInfo() {
00070 }
00071
00072 const std::string& getNode() const {
00073 return node_;
00074 }
00075
00076 void setNode(const std::string& node) {
00077 node_ = node;
00078 }
00079
00080 const std::vector<Identity>& getIdentities() const {
00081 return identities_;
00082 }
00083
00084 void addIdentity(const Identity& identity) {
00085 identities_.push_back(identity);
00086 }
00087
00088 const std::vector<std::string>& getFeatures() const {
00089 return features_;
00090 }
00091
00092 void addFeature(const std::string& feature) {
00093 features_.push_back(feature);
00094 }
00095
00096 bool hasFeature(const std::string& feature) const;
00097
00098 void addExtension(Form::ref form) {
00099 extensions_.push_back(form);
00100 }
00101
00102 const std::vector<Form::ref>& getExtensions() const {
00103 return extensions_;
00104 }
00105
00106 private:
00107 std::string node_;
00108 std::vector<Identity> identities_;
00109 std::vector<std::string> features_;
00110 std::vector<Form::ref> extensions_;
00111 };
00112 }