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
724e66d0
Commit
724e66d0
authored
Sep 29, 2017
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial code for opening a room via URL
parent
79080b35
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
42 additions
and
10 deletions
+42
-10
docs/source/events.rst
docs/source/events.rst
+16
-0
src/converse-controlbox.js
src/converse-controlbox.js
+1
-1
src/converse-muc.js
src/converse-muc.js
+19
-1
src/converse-register.js
src/converse-register.js
+2
-8
src/utils.js
src/utils.js
+4
-0
No files found.
docs/source/events.rst
View file @
724e66d0
...
...
@@ -300,6 +300,22 @@ have to be registered anew.
``_converse.on('reconnected', function () { ... });``
roomsAutoJoined
---------------
Emitted once any rooms that have been configured to be automatically joined,
specified via the _`auto_join_rooms` setting, have been entered.
``_converse.on('roomsAutoJoined', function () { ... });``
Also available as an `ES2015 Promise <http://es6-features.org/#PromiseUsage>`_:
.. code-block:: javascript
_converse.api.waitUntil('roomsAutoJoined').then(function () {
// Your code here...
});
roomInviteSent
~~~~~~~~~~~~~~
...
...
src/converse-controlbox.js
View file @
724e66d0
...
...
@@ -511,7 +511,7 @@
if
(
jid_element
.
value
&&
!
_converse
.
locked_domain
&&
!
_converse
.
default_domain
&&
_
.
filter
(
jid_element
.
value
.
split
(
'
@
'
)).
length
<
2
)
{
!
utils
.
isValidJID
(
jid_element
.
value
)
)
{
jid_element
.
setCustomValidity
(
__
(
'
Please enter a valid XMPP address
'
));
return
false
;
}
...
...
src/converse-muc.js
View file @
724e66d0
...
...
@@ -353,7 +353,22 @@
'
toggle_occupants
'
:
true
},
});
_converse
.
api
.
promises
.
add
(
'
roomsPanelRendered
'
);
_converse
.
api
.
promises
.
add
([
'
roomsPanelRendered
'
,
'
roomsAutoJoined
'
]);
const
MUCRouter
=
Backbone
.
Router
.
extend
({
routes
:
{
'
converse?room=:room
'
:
'
openRoom
'
},
openRoom
(
room
)
{
_converse
.
api
.
waitUntil
(
'
roomsAutoJoined
'
).
then
(()
=>
{
if
(
utils
.
isValidJID
(
room
))
{
_converse
.
api
.
rooms
.
open
(
room
);
}
});
}
});
const
router
=
new
MUCRouter
();
_converse
.
openChatRoom
=
function
(
settings
,
bring_to_foreground
)
{
/* Opens a chat room, making sure that certain attributes
...
...
@@ -2724,6 +2739,9 @@
Strophe
.
LogLevel
.
ERROR
);
}
});
// XXX: Could return Promise for api.rooms.open and then wait
// until all promises have resolved before emitting this.
_converse
.
emit
(
'
roomsAutoJoined
'
);
}
_converse
.
on
(
'
chatBoxesFetched
'
,
autoJoinRooms
);
...
...
src/converse-register.js
View file @
724e66d0
...
...
@@ -80,9 +80,6 @@
ControlBoxView
:
{
events
:
{
},
initialize
()
{
this
.
__super__
.
initialize
.
apply
(
this
,
arguments
);
this
.
model
.
on
(
'
change:active-form
'
,
this
.
showLoginOrRegisterForm
.
bind
(
this
))
...
...
@@ -102,7 +99,6 @@
}
},
renderRegistrationPanel
()
{
const
{
_converse
}
=
this
.
__super__
;
if
(
_converse
.
allow_registration
)
{
...
...
@@ -149,13 +145,11 @@
providers_link
:
'
https://xmpp.net/directory.php
'
,
// Link to XMPP providers shown on registration page
});
_converse
.
RegistrationRouter
=
Backbone
.
Router
.
extend
({
const
RegistrationRouter
=
Backbone
.
Router
.
extend
({
initialize
()
{
this
.
route
(
'
converse-login
'
,
_
.
partial
(
this
.
setActiveForm
,
'
login
'
));
this
.
route
(
'
converse-register
'
,
_
.
partial
(
this
.
setActiveForm
,
'
register
'
));
},
setActiveForm
(
value
)
{
_converse
.
api
.
waitUntil
(
'
controlboxInitialized
'
).
then
(()
=>
{
const
controlbox
=
_converse
.
chatboxes
.
get
(
'
controlbox
'
)
...
...
@@ -163,7 +157,7 @@
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}
});
const
router
=
new
_converse
.
RegistrationRouter
();
const
router
=
new
RegistrationRouter
();
_converse
.
RegisterPanel
=
Backbone
.
View
.
extend
({
...
...
src/utils.js
View file @
724e66d0
...
...
@@ -268,6 +268,10 @@
}
};
u
.
isValidJID
=
function
(
jid
)
{
return
_
.
filter
(
jid
.
split
(
'
@
'
)).
length
===
2
&&
!
jid
.
startsWith
(
'
@
'
)
&&
!
jid
.
endsWith
(
'
@
'
);
};
u
.
isSameBareJID
=
function
(
jid1
,
jid2
)
{
return
Strophe
.
getBareJidFromJid
(
jid1
).
toLowerCase
()
===
Strophe
.
getBareJidFromJid
(
jid2
).
toLowerCase
();
...
...
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