summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2019-01-25 14:40:19 (GMT)
committerKevin Smith <kevin.smith@isode.com>2019-01-25 14:42:26 (GMT)
commit256d1392b0d45ffeac44f764297ea31d65cb0229 (patch)
treef815f19ae20d84a2da63a8f2d08418da6aefe53d
parent3666cbbe30e4d4e25401a5902ae359bc2c24248b (diff)
downloadswift-256d1392b0d45ffeac44f764297ea31d65cb0229.zip
swift-256d1392b0d45ffeac44f764297ea31d65cb0229.tar.bz2
Allow Sluift to set stanza IDs
Test-Information: Compiles Change-Id: I5bfbf270524a1a31c9105f108f47f64eb95276d1
-rw-r--r--Sluift/client.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/Sluift/client.cpp b/Sluift/client.cpp
index 24ece85..814ad45 100644
--- a/Sluift/client.cpp
+++ b/Sluift/client.cpp
@@ -299,6 +299,7 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
"body the body of the message. Can alternatively be specified using the `body` option\n",
"to the JID to send the message to\n"
+ "id the id to set on the stanza\n"
"body the body of the message\n"
"subject the subject of the MUC room to set\n"
"type the type of message to send (`normal`, `chat`, `error`, `groupchat`, `headline`)\n"
@@ -307,6 +308,7 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
Sluift::globals.eventLoop.runOnce();
JID to;
boost::optional<std::string> body;
+ boost::optional<std::string> id;
boost::optional<std::string> subject;
std::vector<std::shared_ptr<Payload> > payloads;
int index = 2;
@@ -324,6 +326,10 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
to = *value;
}
+ if (boost::optional<std::string> value = Lua::getStringField(L, index, "id")) {
+ id = value;
+ }
+
if (boost::optional<std::string> value = Lua::getStringField(L, index, "body")) {
body = value;
}
@@ -350,6 +356,9 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
if (body && !body->empty()) {
message->setBody(*body);
}
+ if (id) {
+ message->setID(*id);
+ }
if (subject) {
message->setSubject(*subject);
}
@@ -369,7 +378,8 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
"self\n"
"body the text of the presence. Can alternatively be specified using the `status` option\n",
- "to the JID to send the message to\n"
+ "to the JID to send the presence to\n"
+ "id the id to set on the stanza\n"
"status the text of the presence\n"
"show the availability of the presence (`online`, `ffc`, `away`, `xa`, `dnd`)\n"
"priority the priority of the presence\n"
@@ -388,6 +398,9 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
if (boost::optional<std::string> value = Lua::getStringField(L, index, "to")) {
presence->setTo(*value);
}
+ if (boost::optional<std::string> id = Lua::getStringField(L, index, "id")) {
+ presence->setID(*id);
+ }
if (boost::optional<std::string> value = Lua::getStringField(L, index, "status")) {
presence->setStatus(*value);
}