Przeglądaj źródła

feat(prosody): Updates checks in presence_identity avoids setting missing user.

factor2
damencho 4 miesięcy temu
rodzic
commit
dc908512f9

+ 5
- 8
resources/prosody-plugins/mod_presence_identity.lua Wyświetl plik

5
 -- values are set in the session, then insert them into the presence messages
5
 -- values are set in the session, then insert them into the presence messages
6
 -- for that session.
6
 -- for that session.
7
 function on_message(event)
7
 function on_message(event)
8
-    if event and event["stanza"] then
9
-      if event.origin and event.origin.jitsi_meet_context_user then
10
-
8
+    local stanza, session = event.stanza, event.origin;
9
+    if stanza and session then
11
           update_presence_identity(
10
           update_presence_identity(
12
-              event.stanza,
13
-              event.origin.jitsi_meet_context_user,
14
-              event.origin.jitsi_meet_context_group
11
+              stanza,
12
+              session.jitsi_meet_context_user,
13
+              session.jitsi_meet_context_group
15
           );
14
           );
16
-
17
-      end
18
     end
15
     end
19
 end
16
 end
20
 
17
 

+ 6
- 3
resources/prosody-plugins/util.lib.lua Wyświetl plik

208
 -- @param creator_group the group of the user who created the user which
208
 -- @param creator_group the group of the user who created the user which
209
 -- presence we are updating (this is the poltergeist case, where a user creates
209
 -- presence we are updating (this is the poltergeist case, where a user creates
210
 -- a poltergeist), optional.
210
 -- a poltergeist), optional.
211
-function update_presence_identity(
212
-    stanza, user, group, creator_user, creator_group)
211
+function update_presence_identity(stanza, user, group, creator_user, creator_group)
213
 
212
 
214
     -- First remove any 'identity' element if it already
213
     -- First remove any 'identity' element if it already
215
     -- exists, so it cannot be spoofed by a client
214
     -- exists, so it cannot be spoofed by a client
222
             end
221
             end
223
             return tag
222
             return tag
224
         end
223
         end
225
-    )
224
+    );
225
+
226
+    if not user then
227
+        return;
228
+    end
226
 
229
 
227
     stanza:tag("identity"):tag("user");
230
     stanza:tag("identity"):tag("user");
228
     for k, v in pairs(user) do
231
     for k, v in pairs(user) do

Ładowanie…
Anuluj
Zapisz