1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-09 01:05:39 +02:00

swarm: compress avatar to send in conversation's request

As it's sent over the DHT, the max value is 64k, also, even if sent
as a SIP message (if member was already connected and we add a new
non 1:1 swarm with this contact), the sendSIPMessage will fail due
to a too large message (PJSIP_EMSGTOOLONG).

Change-Id: I7908809fe2c3f6e08f9a4b9c6f8aac654ab86c42
This commit is contained in:
Sébastien Blin 2022-07-26 14:44:09 -04:00 committed by Andreas Traczyk
parent fd3e75e334
commit d74cc97395
3 changed files with 7 additions and 3 deletions

View file

@ -206,8 +206,6 @@ getContactInteractionString(const QString& authorUri, const api::interaction::St
} }
namespace vcard { namespace vcard {
QString compressedAvatar(const QString& image);
QString QString
compressedAvatar(const QString& image) compressedAvatar(const QString& image)
{ {

View file

@ -73,6 +73,8 @@ QString getContactInteractionString(const QString& authorUri,
namespace vcard { namespace vcard {
QString compressedAvatar(const QString& image);
/** /**
* Build the vCard for a profile * Build the vCard for a profile
* @param profileInfo * @param profileInfo

View file

@ -986,7 +986,11 @@ ConversationModel::createConversation(const VectorString& participants, const Ma
void void
ConversationModel::updateConversationInfos(const QString& conversationId, const MapStringString info) ConversationModel::updateConversationInfos(const QString& conversationId, const MapStringString info)
{ {
ConfigurationManager::instance().updateConversationInfos(owner.id, conversationId, info); MapStringString newInfos = info;
// Compress avatar as it will be sent in the conversation's request over the DHT
if (info.contains("avatar"))
newInfos["avatar"] = storage::vcard::compressedAvatar(info["avatar"]);
ConfigurationManager::instance().updateConversationInfos(owner.id, conversationId, newInfos);
} }
bool bool