# HG changeset patch # User marc0s # Date 1582903357 -3600 # Node ID 9eabd68b8e486ffaaab28c30a1258d6031247282 # Parent cf92e3b30c18ac17abe90597dca9b19ad75d66d3 mod_reminders: add id to sent reminder Update the acknowledgement of reminder's creation with ProtoXEP comments. diff -r cf92e3b30c18 -r 9eabd68b8e48 mod_reminders/mod_reminders.lua --- a/mod_reminders/mod_reminders.lua Thu Feb 27 23:17:31 2020 +0100 +++ b/mod_reminders/mod_reminders.lua Fri Feb 28 16:22:37 2020 +0100 @@ -64,7 +64,7 @@ local bare = jid.bare(reminder.jid); module:log("debug", "Sending reminder %s to %s", reminder.id, bare); local message = st.message({ from = "localhost"; to = bare; id = id.short() }) - :tag("reminder", {xmlns = xmlns_reminders}) + :tag("reminder", {id = reminder.id; xmlns = xmlns_reminders}) :add_child(reminder.text) :tag("date"):text(datetime.datetime(reminder.date)):up(); module:send(message); @@ -110,7 +110,6 @@ end local function create_reminder (jid, reminder) - local rem = st.clone(reminder); local date = reminder:get_child("date"); local text = reminder:get_child("text"); if date == nil or text == nil then @@ -123,10 +122,11 @@ end if parsed_date < now then return nil, reminder_error("past_date"), nil - end - rem.attr.id = id.medium(); + end + local reminder_id = id.medium(); + local rem = st.stanza("reminder", {xmlns = xmlns_reminders; id = reminder_id}); local data = { - id = rem.attr.id; + id = reminder_id; jid = jid; text = text; date = parsed_date;