00001
00002
00003
00004
00005
00006
00007 #pragma once
00008
00009 #include <vector>
00010 #include <string>
00011 #include <boost/shared_ptr.hpp>
00012
00013 #include <Swiften/Base/API.h>
00014 #include <Swiften/Elements/Element.h>
00015
00016 namespace Swift {
00017 class SWIFTEN_API StreamFeatures : public Element {
00018 public:
00019 typedef boost::shared_ptr<StreamFeatures> ref;
00020
00021 StreamFeatures() : hasStartTLS_(false), hasResourceBind_(false), hasSession_(false), hasStreamManagement_(false), hasRosterVersioning_(false) {}
00022
00023 void setHasStartTLS() {
00024 hasStartTLS_ = true;
00025 }
00026
00027 bool hasStartTLS() const {
00028 return hasStartTLS_;
00029 }
00030
00031 void setHasSession() {
00032 hasSession_ = true;
00033 }
00034
00035 bool hasSession() const {
00036 return hasSession_;
00037 }
00038
00039 void setHasResourceBind() {
00040 hasResourceBind_ = true;
00041 }
00042
00043 bool hasResourceBind() const {
00044 return hasResourceBind_;
00045 }
00046
00047 const std::vector<std::string>& getCompressionMethods() const {
00048 return compressionMethods_;
00049 }
00050
00051 void addCompressionMethod(const std::string& mechanism) {
00052 compressionMethods_.push_back(mechanism);
00053 }
00054
00055 bool hasCompressionMethod(const std::string& mechanism) const;
00056
00057 const std::vector<std::string>& getAuthenticationMechanisms() const {
00058 return authenticationMechanisms_;
00059 }
00060
00061 void addAuthenticationMechanism(const std::string& mechanism) {
00062 authenticationMechanisms_.push_back(mechanism);
00063 }
00064
00065 bool hasAuthenticationMechanism(const std::string& mechanism) const;
00066
00067 bool hasAuthenticationMechanisms() const {
00068 return !authenticationMechanisms_.empty();
00069 }
00070
00071 bool hasStreamManagement() const {
00072 return hasStreamManagement_;
00073 }
00074
00075 void setHasStreamManagement() {
00076 hasStreamManagement_ = true;
00077 }
00078
00079 bool hasRosterVersioning() const {
00080 return hasRosterVersioning_;
00081 }
00082
00083 void setHasRosterVersioning() {
00084 hasRosterVersioning_ = true;
00085 }
00086
00087 private:
00088 bool hasStartTLS_;
00089 std::vector<std::string> compressionMethods_;
00090 std::vector<std::string> authenticationMechanisms_;
00091 bool hasResourceBind_;
00092 bool hasSession_;
00093 bool hasStreamManagement_;
00094 bool hasRosterVersioning_;
00095 };
00096 }