소스 검색

prevent double join. fix affiliation typo

j8
Philipp Hancke 11 년 전
부모
커밋
1b4273d222
1개의 변경된 파일7개의 추가작업 그리고 2개의 파일을 삭제
  1. 7
    2
      muc.js

+ 7
- 2
muc.js 파일 보기

@@ -7,6 +7,7 @@ Strophe.addConnectionPlugin('emuc', {
7 7
     roomjid: null,
8 8
     myroomjid: null,
9 9
     members: {},
10
+    joined: false,
10 11
     isOwner: false,
11 12
     init: function (conn) {
12 13
         this.connection = conn;
@@ -47,10 +48,14 @@ Strophe.addConnectionPlugin('emuc', {
47 48
         member.show = $(pres).find('>show').text();
48 49
         member.status = $(pres).find('>status').text();
49 50
         var tmp = $(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>item');
50
-        member.affilication = tmp.attr('affiliation');
51
+        member.affiliation = tmp.attr('affiliation');
51 52
         member.role = tmp.attr('role');
52 53
         if (from == this.myroomjid) {
53
-            $(document).trigger('joined.muc', [from, member]);
54
+            if (member.affiliation == 'owner') this.isOwner = true;
55
+            if (!this.joined) {
56
+                this.joined = true;
57
+                $(document).trigger('joined.muc', [from, member]);
58
+            }
54 59
         } else if (this.members[from] === undefined) {
55 60
             // new participant
56 61
             this.members[from] = member;

Loading…
취소
저장