Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
09802cfb
Commit
09802cfb
authored
Jul 19, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add invitees to the member-list of the room.
parent
60f433d1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
29 deletions
+39
-29
src/converse-muc.js
src/converse-muc.js
+39
-29
No files found.
src/converse-muc.js
View file @
09802cfb
...
...
@@ -256,26 +256,6 @@
converse
.
ChatBoxView
.
prototype
.
close
.
apply
(
this
,
arguments
);
},
updateMembersList
:
function
()
{
/* Update the room's member-lists by sending a delta of
* changed memberships (for all affiliations).
*/
var
iq
=
$iq
({
'
to
'
:
this
.
model
.
get
(
'
jid
'
),
'
type
'
:
'
set
'
,
'
from
'
:
converse
.
connection
.
jid
})
.
c
(
"
query
"
,
{
'
xmlns
'
:
Strophe
.
NS
.
MUC_ADMIN
});
this
.
occupantsview
.
model
.
each
(
function
(
occupant
)
{
var
affiliation
=
occupant
.
get
(
'
affiliation
'
);
iq
.
c
(
'
item
'
,
{
'
affiliation
'
:
affiliation
!==
'
none
'
?
affiliation
:
'
member
'
,
'
jid
'
:
Strophe
.
getBareJidFromJid
(
occupant
.
get
(
'
jid
'
))
});
});
return
converse
.
connection
.
sendIQ
(
iq
.
tree
(),
this
.
onMembersListChanged
.
bind
(
this
),
this
.
onMembersListChangedError
.
bind
(
this
)
);
},
fetchMembersList
:
function
(
affiliation
)
{
/* Fetch the member-list for a particular affiliation.
*
...
...
@@ -296,6 +276,33 @@
);
},
updateMembersList
:
function
(
members
)
{
/* Update the room's member-lists by sending a delta of
* changed memberships (for all affiliations).
*/
var
iq
=
$iq
({
'
to
'
:
this
.
model
.
get
(
'
jid
'
),
'
type
'
:
'
set
'
,
'
from
'
:
converse
.
connection
.
jid
})
.
c
(
"
query
"
,
{
'
xmlns
'
:
Strophe
.
NS
.
MUC_ADMIN
});
_
.
each
(
members
,
function
(
member
)
{
iq
.
c
(
'
item
'
,
{
'
affiliation
'
:
member
.
affiliation
!==
'
none
'
?
member
.
affiliation
:
'
member
'
,
'
jid
'
:
Strophe
.
getBareJidFromJid
(
member
.
jid
)
});
});
return
converse
.
connection
.
sendIQ
(
iq
.
tree
(),
this
.
onMembersListChanged
.
bind
(
this
),
this
.
onMembersListChangedError
.
bind
(
this
)
);
},
onMembersListChanged
:
function
(
stanza
)
{
converse
.
log
(
"
The membership-list for
"
+
this
.
model
.
get
(
'
jid
'
)
+
"
has been succesfully updated
"
);
},
onMembersListChangedError
:
function
(
stanza
)
{
this
.
showStatusNotification
(
__
(
"
An error occurred while trying to update the members list.
"
));
},
onMembersListError
:
function
(
affiliation
,
iq
)
{
if
(
iq
.
getElementsByTagName
(
'
forbidden
'
).
length
)
{
converse
.
log
(
"
You are forbidden from retrieving the
"
+
affiliation
+
"
-list for
"
+
this
.
model
.
get
(
'
jid
'
));
...
...
@@ -335,6 +342,10 @@
};
if
(
reason
!==
null
)
{
attrs
.
reason
=
reason
;
}
if
(
this
.
model
.
get
(
'
password
'
))
{
attrs
.
password
=
this
.
model
.
get
(
'
password
'
);
}
// We also add the invitee to the room's member-list.
this
.
updateMembersList
([{
'
jid
'
:
recipient
,
'
affiliation
'
:
'
member
'
}]);
var
invitation
=
$msg
({
from
:
converse
.
connection
.
jid
,
to
:
recipient
,
...
...
@@ -667,15 +678,14 @@
},
onConfigSaved
:
function
(
stanza
)
{
// this.updateMembersList();
},
onMembersListChanged
:
function
(
stanza
)
{
converse
.
log
(
"
The membership-list for
"
+
this
.
model
.
get
(
'
jid
'
)
+
"
has been succesfully updated
"
);
},
onMembersListChangedError
:
function
(
stanza
)
{
this
.
showStatusNotification
(
__
(
"
An error occurred while trying to update the members list.
"
));
var
members
=
[];
this
.
occupantsview
.
model
.
each
(
function
(
occupant
)
{
members
.
push
({
'
affiliation
'
:
affiliation
!==
'
none
'
?
affiliation
:
'
member
'
,
'
jid
'
:
Strophe
.
getBareJidFromJid
(
occupant
.
get
(
'
jid
'
))
});
});
// this.updateMembersList(members);
},
onErrorConfigSaved
:
function
(
stanza
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment