Browse Source

Check if there are URLs in that message

tags/0.1.3
tastytea 2 years ago
parent
commit
e9e16f96d8
Signed by: tastytea GPG Key ID: 59346E0EA35C67E5
4 changed files with 17 additions and 7 deletions
  1. +1
    -1
      CMakeLists.txt
  2. +1
    -1
      README.md
  3. +14
    -4
      src/main.cpp
  4. +1
    -1
      src/masto.cpp

+ 1
- 1
CMakeLists.txt View File

@@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.7)
project (expandurl-mastodon
VERSION 0.1.0
VERSION 0.1.1
LANGUAGES CXX
)



+ 1
- 1
README.md View File

@@ -11,7 +11,7 @@ mention the bot account (@expandurl@botsin.space for example).
* C++ compiler (tested: gcc 6.4, clang 5.0)
* [cmake](https://cmake.org/) (tested: 3.9.6)
* [curlpp](http://www.curlpp.org/) (tested: 0.8.4)
* [mastodon-cpp](https://github.com/tastytea/mastodon-cpp) (at least: 0.12.0)
* [mastodon-cpp](https://github.com/tastytea/mastodon-cpp) (at least: 0.12.1)

## Get sourcecode



+ 14
- 4
src/main.cpp View File

@@ -95,14 +95,24 @@ int main(int argc, char *argv[])
{
message += url + " \n";
}
if (listener.send_reply(notif.status(), message))
if (!message.empty())
{
cout << "Sent reply: " << message;
message = '@' + notif.status().account().acct() +
' ' + message;
if (listener.send_reply(notif.status(), message))
{
cout << "Sent reply: " << message;
}
else
{
cerr << "ERROR: could not send reply to " <<
notif.status().id() << '\n';
}
}
else
{
cerr << "ERROR: could not send reply to " <<
notif.status().id() << '\n';
listener.send_reply(notif.status(),
"I couldn't find an URL in the message you replied to. 😞");
}
}
}


+ 1
- 1
src/masto.cpp View File

@@ -131,7 +131,7 @@ const bool Listener::send_reply(const Easy::Status &status,
{
{ "in_reply_to_id", { id } },
{ "visibility", { strvisibility } },
{ "status", { '@' + status.account().acct() + ' ' + message } }
{ "status", { message } }
};

if (status.sensitive())


Loading…
Cancel
Save