summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
@@ -297,18 +297,20 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
"self\n"
"to the JID to send the message to\n"
"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"
"payloads payloads to add to the message\n"
) {
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;
Message::Type type = Message::Chat;
if (lua_isstring(L, index)) {
@@ -322,10 +324,14 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
if (lua_istable(L, index)) {
if (boost::optional<std::string> value = Lua::getStringField(L, index, "to")) {
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;
}
if (boost::optional<std::string> value = Lua::getStringField(L, index, "type")) {
@@ -348,10 +354,13 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
Message::ref message = std::make_shared<Message>();
message->setTo(to);
if (body && !body->empty()) {
message->setBody(*body);
}
+ if (id) {
+ message->setID(*id);
+ }
if (subject) {
message->setSubject(*subject);
}
message->addPayloads(payloads.begin(), payloads.end());
message->setType(type);
@@ -367,11 +376,12 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
"Send presence.",
"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"
"type the type of message to send (`available`, `error`, `probe`, `subscribe`, `subscribed`, `unavailable`, `unsubscribe`, `unsubscribed`)\n"
"payloads payloads to add to the presence\n"
@@ -386,10 +396,13 @@ SLUIFT_LUA_FUNCTION_WITH_HELP(
}
if (lua_istable(L, index)) {
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);
}
if (boost::optional<int> value = Lua::getIntField(L, index, "priority")) {
presence->setPriority(*value);