Commit f8c5037e authored by Adrien Béraud's avatar Adrien Béraud

rename RingAccount to JamiAccount

Change-Id: I67e03e6711a46e6d241ee249bfa480ac76abfa93
parent 22842aed
......@@ -807,7 +807,7 @@
<ClCompile Include="..\src\ringdht\eth\libdevcrypto\Common.cpp" />
<ClCompile Include="..\src\ringdht\namedirectory.cpp" />
<ClCompile Include="..\src\ringdht\p2p.cpp" />
<ClCompile Include="..\src\ringdht\ringaccount.cpp" />
<ClCompile Include="..\src\ringdht\jamiaccount.cpp" />
<ClCompile Include="..\src\ringdht\sips_transport_ice.cpp" />
<ClCompile Include="..\src\ring_api.cpp" />
<ClCompile Include="..\src\scheduled_executor.cpp" />
......@@ -968,7 +968,7 @@
<ClInclude Include="..\src\ringdht\eth\libdevcrypto\Common.h" />
<ClInclude Include="..\src\ringdht\namedirectory.h" />
<ClInclude Include="..\src\ringdht\p2p.h" />
<ClInclude Include="..\src\ringdht\ringaccount.h" />
<ClInclude Include="..\src\ringdht\jamiaccount.h" />
<ClInclude Include="..\src\ringdht\ringcontact.h" />
<ClInclude Include="..\src\ringdht\sips_transport_ice.h" />
<ClInclude Include="..\src\ring_types.h" />
......
......@@ -169,7 +169,7 @@
<ClCompile Include="..\src\media\video\video_sender.cpp">
<Filter>Source Files\media\video</Filter>
</ClCompile>
<ClCompile Include="..\src\ringdht\ringaccount.cpp">
<ClCompile Include="..\src\ringdht\jamiaccount.cpp">
<Filter>Source Files\ringdht</Filter>
</ClCompile>
<ClCompile Include="..\src\ringdht\sips_transport_ice.cpp">
......@@ -606,7 +606,7 @@
<ClInclude Include="..\src\ringdht\p2p.h">
<Filter>Source Files\ringdht</Filter>
</ClInclude>
<ClInclude Include="..\src\ringdht\ringaccount.h">
<ClInclude Include="..\src\ringdht\jamiaccount.h">
<Filter>Source Files\ringdht</Filter>
</ClInclude>
<ClInclude Include="..\src\ringdht\ringcontact.h">
......
......@@ -25,7 +25,7 @@
#include "account_factory.h"
#include "sip/sipaccount.h"
#include "ringdht/ringaccount.h"
#include "ringdht/jamiaccount.h"
#include <stdexcept>
......@@ -37,10 +37,8 @@ AccountFactory::AccountFactory()
{
auto sipfunc = [](const std::string& id){ return std::make_shared<SIPAccount>(id, true); };
generators_.insert(std::make_pair(SIPAccount::ACCOUNT_TYPE, sipfunc));
JAMI_DBG("registered %s account", SIPAccount::ACCOUNT_TYPE);
auto dhtfunc = [](const std::string& id){ return std::make_shared<RingAccount>(id, false); };
generators_.insert(std::make_pair(RingAccount::ACCOUNT_TYPE, dhtfunc));
JAMI_DBG("registered %s account", RingAccount::ACCOUNT_TYPE);
auto dhtfunc = [](const std::string& id){ return std::make_shared<JamiAccount>(id, false); };
generators_.insert(std::make_pair(JamiAccount::ACCOUNT_TYPE, dhtfunc));
}
std::shared_ptr<Account>
......
......@@ -18,8 +18,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef ACCOUNT_FACTORY_H
#define ACCOUNT_FACTORY_H
#pragma once
#include <string>
#include <map>
......@@ -157,5 +156,3 @@ std::size_t
AccountFactory::accountCount() const;
} // namespace jami
#endif // ACCOUNT_FACTORY_H
This diff is collapsed.
......@@ -38,7 +38,7 @@
#include "client/ring_signal.h"
#include "compiler_intrinsics.h"
#include "ringdht/ringaccount.h"
#include "ringdht/jamiaccount.h"
namespace DRing {
......@@ -64,7 +64,7 @@ subscribeBuddy(const std::string& accountID, const std::string& uri, bool flag)
flag ? "S" : "Uns", accountID.c_str(), uri.c_str());
pres->subscribeClient(uri, flag);
}
} else if (auto ringaccount = jami::Manager::instance().getAccount<jami::RingAccount>(accountID)) {
} else if (auto ringaccount = jami::Manager::instance().getAccount<jami::JamiAccount>(accountID)) {
ringaccount->trackBuddyPresence(uri, flag);
} else
JAMI_ERR("Could not find account %s", accountID.c_str());
......@@ -130,7 +130,7 @@ getSubscriptions(const std::string& accountID)
}
} else
JAMI_ERR("Presence not initialized");
} else if (auto ringaccount = jami::Manager::instance().getAccount<jami::RingAccount>(accountID)) {
} else if (auto ringaccount = jami::Manager::instance().getAccount<jami::JamiAccount>(accountID)) {
for (const auto& tracked_id : ringaccount->getTrackedBuddyPresence()) {
ret.push_back({
{DRing::Presence::BUDDY_KEY, tracked_id.first},
......
......@@ -21,7 +21,7 @@
#include "data_transfer.h"
#include "manager.h"
#include "ringdht/ringaccount.h"
#include "ringdht/jamiaccount.h"
#include "peer_connection.h"
#include "fileutils.h"
#include "string_utils.h"
......@@ -302,7 +302,7 @@ SubOutgoingFileTransfer::closeAndEmit(DRing::DataTransferEventCode code) const n
input_.close();
// We don't need the connection anymore. Can close it.
auto account = Manager::instance().getAccount<RingAccount>(info_.accountId);
auto account = Manager::instance().getAccount<JamiAccount>(info_.accountId);
account->closePeerConnection(peerUri_, id);
if (info_.lastEvent < DRing::DataTransferEventCode::finished)
......@@ -540,7 +540,7 @@ IncomingFileTransfer::close() noexcept
fout_.close();
// We don't need the connection anymore. Can close it.
auto account = Manager::instance().getAccount<RingAccount>(info_.accountId);
auto account = Manager::instance().getAccount<JamiAccount>(info_.accountId);
account->closePeerConnection(info_.peer, id);
JAMI_DBG() << "[FTP] file closed, rx " << info_.bytesProgress
......@@ -678,7 +678,7 @@ DRing::DataTransferError
DataTransferFacade::sendFile(const DRing::DataTransferInfo& info,
DRing::DataTransferId& tid) noexcept
{
auto account = Manager::instance().getAccount<RingAccount>(info.accountId);
auto account = Manager::instance().getAccount<JamiAccount>(info.accountId);
if (!account) {
JAMI_ERR() << "[XFER] unknown id " << tid;
return DRing::DataTransferError::invalid_argument;
......
......@@ -40,7 +40,7 @@
#include "map_utils.h"
#include "account.h"
#include "string_utils.h"
#include "ringdht/ringaccount.h"
#include "ringdht/jamiaccount.h"
#include <opendht/rng.h>
using random_device = dht::crypto::random_device;
......@@ -801,7 +801,7 @@ Manager::finish() noexcept
hangupCall(call->getCallId());
callFactory.clear();
for (const auto &account : getAllAccounts<RingAccount>()) {
for (const auto &account : getAllAccounts<JamiAccount>()) {
if (account->getRegistrationState() == RegistrationState::INITIALIZING)
removeAccount(account->getAccountID());
}
......@@ -1715,14 +1715,14 @@ void Manager::pollEvents()
void
Manager::saveConfig(const std::shared_ptr<Account>& acc)
{
if (auto ringAcc = std::dynamic_pointer_cast<RingAccount>(acc))
if (auto ringAcc = std::dynamic_pointer_cast<JamiAccount>(acc))
saveConfig(ringAcc);
else
saveConfig();
}
void
Manager::saveConfig(const std::shared_ptr<RingAccount>& account)
Manager::saveConfig(const std::shared_ptr<JamiAccount>& account)
{
try {
YAML::Emitter accountOut;
......@@ -1758,7 +1758,7 @@ Manager::saveConfig()
out << YAML::Value << YAML::BeginSeq;
for (const auto& account : accountFactory.getAllAccounts()) {
if (auto ringAccount = std::dynamic_pointer_cast<RingAccount>(account)) {
if (auto ringAccount = std::dynamic_pointer_cast<JamiAccount>(account)) {
auto accountConfig = ringAccount->getPath() + DIR_SEPARATOR_STR + "config.yml";
if (not fileutils::isFile(accountConfig)) {
saveConfig(ringAccount);
......@@ -2669,7 +2669,7 @@ Manager::setAccountDetails(const std::string& accountID,
account->doUnregister([&](bool /* transport_free */) {
account->setAccountDetails(details);
// Serialize configuration to disk once it is done
if (auto ringAccount = std::dynamic_pointer_cast<RingAccount>(account)) {
if (auto ringAccount = std::dynamic_pointer_cast<JamiAccount>(account)) {
saveConfig(ringAccount);
} else {
saveConfig();
......@@ -2847,7 +2847,7 @@ Manager::loadAccountMap(const YAML::Node& node)
size_t remaining {0};
std::unique_lock<std::mutex> l(lock);
for (const auto& dir : dirs) {
if (accountFactory.hasAccount<RingAccount>(dir)) {
if (accountFactory.hasAccount<JamiAccount>(dir)) {
continue;
}
remaining++;
......@@ -2858,7 +2858,7 @@ Manager::loadAccountMap(const YAML::Node& node)
] {
if (fileutils::isFile(configFile)) {
try {
if (auto a = accountFactory.createAccount(RingAccount::ACCOUNT_TYPE, dir)) {
if (auto a = accountFactory.createAccount(JamiAccount::ACCOUNT_TYPE, dir)) {
YAML::Node parsedConfig = YAML::LoadFile(configFile);
a->unserialize(parsedConfig);
}
......
......@@ -55,7 +55,7 @@ class Conference;
class AudioLoop;
class IceTransportFactory;
class DataTransferFacade;
class RingAccount;
class JamiAccount;
/** Manager (controller) of daemon */
class Manager {
......@@ -305,7 +305,7 @@ class Manager {
* Save config to file
*/
void saveConfig();
void saveConfig(const std::shared_ptr<RingAccount>&);
void saveConfig(const std::shared_ptr<JamiAccount>&);
void saveConfig(const std::shared_ptr<Account>& acc);
/**
......
......@@ -12,8 +12,8 @@ libringacc_la_LIBADD = $(DHT_LIBS) \
./eth/libdevcrypto/libdevcrypto.la
libringacc_la_SOURCES = \
ringaccount.cpp \
ringaccount.h \
jamiaccount.cpp \
jamiaccount.h \
sips_transport_ice.cpp \
sips_transport_ice.h \
accountarchive.cpp \
......
......@@ -52,17 +52,11 @@
#include "namedirectory.h"
#endif
/**
* @file ringaccount.h
* @brief Ring Account is build on top of SIPAccountBase and uses DHT to handle call connectivity.
*/
namespace YAML {
class Node;
class Emitter;
}
namespace dev
{
template <unsigned N> class FixedHash;
......@@ -78,7 +72,10 @@ struct AccountArchive;
class DhtPeerConnector;
class PeerConnection;
class RingAccount : public SIPAccountBase {
/**
* @brief Ring Account is build on top of SIPAccountBase and uses DHT to handle call connectivity.
*/
class JamiAccount : public SIPAccountBase {
private:
struct PeerConnectionMsg;
......@@ -95,17 +92,17 @@ class RingAccount : public SIPAccountBase {
return ACCOUNT_TYPE;
}
std::shared_ptr<RingAccount> shared() {
return std::static_pointer_cast<RingAccount>(shared_from_this());
std::shared_ptr<JamiAccount> shared() {
return std::static_pointer_cast<JamiAccount>(shared_from_this());
}
std::shared_ptr<RingAccount const> shared() const {
return std::static_pointer_cast<RingAccount const>(shared_from_this());
std::shared_ptr<JamiAccount const> shared() const {
return std::static_pointer_cast<JamiAccount const>(shared_from_this());
}
std::weak_ptr<RingAccount> weak() {
return std::static_pointer_cast<RingAccount>(shared_from_this());
std::weak_ptr<JamiAccount> weak() {
return std::static_pointer_cast<JamiAccount>(shared_from_this());
}
std::weak_ptr<RingAccount const> weak() const {
return std::static_pointer_cast<RingAccount const>(shared_from_this());
std::weak_ptr<JamiAccount const> weak() const {
return std::static_pointer_cast<JamiAccount const>(shared_from_this());
}
const std::string& getPath() const {
......@@ -116,9 +113,9 @@ class RingAccount : public SIPAccountBase {
* Constructor
* @param accountID The account identifier
*/
RingAccount(const std::string& accountID, bool presenceEnabled);
JamiAccount(const std::string& accountID, bool presenceEnabled);
~RingAccount();
~JamiAccount();
/**
* Serialize internal state of this account for configuration
......@@ -368,8 +365,8 @@ class RingAccount : public SIPAccountBase {
const std::shared_future<tls::DhParams> dhParams() const { return dhParams_; }
void forEachDevice(const dht::InfoHash& to,
std::function<void(const std::shared_ptr<RingAccount>&, const dht::InfoHash&)>&& op,
std::function<void(const std::shared_ptr<RingAccount>&, bool)>&& end = {});
std::function<void(const std::shared_ptr<JamiAccount>&, const dht::InfoHash&)>&& op,
std::function<void(const std::shared_ptr<JamiAccount>&, bool)>&& end = {});
/**
* Inform that a potential peer device have been found.
......@@ -401,7 +398,7 @@ class RingAccount : public SIPAccountBase {
std::vector<DRing::Message> getLastMessages(const uint64_t& base_timestamp) override;
private:
NON_COPYABLE(RingAccount);
NON_COPYABLE(JamiAccount);
using clock = std::chrono::system_clock;
using time_point = clock::time_point;
......@@ -684,7 +681,7 @@ class RingAccount : public SIPAccountBase {
void checkPendingCallsTask();
};
static inline std::ostream& operator<< (std::ostream& os, const RingAccount& acc)
static inline std::ostream& operator<< (std::ostream& os, const JamiAccount& acc)
{
os << "[Account " << acc.getAccountID() << "] ";
return os;
......
......@@ -21,7 +21,7 @@
#include "p2p.h"
#include "account_schema.h"
#include "ringaccount.h"
#include "jamiaccount.h"
#include "peer_connection.h"
#include "turn_transport.h"
#include "ftp_server.h"
......@@ -196,7 +196,7 @@ class DhtPeerConnector::Impl
public:
class ClientConnector;
explicit Impl(RingAccount& account)
explicit Impl(JamiAccount& account)
: account {account}
, loopFut_ {std::async(std::launch::async, [this]{ eventLoop(); })} {}
......@@ -208,7 +208,7 @@ public:
ctrl << makeMsg<CtrlMsgType::STOP>();
}
RingAccount& account;
JamiAccount& account;
Channel<std::unique_ptr<CtrlMsgBase>> ctrl;
private:
......@@ -712,13 +712,13 @@ DhtPeerConnector::Impl::eventLoop()
//==============================================================================
DhtPeerConnector::DhtPeerConnector(RingAccount& account)
DhtPeerConnector::DhtPeerConnector(JamiAccount& account)
: pimpl_ {new Impl {account}}
{}
DhtPeerConnector::~DhtPeerConnector() = default;
/// Called by a RingAccount when it's DHT is connected
/// Called by a JamiAccount when it's DHT is connected
/// Install a DHT LISTEN operation on given device to receive data connection requests and replies
/// The DHT key is Hash(PeerConnectionMsg::key_prefix + device_id), where '+' is the string concatenation.
void
......@@ -765,7 +765,7 @@ DhtPeerConnector::requestConnection(const std::string& peer_id,
pimpl_->account.forEachDevice(
peer_h,
[this, addresses, connect_cb, tid](const std::shared_ptr<RingAccount>& account,
[this, addresses, connect_cb, tid](const std::shared_ptr<JamiAccount>& account,
const dht::InfoHash& dev_h) {
if (dev_h == account->dht().getId()) {
JAMI_ERR() << account << "[CNX] no connection to yourself, bad person!";
......@@ -779,7 +779,7 @@ DhtPeerConnector::requestConnection(const std::string& peer_id,
});
},
[peer_h, connect_cb](const std::shared_ptr<RingAccount>& account, bool found) {
[peer_h, connect_cb](const std::shared_ptr<JamiAccount>& account, bool found) {
if (!found) {
JAMI_WARN() << account << "[CNX] aborted, no devices for " << peer_h;
connect_cb(nullptr);
......@@ -802,7 +802,7 @@ DhtPeerConnector::closeConnection(const std::string& peer_id, const DRing::DataT
pimpl_->ctrl << makeMsg<CtrlMsgType::CANCEL>(peer_h, tid);
pimpl_->account.forEachDevice(
peer_h,
[this, tid](const std::shared_ptr<RingAccount>& account,
[this, tid](const std::shared_ptr<JamiAccount>& account,
const dht::InfoHash& dev_h) {
if (dev_h == account->dht().getId()) {
JAMI_ERR() << account << "[CNX] no connection to yourself, bad person!";
......@@ -811,7 +811,7 @@ DhtPeerConnector::closeConnection(const std::string& peer_id, const DRing::DataT
pimpl_->ctrl << makeMsg<CtrlMsgType::CANCEL>(dev_h, tid);
},
[peer_h](const std::shared_ptr<RingAccount>& account, bool found) {
[peer_h](const std::shared_ptr<JamiAccount>& account, bool found) {
if (!found) {
JAMI_WARN() << account << "[CNX] aborted, no devices for " << peer_h;
}
......
......@@ -20,19 +20,20 @@
#pragma once
#include "dring/datatransfer_interface.h"
#include <string>
#include <memory>
#include <functional>
#include "dring/datatransfer_interface.h"
namespace jami {
class RingAccount;
class JamiAccount;
class PeerConnection;
class DhtPeerConnector {
public:
DhtPeerConnector(RingAccount& account);
DhtPeerConnector(JamiAccount& account);
~DhtPeerConnector();
void onDhtConnected(const std::string& device_id);
......
......@@ -32,7 +32,7 @@
#include "sipcall.h"
#include "sipaccount.h"
#include "ringdht/ringaccount.h"
#include "ringdht/jamiaccount.h"
#include "manager.h"
......@@ -651,7 +651,7 @@ SIPVoIPLink::guessAccount(const std::string& userName,
MatchRank best = MatchRank::NONE;
// DHT accounts
for (const auto& account : Manager::instance().getAllAccounts<RingAccount>()) {
for (const auto& account : Manager::instance().getAllAccounts<JamiAccount>()) {
if (!account)
continue;
const MatchRank match(account->matches(userName, server));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment