Skip to content
Snippets Groups Projects
Commit 655df54f authored by Nicolas Jager's avatar Nicolas Jager
Browse files

text message : send message

- send the message to the contact during a conversation.

- add the message to the conversation.

Change-Id: Ia93d48feed1fa712f5757df8013fad90bd5853e8
parent 849221de
No related branches found
No related tags found
No related merge requests found
...@@ -93,4 +93,6 @@ RingClientUWP::Views::MessageTextPage::sendMessage() ...@@ -93,4 +93,6 @@ RingClientUWP::Views::MessageTextPage::sendMessage()
if (!contact || txt->IsEmpty()) if (!contact || txt->IsEmpty())
return; return;
RingD::instance->sendAccountTextMessage(txt);
} }
...@@ -35,6 +35,7 @@ using namespace Windows::UI::Core; ...@@ -35,6 +35,7 @@ using namespace Windows::UI::Core;
using namespace RingClientUWP; using namespace RingClientUWP;
using namespace RingClientUWP::Utils; using namespace RingClientUWP::Utils;
using namespace RingClientUWP::ViewModel;
void void
debugOutputWrapper(const std::string& str) debugOutputWrapper(const std::string& str)
...@@ -63,6 +64,37 @@ RingClientUWP::RingD::reloadAccountList() ...@@ -63,6 +64,37 @@ RingClientUWP::RingD::reloadAccountList()
Configuration::UserPreferences::instance->load(); Configuration::UserPreferences::instance->load();
} }
/* nb: send message during conversation not chat video message */
void RingClientUWP::RingD::sendAccountTextMessage(String^ message)
{
/* account id */
auto accountId = AccountsViewModel::instance->selectedAccount->accountID_;
std::wstring accountId2(accountId->Begin());
std::string accountId3(accountId2.begin(), accountId2.end());
/* recipient */
auto contact = ContactsViewModel::instance->selectedContact;
auto toRingId = contact->ringID_;
std::wstring toRingId2(toRingId->Begin());
std::string toRingId3(toRingId2.begin(), toRingId2.end());
/* payload(s) */
std::wstring message2(message->Begin());
std::string message3(message2.begin(), message2.end());
std::map<std::string, std::string> payloads;
payloads["text/plain"] = message3;
/* daemon */
auto sent = DRing::sendAccountTextMessage(accountId3, toRingId3, payloads);
/* conversation */
if (sent) {
contact->_conversation->addMessage(""/* date not yet used*/, MSG_FROM_ME, message);
} else {
WNG_("message not sent, see daemon outputs");
}
}
void void
RingClientUWP::RingD::startDaemon() RingClientUWP::RingD::startDaemon()
{ {
......
...@@ -55,6 +55,7 @@ internal: ...@@ -55,6 +55,7 @@ internal:
/* functions */ /* functions */
void startDaemon(); void startDaemon();
void reloadAccountList(); void reloadAccountList();
void sendAccountTextMessage(String^ message);
/* TODO : move members */ /* TODO : move members */
bool hasConfig; bool hasConfig;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment