mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-07 22:02:12 +08:00
accounts: emit signal when an avatar is received in JAMS response
- adds signal <AccountAvatarReceived> for <account_id> with base64 <photo> - handles incoming avatar during account authorization response in on success callback by emitting <AccountAvatarReceived> Change-Id: I8b6b9685691e1335b895a12c35ea14b53ec6260c
This commit is contained in:
@ -249,6 +249,16 @@
|
||||
</arg>
|
||||
</signal>
|
||||
|
||||
<signal name="accountAvatarReceived" tp:name-for-bindings="accountAvatarReceived">
|
||||
<tp:docstring>
|
||||
Notify clients when a newly created account's avatar image is available for storage.
|
||||
</tp:docstring>
|
||||
<arg type="s" name="accountID">
|
||||
</arg>
|
||||
<arg type="s" name="photo">
|
||||
</arg>
|
||||
</signal>
|
||||
|
||||
<signal name="knownDevicesChanged" tp:name-for-bindings="knownDevicesChanged">
|
||||
<tp:docstring>
|
||||
Notify clients when a new device linked to this account is found.
|
||||
|
@ -186,6 +186,7 @@ DBusClient::initLibrary(int flags)
|
||||
exportable_callback<ConfigurationSignal::NameRegistrationEnded>(bind(&DBusConfigurationManager::nameRegistrationEnded, confM, _1, _2, _3 )),
|
||||
exportable_callback<ConfigurationSignal::RegisteredNameFound>(bind(&DBusConfigurationManager::registeredNameFound, confM, _1, _2, _3, _4 )),
|
||||
exportable_callback<ConfigurationSignal::DeviceRevocationEnded>(bind(&DBusConfigurationManager::deviceRevocationEnded, confM, _1, _2, _3)),
|
||||
exportable_callback<ConfigurationSignal::AccountAvatarReceived>(bind(&DBusConfigurationManager::accountAvatarReceived, confM, _1, _2)),
|
||||
exportable_callback<ConfigurationSignal::CertificatePinned>(bind(&DBusConfigurationManager::certificatePinned, confM, _1 )),
|
||||
exportable_callback<ConfigurationSignal::CertificatePathPinned>(bind(&DBusConfigurationManager::certificatePathPinned, confM, _1, _2 )),
|
||||
exportable_callback<ConfigurationSignal::CertificateExpired>(bind(&DBusConfigurationManager::certificateExpired, confM, _1 )),
|
||||
|
@ -58,6 +58,7 @@ public:
|
||||
|
||||
virtual void migrationEnded(const std::string& /*accountId*/, const std::string& /*state*/){}
|
||||
virtual void deviceRevocationEnded(const std::string& /*accountId*/, const std::string& /*device*/, int /*status*/){}
|
||||
virtual void accountAvatarReceived(const std::string& /*accountId*/, const std::string& /*photo*/){}
|
||||
|
||||
virtual void hardwareDecodingChanged(bool /*state*/){}
|
||||
virtual void hardwareEncodingChanged(bool /*state*/){}
|
||||
@ -267,6 +268,7 @@ public:
|
||||
|
||||
virtual void migrationEnded(const std::string& /*accountId*/, const std::string& /*state*/){}
|
||||
virtual void deviceRevocationEnded(const std::string& /*accountId*/, const std::string& /*device*/, int /*status*/){}
|
||||
virtual void accountAvatarReceived(const std::string& /*accountId*/, const std::string& /*photo*/){}
|
||||
|
||||
virtual void hardwareDecodingChanged(bool /*state*/){}
|
||||
virtual void hardwareEncodingChanged(bool /*state*/){}
|
||||
|
@ -277,7 +277,8 @@ void init(ConfigurationCallback* confM, Callback* callM, PresenceCallback* presM
|
||||
exportable_callback<ConfigurationSignal::RegisteredNameFound>(bind(&ConfigurationCallback::registeredNameFound, confM, _1, _2, _3, _4 )),
|
||||
exportable_callback<ConfigurationSignal::NameRegistrationEnded>(bind(&ConfigurationCallback::nameRegistrationEnded, confM, _1, _2, _3 )),
|
||||
exportable_callback<ConfigurationSignal::MigrationEnded>(bind(&ConfigurationCallback::migrationEnded, confM, _1, _2)),
|
||||
exportable_callback<ConfigurationSignal::DeviceRevocationEnded>(bind(&ConfigurationCallback::deviceRevocationEnded, confM, _1, _2, _3))
|
||||
exportable_callback<ConfigurationSignal::DeviceRevocationEnded>(bind(&ConfigurationCallback::deviceRevocationEnded, confM, _1, _2, _3)),
|
||||
exportable_callback<ConfigurationSignal::AccountAvatarReceived>(bind(&ConfigurationCallback::accountAvatarReceived, confM, _1, _2))
|
||||
};
|
||||
|
||||
// Presence event handlers
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
|
||||
virtual void migrationEnded(const std::string& /*accountId*/, const std::string& /*state*/){}
|
||||
virtual void deviceRevocationEnded(const std::string& /*accountId*/, const std::string& /*device*/, int /*status*/){}
|
||||
virtual void accountAvatarReceived(const std::string& /*accountId*/, const std::string& /*photo*/){}
|
||||
|
||||
virtual void hardwareDecodingChanged(bool /*state*/){}
|
||||
virtual void hardwareEncodingChanged(bool /*state*/){}
|
||||
@ -249,6 +250,7 @@ public:
|
||||
|
||||
virtual void migrationEnded(const std::string& /*accountId*/, const std::string& /*state*/){}
|
||||
virtual void deviceRevocationEnded(const std::string& /*accountId*/, const std::string& /*device*/, int /*status*/){}
|
||||
virtual void accountAvatarReceived(const std::string& /*accountId*/, const std::string& /*photo*/){}
|
||||
|
||||
virtual void hardwareDecodingChanged(bool /*state*/){}
|
||||
virtual void hardwareEncodingChanged(bool /*state*/){}
|
||||
|
@ -2,7 +2,7 @@ dnl Jami - configure.ac for automake 1.9 and autoconf 2.59
|
||||
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_PREREQ([2.65])
|
||||
AC_INIT([Jami Daemon],[9.0.0],[ring@gnu.org],[jami])
|
||||
AC_INIT([Jami Daemon],[9.1.0],[ring@gnu.org],[jami])
|
||||
|
||||
AC_COPYRIGHT([[Copyright (c) Savoir-faire Linux 2004-2019]])
|
||||
AC_REVISION([$Revision$])
|
||||
|
@ -73,6 +73,7 @@ getSignalHandlers()
|
||||
exported_callback<DRing::ConfigurationSignal::MediaParametersChanged>(),
|
||||
exported_callback<DRing::ConfigurationSignal::MigrationEnded>(),
|
||||
exported_callback<DRing::ConfigurationSignal::DeviceRevocationEnded>(),
|
||||
exported_callback<DRing::ConfigurationSignal::AccountAvatarReceived>(),
|
||||
exported_callback<DRing::ConfigurationSignal::Error>(),
|
||||
#if defined(__ANDROID__) || (defined(TARGET_OS_IOS) && TARGET_OS_IOS)
|
||||
exported_callback<DRing::ConfigurationSignal::GetHardwareAudioFormat>(),
|
||||
@ -153,5 +154,4 @@ unregisterSignalHandlers()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -350,6 +350,10 @@ struct DRING_PUBLIC ConfigurationSignal {
|
||||
constexpr static const char* name = "DeviceRevocationEnded";
|
||||
using cb_type = void(const std::string& /*accountId*/, const std::string& /*device*/, int /*status*/);
|
||||
};
|
||||
struct DRING_PUBLIC AccountAvatarReceived {
|
||||
constexpr static const char* name = "AccountAvatarReceived";
|
||||
using cb_type = void(const std::string& /*accountId*/, const std::string& /*userPhoto*/);
|
||||
};
|
||||
/**
|
||||
* These are special getters for Android and UWP, so the daemon can retrieve
|
||||
* information only accessible through their respective platform APIs
|
||||
|
@ -49,6 +49,7 @@ struct AccountInfo {
|
||||
std::shared_ptr<dht::Value> announce;
|
||||
std::string ethAccount;
|
||||
std::string username;
|
||||
std::string photo;
|
||||
};
|
||||
|
||||
template <typename To, typename From>
|
||||
@ -177,7 +178,6 @@ public:
|
||||
*/
|
||||
static bool foundPeerDevice(const std::shared_ptr<dht::crypto::Certificate>& crt, dht::InfoHash& account_id);
|
||||
|
||||
|
||||
// Contact requests
|
||||
|
||||
std::vector<std::map<std::string, std::string>> getTrustRequests() const;
|
||||
|
@ -1118,6 +1118,8 @@ JamiAccount::loadAccount(const std::string& archive_password, const std::string&
|
||||
|
||||
fileutils::check_dir(idPath_.c_str(), 0700);
|
||||
|
||||
emitSignal<DRing::ConfigurationSignal::AccountAvatarReceived>(getAccountID(), info.photo);
|
||||
|
||||
// save the chain including CA
|
||||
auto id = info.identity;
|
||||
id.first = std::move(fDeviceKey.get());
|
||||
@ -3248,5 +3250,4 @@ JamiAccount::cacheSIPConnection(std::shared_ptr<ChannelSocket>&& socket, const s
|
||||
messageEngine_.onPeerOnline(peerId);
|
||||
}
|
||||
|
||||
|
||||
} // namespace jami
|
||||
|
@ -177,6 +177,9 @@ ServerAccountManager::initAuthentication(
|
||||
if (json.isMember("displayName")) {
|
||||
config.emplace(DRing::Account::ConfProperties::DISPLAYNAME, json["displayName"].asString());
|
||||
}
|
||||
if (json.isMember("userPhoto")) {
|
||||
this_.info_->photo = json["userPhoto"].asString();
|
||||
}
|
||||
|
||||
ctx->onSuccess(*this_.info_, std::move(config), std::move(receipt), std::move(receiptSignature));
|
||||
this_.syncDevices();
|
||||
|
Reference in New Issue
Block a user