diff --git a/src/config.cpp b/src/config.cpp index 45728c77..efa040ec 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -46,6 +46,9 @@ bool Config::load(const std::string &configfile, boost::program_options::options ("service.cert_password", value()->default_value(""), "PKCS#12 Certificate password.") ("service.admin_username", value()->default_value(""), "Administrator username.") ("service.admin_password", value()->default_value(""), "Administrator password.") + ("identity.name", value()->default_value("Spectrum 2 Transport"), "Name showed in service discovery.") + ("identity.category", value()->default_value("gateway"), "Disco#info identity category. 'gateway' by default.") + ("identity.type", value()->default_value(""), "Type of transport ('icq','msn','gg','irc', ...)") ("registration.enable_public_registration", value()->default_value(true), "True if users should be able to register.") ("registration.language", value()->default_value("en"), "Default language for registration form") ("registration.instructions", value()->default_value(""), "Instructions showed to user in registration form") diff --git a/src/discoinforesponder.cpp b/src/discoinforesponder.cpp index 891ef958..0e694feb 100644 --- a/src/discoinforesponder.cpp +++ b/src/discoinforesponder.cpp @@ -26,16 +26,20 @@ #include "Swiften/Queries/IQRouter.h" #include "Swiften/Elements/DiscoInfo.h" #include "Swiften/Swiften.h" +#include "transport/config.h" using namespace Swift; using namespace boost; namespace Transport { -DiscoInfoResponder::DiscoInfoResponder(Swift::IQRouter *router) : Swift::GetResponder(router) { - m_transportInfo.addIdentity(DiscoInfo::Identity("libtransport", "gateway", "identity")); +DiscoInfoResponder::DiscoInfoResponder(Swift::IQRouter *router, Config *config) : Swift::GetResponder(router) { + m_config = config; + m_transportInfo.addIdentity(DiscoInfo::Identity(CONFIG_STRING(m_config, "identity.name"), + CONFIG_STRING(m_config, "identity.category"), + CONFIG_STRING(m_config, "identity.type"))); - m_buddyInfo.addIdentity(DiscoInfo::Identity("libtransport", "client", "pc")); + m_buddyInfo.addIdentity(DiscoInfo::Identity(CONFIG_STRING(m_config, "identity.name"), "client", "pc")); std::list features; features.push_back("jabber:iq:register"); features.push_back("jabber:iq:gateway"); diff --git a/src/discoinforesponder.h b/src/discoinforesponder.h index f609e666..b6cf9e84 100644 --- a/src/discoinforesponder.h +++ b/src/discoinforesponder.h @@ -28,9 +28,11 @@ namespace Transport { +class Config; + class DiscoInfoResponder : public Swift::GetResponder { public: - DiscoInfoResponder(Swift::IQRouter *router); + DiscoInfoResponder(Swift::IQRouter *router, Config *config); ~DiscoInfoResponder(); void setTransportFeatures(std::list &features); @@ -43,6 +45,7 @@ class DiscoInfoResponder : public Swift::GetResponder { Swift::DiscoInfo m_transportInfo; Swift::DiscoInfo m_buddyInfo; + Config *m_config; }; } \ No newline at end of file diff --git a/src/transport.cpp b/src/transport.cpp index c46499d7..3fc63aec 100644 --- a/src/transport.cpp +++ b/src/transport.cpp @@ -117,7 +117,7 @@ Component::Component(Swift::EventLoop *loop, Config *config, Factory *factory, T m_presenceOracle = new PresenceOracle(m_stanzaChannel); m_presenceOracle->onPresenceChange.connect(bind(&Component::handlePresence, this, _1)); - m_discoInfoResponder = new DiscoInfoResponder(m_iqRouter); + m_discoInfoResponder = new DiscoInfoResponder(m_iqRouter, m_config); m_discoInfoResponder->start(); m_discoItemsResponder = new DiscoItemsResponder(m_iqRouter);