Added a way to specify name of transport in gateway mode
This commit is contained in:
parent
f8f37ecbdd
commit
3fe27413f5
4 changed files with 15 additions and 5 deletions
|
@ -46,6 +46,9 @@ bool Config::load(const std::string &configfile, boost::program_options::options
|
|||
("service.cert_password", value<std::string>()->default_value(""), "PKCS#12 Certificate password.")
|
||||
("service.admin_username", value<std::string>()->default_value(""), "Administrator username.")
|
||||
("service.admin_password", value<std::string>()->default_value(""), "Administrator password.")
|
||||
("identity.name", value<std::string>()->default_value("Spectrum 2 Transport"), "Name showed in service discovery.")
|
||||
("identity.category", value<std::string>()->default_value("gateway"), "Disco#info identity category. 'gateway' by default.")
|
||||
("identity.type", value<std::string>()->default_value(""), "Type of transport ('icq','msn','gg','irc', ...)")
|
||||
("registration.enable_public_registration", value<bool>()->default_value(true), "True if users should be able to register.")
|
||||
("registration.language", value<std::string>()->default_value("en"), "Default language for registration form")
|
||||
("registration.instructions", value<std::string>()->default_value(""), "Instructions showed to user in registration form")
|
||||
|
|
|
@ -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<DiscoInfo>(router) {
|
||||
m_transportInfo.addIdentity(DiscoInfo::Identity("libtransport", "gateway", "identity"));
|
||||
DiscoInfoResponder::DiscoInfoResponder(Swift::IQRouter *router, Config *config) : Swift::GetResponder<DiscoInfo>(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<std::string> features;
|
||||
features.push_back("jabber:iq:register");
|
||||
features.push_back("jabber:iq:gateway");
|
||||
|
|
|
@ -28,9 +28,11 @@
|
|||
|
||||
namespace Transport {
|
||||
|
||||
class Config;
|
||||
|
||||
class DiscoInfoResponder : public Swift::GetResponder<Swift::DiscoInfo> {
|
||||
public:
|
||||
DiscoInfoResponder(Swift::IQRouter *router);
|
||||
DiscoInfoResponder(Swift::IQRouter *router, Config *config);
|
||||
~DiscoInfoResponder();
|
||||
|
||||
void setTransportFeatures(std::list<std::string> &features);
|
||||
|
@ -43,6 +45,7 @@ class DiscoInfoResponder : public Swift::GetResponder<Swift::DiscoInfo> {
|
|||
|
||||
Swift::DiscoInfo m_transportInfo;
|
||||
Swift::DiscoInfo m_buddyInfo;
|
||||
Config *m_config;
|
||||
};
|
||||
|
||||
}
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue