From 0c790e6850f0575f4d5ba8182c580182869ad57d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 6 May 2023 18:14:23 +0200 Subject: Message: get self identity from server --- src/message.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/message.cpp') diff --git a/src/message.cpp b/src/message.cpp index fd8e847..dd4f9d5 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -208,8 +208,9 @@ DirectMessageService::Config & DirectMessageService::Config::onUpdate(ThreadWatc return *this; } -DirectMessageService::DirectMessageService(Config && c, const Server &): - config(move(c)) +DirectMessageService::DirectMessageService(Config && c, const Server & s): + config(move(c)), + server(s) {} DirectMessageService::~DirectMessageService() = default; @@ -245,7 +246,7 @@ DirectMessageThread DirectMessageService::thread(const Identity & peer) return DirectMessageThread::Priv::getThreadLocked(peer.finalOwner()); } -DirectMessage DirectMessageService::send(const Identity & from, const Peer & peer, const string & text) +DirectMessage DirectMessageService::send(const Peer & peer, const string & text) { auto pid = peer.identity(); if (!pid) @@ -254,9 +255,9 @@ DirectMessage DirectMessageService::send(const Identity & from, const Peer & pee scoped_lock lock(threadLock); - auto msg = from.ref()->storage().store(DirectMessageData { + auto msg = server.localHead().ref().storage().store(DirectMessageData { .prev = DirectMessageThread::Priv::getThreadLocked(powner).p->head, - .from = from.finalOwner(), + .from = server.identity().finalOwner(), .time = ZonedTime::now(), .text = text, }); -- cgit v1.2.3