Commit 17c0bc64 authored by Aline Gondim Santos's avatar Aline Gondim Santos

swarm: add support

Change-Id: I12ec5fd0d79c9cdda63f25e7d042e6836828833c
parent 1bbc7cc2
......@@ -59,13 +59,21 @@ BotPeerChatSubscriber::update(Observable<pluginMessagePtr>*, const pluginMessage
if (isAttached) {
if (message->direction) {
std::map<std::string, std::string> sendMsg;
for (auto& pair : message->data) {
if (pair.first == "text/plain" && pair.second == inText_) {
sendMsg[pair.first] = textAnswer_;
if (message->fromHistory)
return;
if (!message->isSwarm)
for (auto& pair : message->data) {
if (pair.first == "text/plain" && pair.second == inText_) {
sendMsg[pair.first] = textAnswer_;
}
}
else if (message->data.at("type") == "text/plain"
&& message->data.at("body") == inText_) {
sendMsg["type"] = "text/plain";
sendMsg["body"] = textAnswer_;
}
if (!sendMsg.empty()) {
sendText(message->accountId, message->peerId, sendMsg);
sendText(message->accountId, message->peerId, sendMsg, message->isSwarm);
}
}
}
......@@ -100,9 +108,15 @@ BotPeerChatSubscriber::detached(Observable<pluginMessagePtr>* observable)
void
BotPeerChatSubscriber::sendText(std::string& accountId,
std::string& peerId,
std::map<std::string, std::string>& sendMsg)
std::map<std::string, std::string>& sendMsg,
bool swarm)
{
pluginMessagePtr botAnswer = std::make_shared<JamiMessage>(accountId, peerId, false, sendMsg, true);
pluginMessagePtr botAnswer = std::make_shared<JamiMessage>(accountId,
peerId,
false,
sendMsg,
true);
botAnswer->isSwarm = swarm;
api_->invokeService(api_, "sendTextMessage", botAnswer.get());
}
} // namespace jami
......@@ -44,7 +44,8 @@ public:
void sendText(std::string& accountId,
std::string& peerId,
std::map<std::string, std::string>& sendMsg);
std::map<std::string, std::string>& sendMsg,
bool swarm);
void setAnswer(const std::string& textAnswer);
void setInText(const std::string& inText);
......
......@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10)
# set the project name
set (ProjectName AutoAnswer)
set (Version 0.1.0)
set (Version 1.0.0)
project(${ProjectName} VERSION ${Version})
......
......@@ -32,8 +32,8 @@
#define EXPORT_PLUGIN
#endif
#define AutoAnswer_VERSION_MAJOR 0
#define AutoAnswer_VERSION_MINOR 1
#define AutoAnswer_VERSION_MAJOR 1
#define AutoAnswer_VERSION_MINOR 0
#define AutoAnswer_VERSION_PATCH 0
extern "C" {
......
{
"name": "AutoAnswer",
"description" : "A plugin that automatically answers with given text",
"version" : "0.1.0",
"iconPath" : "icon.svg"
}
"name": "AutoAnswer",
"description": "A plugin that automatically answers with given text",
"version": "1.0.0",
"iconPath": "icon.svg"
}
\ No newline at end of file
{
"name": "AutoAnswer",
"version": "0.1.0",
"version": "1.0.0",
"extractLibs": false,
"deps": [],
"defines": [],
......
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