Skip to content
Snippets Groups Projects
Commit ba49e66d authored by Adrien Béraud's avatar Adrien Béraud Committed by Guillaume Roguez
Browse files

ringdht: report username with ring: prefix

Prefixing ring IDs allows to recognize them easily
and to link them to Ring from external tools.

Tuleap: #14
Change-Id: I4ef64fbd2973dec5a8c1151da3ab3370d5330370
parent 7dfb47df
No related branches found
No related tags found
No related merge requests found
...@@ -76,6 +76,8 @@ static constexpr int ICE_COMP_SIP_TRANSPORT {0}; ...@@ -76,6 +76,8 @@ static constexpr int ICE_COMP_SIP_TRANSPORT {0};
static constexpr int ICE_INIT_TIMEOUT {5}; static constexpr int ICE_INIT_TIMEOUT {5};
static constexpr int ICE_NEGOTIATION_TIMEOUT {60}; static constexpr int ICE_NEGOTIATION_TIMEOUT {60};
static constexpr const char * const RING_URI_PREFIX = "ring:";
constexpr const char * const RingAccount::ACCOUNT_TYPE; constexpr const char * const RingAccount::ACCOUNT_TYPE;
/* constexpr */ const std::pair<uint16_t, uint16_t> RingAccount::DHT_PORT_RANGE {4000, 8888}; /* constexpr */ const std::pair<uint16_t, uint16_t> RingAccount::DHT_PORT_RANGE {4000, 8888};
...@@ -150,7 +152,7 @@ template <> ...@@ -150,7 +152,7 @@ template <>
std::shared_ptr<SIPCall> std::shared_ptr<SIPCall>
RingAccount::newOutgoingCall(const std::string& toUrl) RingAccount::newOutgoingCall(const std::string& toUrl)
{ {
auto dhtf = toUrl.find("ring:"); auto dhtf = toUrl.find(RING_URI_PREFIX);
if (dhtf != std::string::npos) { if (dhtf != std::string::npos) {
dhtf = dhtf+5; dhtf = dhtf+5;
} else { } else {
...@@ -468,11 +470,11 @@ RingAccount::loadIdentity() ...@@ -468,11 +470,11 @@ RingAccount::loadIdentity()
tlsPrivateKeyFile_ = idPath_ + DIR_SEPARATOR_STR "dht.key"; tlsPrivateKeyFile_ = idPath_ + DIR_SEPARATOR_STR "dht.key";
tlsPassword_ = {}; tlsPassword_ = {};
username_ = id.second->getId().toString(); username_ = RING_URI_PREFIX+id.second->getId().toString();
return id; return id;
} }
username_ = dht_cert.getId().toString(); username_ = RING_URI_PREFIX+dht_cert.getId().toString();
return { return {
std::make_shared<dht::crypto::PrivateKey>(std::move(dht_key)), std::make_shared<dht::crypto::PrivateKey>(std::move(dht_key)),
std::make_shared<dht::crypto::Certificate>(std::move(dht_cert)) std::make_shared<dht::crypto::Certificate>(std::move(dht_cert))
...@@ -753,8 +755,6 @@ RingAccount::doRegister_() ...@@ -753,8 +755,6 @@ RingAccount::doRegister_()
dht_.importValues(loadValues()); dht_.importValues(loadValues());
username_ = dht_.getId().toString();
Manager::instance().registerEventHandler((uintptr_t)this, [this]{ handleEvents(); }); Manager::instance().registerEventHandler((uintptr_t)this, [this]{ handleEvents(); });
setRegistrationState(RegistrationState::TRYING); setRegistrationState(RegistrationState::TRYING);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment