Bläddra i källkod

feat(visitors): Visitors chat. (#2245)

* feat(visitors): Visitors chat.

For messages coming from visitors, which are not in the current room we need to supply a display name.
Mark messages with custom display name as coming from guest.

* feat: Adds a visitors version to conferenceIQ.
master
Дамян Минков 2 år sedan
förälder
incheckning
b6a5a8d958
Inget konto är kopplat till bidragsgivarens mejladress
3 ändrade filer med 16 tillägg och 3 borttagningar
  1. 2
    2
      JitsiConferenceEventManager.js
  2. 11
    1
      modules/xmpp/ChatRoom.js
  3. 3
    0
      modules/xmpp/moderator.js

+ 2
- 2
JitsiConferenceEventManager.js Visa fil

395
         XMPPEvents.MESSAGE_RECEIVED,
395
         XMPPEvents.MESSAGE_RECEIVED,
396
 
396
 
397
         // eslint-disable-next-line max-params
397
         // eslint-disable-next-line max-params
398
-        (jid, txt, myJid, ts) => {
398
+        (jid, txt, myJid, ts, nick, isGuest) => {
399
             const id = Strophe.getResourceFromJid(jid);
399
             const id = Strophe.getResourceFromJid(jid);
400
 
400
 
401
             conference.eventEmitter.emit(
401
             conference.eventEmitter.emit(
402
                 JitsiConferenceEvents.MESSAGE_RECEIVED,
402
                 JitsiConferenceEvents.MESSAGE_RECEIVED,
403
-                id, txt, ts);
403
+                id, txt, ts, nick, isGuest);
404
         });
404
         });
405
 
405
 
406
     chatRoom.addListener(
406
     chatRoom.addListener(

+ 11
- 1
modules/xmpp/ChatRoom.js Visa fil

1159
                 this.eventEmitter.emit(XMPPEvents.PRIVATE_MESSAGE_RECEIVED,
1159
                 this.eventEmitter.emit(XMPPEvents.PRIVATE_MESSAGE_RECEIVED,
1160
                         from, txt, this.myroomjid, stamp);
1160
                         from, txt, this.myroomjid, stamp);
1161
             } else if (type === 'groupchat') {
1161
             } else if (type === 'groupchat') {
1162
+                const nickEl = $(msg).find('>nick');
1163
+                let nick;
1164
+
1165
+                if (nickEl.length > 0) {
1166
+                    nick = nickEl.text();
1167
+                }
1168
+
1169
+                // we will fire explicitly that this is a guest(isGuest:true) to the conference
1170
+                // informing that this is probably a message from a guest to the conference (visitor)
1171
+                // a message with explicit name set
1162
                 this.eventEmitter.emit(XMPPEvents.MESSAGE_RECEIVED,
1172
                 this.eventEmitter.emit(XMPPEvents.MESSAGE_RECEIVED,
1163
-                        from, txt, this.myroomjid, stamp);
1173
+                    from, txt, this.myroomjid, stamp, nick, Boolean(nick));
1164
             }
1174
             }
1165
         }
1175
         }
1166
     }
1176
     }

+ 3
- 0
modules/xmpp/moderator.js Visa fil

216
                 }).up();
216
                 }).up();
217
         }
217
         }
218
     }
218
     }
219
+    elem.c('property', {
220
+        name: 'visitors-version',
221
+        value: 1 }).up();
219
 
222
 
220
     return elem;
223
     return elem;
221
 };
224
 };

Laddar…
Avbryt
Spara