Browse Source

Adds initial status param when creating poltergeist.

master
damencho 7 years ago
parent
commit
284b5f94b5
1 changed files with 8 additions and 2 deletions
  1. 8
    2
      resources/prosody-plugins/mod_muc_poltergeist.lua

+ 8
- 2
resources/prosody-plugins/mod_muc_poltergeist.lua View File

134
 -- @param nick the nick to use for the new occupant
134
 -- @param nick the nick to use for the new occupant
135
 -- @param name the display name fot the occupant (optional)
135
 -- @param name the display name fot the occupant (optional)
136
 -- @param avatar the avatar to use for the new occupant (optional)
136
 -- @param avatar the avatar to use for the new occupant (optional)
137
-function create_poltergeist_occupant(room, nick, name, avatar)
137
+-- @param status the initial status to use for the new occupant (optional)
138
+function create_poltergeist_occupant(room, nick, name, avatar, status)
138
     log("debug", "create_poltergeist_occupant %s:", nick);
139
     log("debug", "create_poltergeist_occupant %s:", nick);
139
     -- Join poltergeist occupant to room, with the invited JID as their nick
140
     -- Join poltergeist occupant to room, with the invited JID as their nick
140
     local join_presence = st.presence({
141
     local join_presence = st.presence({
150
     if (avatar) then
151
     if (avatar) then
151
         join_presence:tag("avatar-url"):text(avatar):up();
152
         join_presence:tag("avatar-url"):text(avatar):up();
152
     end
153
     end
154
+    if (status) then
155
+        join_presence:tag("status"):text(status):up();
156
+    end
153
 
157
 
154
     room:handle_first_presence(
158
     room:handle_first_presence(
155
         prosody.hosts[poltergeist_component], join_presence);
159
         prosody.hosts[poltergeist_component], join_presence);
247
     local group = params["group"];
251
     local group = params["group"];
248
     local name = params["name"];
252
     local name = params["name"];
249
     local avatar = params["avatar"];
253
     local avatar = params["avatar"];
254
+    local status = params["status"];
250
 
255
 
251
     local room = get_room(room_name, group);
256
     local room = get_room(room_name, group);
252
     if (not room) then
257
     if (not room) then
257
     local username = generate_uuid();
262
     local username = generate_uuid();
258
     store_username(room, user_id, username)
263
     store_username(room, user_id, username)
259
 
264
 
260
-    create_poltergeist_occupant(room, string.sub(username,0,8), name, avatar);
265
+    create_poltergeist_occupant(
266
+        room, string.sub(username,0,8), name, avatar, status);
261
 
267
 
262
     return 200;
268
     return 200;
263
 end
269
 end

Loading…
Cancel
Save