prevent double join. fix affiliation typo
This commit is contained in:
parent
a2916176cb
commit
1b4273d222
7
muc.js
7
muc.js
|
@ -7,6 +7,7 @@ Strophe.addConnectionPlugin('emuc', {
|
||||||
roomjid: null,
|
roomjid: null,
|
||||||
myroomjid: null,
|
myroomjid: null,
|
||||||
members: {},
|
members: {},
|
||||||
|
joined: false,
|
||||||
isOwner: false,
|
isOwner: false,
|
||||||
init: function (conn) {
|
init: function (conn) {
|
||||||
this.connection = conn;
|
this.connection = conn;
|
||||||
|
@ -47,10 +48,14 @@ Strophe.addConnectionPlugin('emuc', {
|
||||||
member.show = $(pres).find('>show').text();
|
member.show = $(pres).find('>show').text();
|
||||||
member.status = $(pres).find('>status').text();
|
member.status = $(pres).find('>status').text();
|
||||||
var tmp = $(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>item');
|
var tmp = $(pres).find('>x[xmlns="http://jabber.org/protocol/muc#user"]>item');
|
||||||
member.affilication = tmp.attr('affiliation');
|
member.affiliation = tmp.attr('affiliation');
|
||||||
member.role = tmp.attr('role');
|
member.role = tmp.attr('role');
|
||||||
if (from == this.myroomjid) {
|
if (from == this.myroomjid) {
|
||||||
|
if (member.affiliation == 'owner') this.isOwner = true;
|
||||||
|
if (!this.joined) {
|
||||||
|
this.joined = true;
|
||||||
$(document).trigger('joined.muc', [from, member]);
|
$(document).trigger('joined.muc', [from, member]);
|
||||||
|
}
|
||||||
} else if (this.members[from] === undefined) {
|
} else if (this.members[from] === undefined) {
|
||||||
// new participant
|
// new participant
|
||||||
this.members[from] = member;
|
this.members[from] = member;
|
||||||
|
|
Loading…
Reference in New Issue