summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Disco/CapsInfoGenerator.cpp')
-rw-r--r--Swiften/Disco/CapsInfoGenerator.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/Swiften/Disco/CapsInfoGenerator.cpp b/Swiften/Disco/CapsInfoGenerator.cpp
index 1b07c43..b4637c7 100644
--- a/Swiften/Disco/CapsInfoGenerator.cpp
+++ b/Swiften/Disco/CapsInfoGenerator.cpp
@@ -15,9 +15,9 @@
#include <Swiften/StringCodecs/Base64.h>
namespace {
- bool compareFields(Swift::FormField::ref f1, Swift::FormField::ref f2) {
- return f1->getName() < f2->getName();
- }
+ bool compareFields(Swift::FormField::ref f1, Swift::FormField::ref f2) {
+ return f1->getName() < f2->getName();
+ }
}
namespace Swift {
@@ -26,39 +26,39 @@ CapsInfoGenerator::CapsInfoGenerator(const std::string& node, CryptoProvider* cr
}
CapsInfo CapsInfoGenerator::generateCapsInfo(const DiscoInfo& discoInfo) const {
- std::string serializedCaps;
+ std::string serializedCaps;
- std::vector<DiscoInfo::Identity> identities(discoInfo.getIdentities());
- std::sort(identities.begin(), identities.end());
- foreach (const DiscoInfo::Identity& identity, identities) {
- serializedCaps += identity.getCategory() + "/" + identity.getType() + "/" + identity.getLanguage() + "/" + identity.getName() + "<";
- }
+ std::vector<DiscoInfo::Identity> identities(discoInfo.getIdentities());
+ std::sort(identities.begin(), identities.end());
+ foreach (const DiscoInfo::Identity& identity, identities) {
+ serializedCaps += identity.getCategory() + "/" + identity.getType() + "/" + identity.getLanguage() + "/" + identity.getName() + "<";
+ }
- std::vector<std::string> features(discoInfo.getFeatures());
- std::sort(features.begin(), features.end());
- foreach (const std::string& feature, features) {
- serializedCaps += feature + "<";
- }
+ std::vector<std::string> features(discoInfo.getFeatures());
+ std::sort(features.begin(), features.end());
+ foreach (const std::string& feature, features) {
+ serializedCaps += feature + "<";
+ }
- foreach(Form::ref extension, discoInfo.getExtensions()) {
- serializedCaps += extension->getFormType() + "<";
- std::vector<FormField::ref> fields(extension->getFields());
- std::sort(fields.begin(), fields.end(), &compareFields);
- foreach(FormField::ref field, fields) {
- if (field->getName() == "FORM_TYPE") {
- continue;
- }
- serializedCaps += field->getName() + "<";
- std::vector<std::string> values(field->getValues());
- std::sort(values.begin(), values.end());
- foreach(const std::string& value, values) {
- serializedCaps += value + "<";
- }
- }
- }
+ foreach(Form::ref extension, discoInfo.getExtensions()) {
+ serializedCaps += extension->getFormType() + "<";
+ std::vector<FormField::ref> fields(extension->getFields());
+ std::sort(fields.begin(), fields.end(), &compareFields);
+ foreach(FormField::ref field, fields) {
+ if (field->getName() == "FORM_TYPE") {
+ continue;
+ }
+ serializedCaps += field->getName() + "<";
+ std::vector<std::string> values(field->getValues());
+ std::sort(values.begin(), values.end());
+ foreach(const std::string& value, values) {
+ serializedCaps += value + "<";
+ }
+ }
+ }
- std::string version(Base64::encode(crypto_->getSHA1Hash(createByteArray(serializedCaps))));
- return CapsInfo(node_, version, "sha-1");
+ std::string version(Base64::encode(crypto_->getSHA1Hash(createByteArray(serializedCaps))));
+ return CapsInfo(node_, version, "sha-1");
}
}