Просмотр исходного кода

feat(JitsiParticipant): expose bot type.

release-8443
hristoterezov 7 лет назад
Родитель
Сommit
0838bfd1d4
3 измененных файлов: 20 добавлений и 0 удалений
  1. 6
    0
      JitsiConference.js
  2. 5
    0
      JitsiConferenceEvents.js
  3. 9
    0
      JitsiParticipant.js

+ 6
- 0
JitsiConference.js Просмотреть файл

@@ -1228,6 +1228,12 @@ JitsiConference.prototype._onMemberBotTypeChanged = function(jid, botType) {
1228 1228
 
1229 1229
     if (botParticipant) {
1230 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 1239
     // if botType changed to undefined, botType was removed, in case of

+ 5
- 0
JitsiConferenceEvents.js Просмотреть файл

@@ -284,3 +284,8 @@ export const USER_ROLE_CHANGED = 'conference.roleChanged';
284 284
  * User status changed.
285 285
  */
286 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 Просмотреть файл

@@ -244,4 +244,13 @@ export default class JitsiParticipant {
244 244
     getFeatures(timeout = 5000) {
245 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
 }

Загрузка…
Отмена
Сохранить