From 284b5f94b50143d5697a978eb4d9abd45d374f35 Mon Sep 17 00:00:00 2001 From: damencho Date: Thu, 20 Jul 2017 13:29:54 -0500 Subject: [PATCH] Adds initial status param when creating poltergeist. --- resources/prosody-plugins/mod_muc_poltergeist.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/resources/prosody-plugins/mod_muc_poltergeist.lua b/resources/prosody-plugins/mod_muc_poltergeist.lua index 4e36e60f0..56b33d739 100644 --- a/resources/prosody-plugins/mod_muc_poltergeist.lua +++ b/resources/prosody-plugins/mod_muc_poltergeist.lua @@ -134,7 +134,8 @@ end); -- @param nick the nick to use for the new occupant -- @param name the display name fot the occupant (optional) -- @param avatar the avatar to use for the new occupant (optional) -function create_poltergeist_occupant(room, nick, name, avatar) +-- @param status the initial status to use for the new occupant (optional) +function create_poltergeist_occupant(room, nick, name, avatar, status) log("debug", "create_poltergeist_occupant %s:", nick); -- Join poltergeist occupant to room, with the invited JID as their nick local join_presence = st.presence({ @@ -150,6 +151,9 @@ function create_poltergeist_occupant(room, nick, name, avatar) if (avatar) then join_presence:tag("avatar-url"):text(avatar):up(); end + if (status) then + join_presence:tag("status"):text(status):up(); + end room:handle_first_presence( prosody.hosts[poltergeist_component], join_presence); @@ -247,6 +251,7 @@ function handle_create_poltergeist (event) local group = params["group"]; local name = params["name"]; local avatar = params["avatar"]; + local status = params["status"]; local room = get_room(room_name, group); if (not room) then @@ -257,7 +262,8 @@ function handle_create_poltergeist (event) local username = generate_uuid(); store_username(room, user_id, username) - create_poltergeist_occupant(room, string.sub(username,0,8), name, avatar); + create_poltergeist_occupant( + room, string.sub(username,0,8), name, avatar, status); return 200; end