Bläddra i källkod

feat(JitsiParticipant): expose bot type.

tags/v0.0.2
hristoterezov 7 år sedan
förälder
incheckning
0838bfd1d4
3 ändrade filer med 20 tillägg och 0 borttagningar
  1. 6
    0
      JitsiConference.js
  2. 5
    0
      JitsiConferenceEvents.js
  3. 9
    0
      JitsiParticipant.js

+ 6
- 0
JitsiConference.js Visa fil

1228
 
1228
 
1229
     if (botParticipant) {
1229
     if (botParticipant) {
1230
         botParticipant._botType = botType;
1230
         botParticipant._botType = botType;
1231
+        const id = Strophe.getResourceFromJid(jid);
1232
+
1233
+        this.eventEmitter.emit(
1234
+            JitsiConferenceEvents.BOT_TYPE_CHANGED,
1235
+            id,
1236
+            botType);
1231
     }
1237
     }
1232
 
1238
 
1233
     // if botType changed to undefined, botType was removed, in case of
1239
     // if botType changed to undefined, botType was removed, in case of

+ 5
- 0
JitsiConferenceEvents.js Visa fil

284
  * User status changed.
284
  * User status changed.
285
  */
285
  */
286
 export const USER_STATUS_CHANGED = 'conference.statusChanged';
286
 export const USER_STATUS_CHANGED = 'conference.statusChanged';
287
+
288
+/**
289
+ * Event indicates that the bot participant type cahnged.
290
+ */
291
+export const BOT_TYPE_CHANGED = 'conference.bot_type_changed';

+ 9
- 0
JitsiParticipant.js Visa fil

244
     getFeatures(timeout = 5000) {
244
     getFeatures(timeout = 5000) {
245
         return this._conference.xmpp.caps.getFeatures(this._jid, timeout);
245
         return this._conference.xmpp.caps.getFeatures(this._jid, timeout);
246
     }
246
     }
247
+
248
+    /**
249
+     * Returns the bot type for the participant.
250
+     *
251
+     * @returns {string|undefined} - The bot type of the participant.
252
+     */
253
+    getBotType() {
254
+        return this._botType;
255
+    }
247
 }
256
 }

Laddar…
Avbryt
Spara