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
62cecbec
Commit
62cecbec
authored
Aug 22, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into converse-omemo
parents
76a2192a
9ed2ad63
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1477 additions
and
515 deletions
+1477
-515
dist/converse-no-dependencies.js
dist/converse-no-dependencies.js
+1260
-342
dist/converse.js
dist/converse.js
+149
-111
spec/login.js
spec/login.js
+7
-7
src/converse-bookmarks.js
src/converse-bookmarks.js
+7
-8
src/converse-chatboxes.js
src/converse-chatboxes.js
+3
-2
src/converse-chatview.js
src/converse-chatview.js
+4
-4
src/converse-controlbox.js
src/converse-controlbox.js
+5
-3
src/converse-core.js
src/converse-core.js
+15
-13
src/converse-disco.js
src/converse-disco.js
+1
-1
src/converse-minimize.js
src/converse-minimize.js
+4
-4
src/converse-muc-views.js
src/converse-muc-views.js
+1
-1
src/converse-roomslist.js
src/converse-roomslist.js
+11
-11
src/converse-roster.js
src/converse-roster.js
+6
-5
src/converse-vcard.js
src/converse-vcard.js
+3
-2
src/templates/login_panel.html
src/templates/login_panel.html
+1
-1
No files found.
dist/converse-no-dependencies.js
View file @
62cecbec
This source diff could not be displayed because it is too large. You can
view the blob
instead.
dist/converse.js
View file @
62cecbec
This diff is collapsed.
Click to expand it.
spec/login.js
View file @
62cecbec
...
...
@@ -29,15 +29,15 @@
spyOn
(
cbview
.
loginpanel
,
'
connect
'
);
cbview
.
delegateEvents
();
expect
(
_converse
.
s
torage
).
toBe
(
'
session
'
);
expect
(
_converse
.
s
ession
.
get
(
'
storage
'
)).
toBe
(
'
local
'
);
cbview
.
el
.
querySelector
(
'
input[type="submit"]
'
).
click
();
expect
(
_converse
.
s
torage
).
toBe
(
'
local
'
);
expect
(
_converse
.
s
ession
.
get
(
'
storage
'
)
).
toBe
(
'
local
'
);
expect
(
cbview
.
loginpanel
.
connect
).
toHaveBeenCalled
();
checkbox
.
click
();
cbview
.
el
.
querySelector
(
'
input[type="submit"]
'
).
click
();
expect
(
_converse
.
s
torage
).
toBe
(
'
session
'
);
expect
(
_converse
.
s
ession
.
get
(
'
storage
'
)
).
toBe
(
'
session
'
);
done
();
});
}));
...
...
@@ -51,7 +51,7 @@
function
(
done
,
_converse
)
{
test_utils
.
waitUntil
(()
=>
_converse
.
chatboxviews
.
get
(
'
controlbox
'
))
.
then
(
function
()
{
.
then
(
()
=>
{
var
cbview
=
_converse
.
chatboxviews
.
get
(
'
controlbox
'
);
test_utils
.
openControlBox
();
const
checkboxes
=
cbview
.
el
.
querySelectorAll
(
'
input[type="checkbox"]
'
);
...
...
@@ -67,14 +67,14 @@
spyOn
(
cbview
.
loginpanel
,
'
connect
'
);
expect
(
_converse
.
s
torage
).
toBe
(
'
session
'
);
expect
(
_converse
.
s
ession
.
get
(
'
storage
'
)
).
toBe
(
'
session
'
);
cbview
.
el
.
querySelector
(
'
input[type="submit"]
'
).
click
();
expect
(
_converse
.
s
torage
).
toBe
(
'
session
'
);
expect
(
_converse
.
s
ession
.
get
(
'
storage
'
)
).
toBe
(
'
session
'
);
expect
(
cbview
.
loginpanel
.
connect
).
toHaveBeenCalled
();
checkbox
.
click
();
cbview
.
el
.
querySelector
(
'
input[type="submit"]
'
).
click
();
expect
(
_converse
.
s
torage
).
toBe
(
'
local
'
);
expect
(
_converse
.
s
ession
.
get
(
'
storage
'
)
).
toBe
(
'
local
'
);
done
();
});
}));
...
...
src/converse-bookmarks.js
View file @
62cecbec
...
...
@@ -250,9 +250,10 @@
this
.
on
(
'
remove
'
,
this
.
markRoomAsUnbookmarked
,
this
);
this
.
on
(
'
remove
'
,
this
.
sendBookmarkStanza
,
this
);
const
cache_key
=
`converse.room-bookmarks
${
_converse
.
bare_jid
}
`
;
const
storage
=
_converse
.
session
.
get
(
'
storage
'
),
cache_key
=
`converse.room-bookmarks
${
_converse
.
bare_jid
}
`
;
this
.
fetched_flag
=
b64_sha1
(
cache_key
+
'
fetched
'
);
this
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
storage
](
b64_sha1
(
cache_key
));
this
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
b64_sha1
(
cache_key
));
},
openBookmarkedRoom
(
bookmark
)
{
...
...
@@ -443,12 +444,10 @@
_converse
.
chatboxes
.
on
(
'
add
'
,
this
.
renderBookmarkListElement
,
this
);
_converse
.
chatboxes
.
on
(
'
remove
'
,
this
.
renderBookmarkListElement
,
this
);
const
cachekey
=
`converse.room-bookmarks
${
_converse
.
bare_jid
}
-list-model`
;
this
.
list_model
=
new
_converse
.
BookmarksList
();
this
.
list_model
.
id
=
cachekey
;
this
.
list_model
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
storage
](
b64_sha1
(
cachekey
)
);
const
storage
=
_converse
.
session
.
get
(
'
storage
'
),
id
=
b64_sha1
(
`converse.room-bookmarks
${
_converse
.
bare_jid
}
-list-model`
);
this
.
list_model
=
new
_converse
.
BookmarksList
({
'
id
'
:
id
});
this
.
list_model
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
id
);
this
.
list_model
.
fetch
();
this
.
render
();
this
.
sortAndPositionAllItems
();
...
...
src/converse-chatboxes.js
View file @
62cecbec
...
...
@@ -258,8 +258,9 @@
this
.
addRelatedContact
(
_converse
.
roster
.
findWhere
({
'
jid
'
:
this
.
get
(
'
jid
'
)}));
});
this
.
messages
=
new
_converse
.
Messages
();
this
.
messages
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
storage
](
`converse.messages
${
this
.
get
(
'
jid
'
)}${
_converse
.
bare_jid
}
`
);
const
storage
=
_converse
.
session
.
get
(
'
storage
'
);
this
.
messages
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
b64_sha1
(
`converse.messages
${
this
.
get
(
'
jid
'
)}${
_converse
.
bare_jid
}
`
));
this
.
messages
.
chatbox
=
this
;
this
.
messages
.
on
(
'
change:upload
'
,
(
message
)
=>
{
...
...
src/converse-chatview.js
View file @
62cecbec
...
...
@@ -125,9 +125,6 @@
'
scroll_position
'
:
0
},
initialize
()
{
const
id
=
`converse.emoji-
${
_converse
.
bare_jid
}
`
;
this
.
id
=
id
;
this
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
storage
](
id
);
}
});
...
...
@@ -1059,7 +1056,10 @@
createEmojiPicker
()
{
if
(
_
.
isUndefined
(
_converse
.
emojipicker
))
{
_converse
.
emojipicker
=
new
_converse
.
EmojiPicker
();
const
storage
=
_converse
.
session
.
get
(
'
storage
'
),
id
=
`converse.emoji-
${
_converse
.
bare_jid
}
`
;
_converse
.
emojipicker
=
new
_converse
.
EmojiPicker
({
'
id
'
:
id
});
_converse
.
emojipicker
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
id
);
_converse
.
emojipicker
.
fetch
();
}
this
.
emoji_picker_view
=
new
_converse
.
EmojiPickerView
({
...
...
src/converse-controlbox.js
View file @
62cecbec
...
...
@@ -466,8 +466,10 @@
if
(
!
this
.
validate
())
{
return
;
}
const
form_data
=
new
FormData
(
ev
.
target
);
_converse
.
trusted
=
form_data
.
get
(
'
trusted
'
);
_converse
.
storage
=
form_data
.
get
(
'
trusted
'
)
?
'
local
'
:
'
session
'
;
_converse
.
session
.
save
({
'
trusted
'
:
form_data
.
get
(
'
trusted
'
)
&&
true
||
false
,
'
storage
'
:
form_data
.
get
(
'
trusted
'
)
?
'
local
'
:
'
session
'
});
let
jid
=
form_data
.
get
(
'
jid
'
);
if
(
_converse
.
locked_domain
)
{
...
...
@@ -583,7 +585,7 @@
});
_converse
.
on
(
'
clearSession
'
,
()
=>
{
if
(
_converse
.
trusted
)
{
if
(
_converse
.
session
.
get
(
'
trusted
'
)
)
{
const
chatboxes
=
_
.
get
(
_converse
,
'
chatboxes
'
,
null
);
if
(
!
_
.
isNil
(
chatboxes
))
{
const
controlbox
=
chatboxes
.
get
(
'
controlbox
'
);
...
...
src/converse-core.js
View file @
62cecbec
...
...
@@ -222,7 +222,6 @@
rid
:
undefined
,
root
:
window
.
document
,
sid
:
undefined
,
storage
:
'
session
'
,
strict_plugin_dependencies
:
false
,
trusted
:
true
,
view_mode
:
'
overlayed
'
,
// Choices are 'overlayed', 'fullscreen', 'mobile'
...
...
@@ -650,28 +649,30 @@
if
(
reconnecting
)
{
_converse
.
onStatusInitialized
(
reconnecting
);
}
else
{
this
.
xmppstatus
=
new
this
.
XMPPStatus
();
const
id
=
b64_sha1
(
`converse.xmppstatus-
${
_converse
.
bare_jid
}
`
);
this
.
xmppstatus
.
id
=
id
;
// Appears to be necessary for backbone.browserStorage
this
.
xmppstatus
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
storage
](
id
);
const
id
=
`converse.xmppstatus-
${
_converse
.
bare_jid
}
`
;
this
.
xmppstatus
=
new
this
.
XMPPStatus
({
'
id
'
:
id
});
this
.
xmppstatus
.
browserStorage
=
new
Backbone
.
BrowserStorage
.
session
(
id
);
this
.
xmppstatus
.
fetch
({
success
:
_
.
partial
(
_converse
.
onStatusInitialized
,
reconnecting
),
error
:
_
.
partial
(
_converse
.
onStatusInitialized
,
reconnecting
)
'
success
'
:
_
.
partial
(
_converse
.
onStatusInitialized
,
reconnecting
),
'
error
'
:
_
.
partial
(
_converse
.
onStatusInitialized
,
reconnecting
)
});
}
}
this
.
initSession
=
function
()
{
_converse
.
session
=
new
Backbone
.
Model
();
const
id
=
b64_sha1
(
'
converse.bosh-session
'
);
_converse
.
session
.
id
=
id
;
// Appears to be necessary for backbone.browserStorage
_converse
.
session
=
new
Backbone
.
Model
({
'
id
'
:
id
,
'
trusted
'
:
_converse
.
trusted
&&
true
||
false
,
'
storage
'
:
_converse
.
trusted
?
'
local
'
:
'
session
'
});
_converse
.
session
.
browserStorage
=
new
Backbone
.
BrowserStorage
.
session
(
id
);
_converse
.
session
.
fetch
();
_converse
.
emit
(
'
sessionInitialized
'
);
};
this
.
clearSession
=
function
()
{
if
(
!
_converse
.
trusted
)
{
if
(
!
_converse
.
session
.
get
(
'
trusted
'
)
)
{
window
.
localStorage
.
clear
();
window
.
sessionStorage
.
clear
();
}
else
if
(
!
_
.
isUndefined
(
this
.
session
)
&&
this
.
session
.
browserStorage
)
{
...
...
@@ -791,11 +792,12 @@
}
};
this
.
setUserJ
id
=
function
()
{
this
.
setUserJ
ID
=
function
()
{
_converse
.
jid
=
_converse
.
connection
.
jid
;
_converse
.
bare_jid
=
Strophe
.
getBareJidFromJid
(
_converse
.
connection
.
jid
);
_converse
.
resource
=
Strophe
.
getResourceFromJid
(
_converse
.
connection
.
jid
);
_converse
.
domain
=
Strophe
.
getDomainFromJid
(
_converse
.
connection
.
jid
);
_converse
.
emit
(
'
setUserJID
'
);
};
this
.
onConnected
=
function
(
reconnecting
)
{
...
...
@@ -803,8 +805,7 @@
* by logging in or by attaching to an existing BOSH session.
*/
_converse
.
connection
.
flush
();
// Solves problem of returned PubSub BOSH response not received by browser
_converse
.
setUserJid
();
_converse
.
initSession
();
_converse
.
setUserJID
();
_converse
.
enableCarbons
();
_converse
.
initStatus
(
reconnecting
)
};
...
...
@@ -1169,6 +1170,7 @@
function
finishInitialization
()
{
_converse
.
initPlugins
();
_converse
.
initSession
();
_converse
.
initConnection
();
_converse
.
setUpXMLLogging
();
_converse
.
logIn
();
...
...
src/converse-disco.js
View file @
62cecbec
...
...
@@ -267,7 +267,7 @@
}).
catch
(
_
.
partial
(
_converse
.
log
,
_
,
Strophe
.
LogLevel
.
FATAL
));
}
_converse
.
api
.
listen
.
on
(
'
se
ssionInitialized
'
,
initStreamFeatures
);
_converse
.
api
.
listen
.
on
(
'
se
tUserJID
'
,
initStreamFeatures
);
_converse
.
api
.
listen
.
on
(
'
reconnected
'
,
initializeDisco
);
_converse
.
api
.
listen
.
on
(
'
connected
'
,
initializeDisco
);
...
...
src/converse-minimize.js
View file @
62cecbec
...
...
@@ -423,12 +423,12 @@
},
initToggle
()
{
const
storage
=
_converse
.
session
.
get
(
'
storage
'
),
id
=
b64_sha1
(
`converse.minchatstoggle
${
_converse
.
bare_jid
}
`
);
this
.
toggleview
=
new
_converse
.
MinimizedChatsToggleView
({
model
:
new
_converse
.
MinimizedChatsToggle
(
)
'
model
'
:
new
_converse
.
MinimizedChatsToggle
({
'
id
'
:
id
}
)
});
const
id
=
b64_sha1
(
`converse.minchatstoggle
${
_converse
.
bare_jid
}
`
);
this
.
toggleview
.
model
.
id
=
id
;
// Appears to be necessary for backbone.browserStorage
this
.
toggleview
.
model
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
storage
](
id
);
this
.
toggleview
.
model
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
id
);
this
.
toggleview
.
model
.
fetch
();
},
...
...
src/converse-muc-views.js
View file @
62cecbec
...
...
@@ -102,7 +102,7 @@
this
.
roomspanel
=
new
_converse
.
RoomsPanel
({
'
model
'
:
new
(
_converse
.
RoomsPanelModel
.
extend
({
'
id
'
:
b64_sha1
(
`converse.roomspanel
${
_converse
.
bare_jid
}
`
),
// Required by sessionStorage
'
browserStorage
'
:
new
Backbone
.
BrowserStorage
[
_converse
.
s
torage
](
'
browserStorage
'
:
new
Backbone
.
BrowserStorage
[
_converse
.
s
ession
.
get
(
'
storage
'
)
](
b64_sha1
(
`converse.roomspanel
${
_converse
.
bare_jid
}
`
))
}))()
});
...
...
src/converse-roomslist.js
View file @
62cecbec
...
...
@@ -55,8 +55,6 @@
},
initialize
()
{
this
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
storage
](
b64_sha1
(
`converse.open-rooms-{_converse.bare_jid}`
));
_converse
.
chatboxes
.
on
(
'
add
'
,
this
.
onChatBoxAdded
,
this
);
_converse
.
chatboxes
.
on
(
'
change:hidden
'
,
this
.
onChatBoxChanged
,
this
);
_converse
.
chatboxes
.
on
(
'
change:bookmarked
'
,
this
.
onChatBoxChanged
,
this
);
...
...
@@ -170,12 +168,11 @@
this
.
model
.
on
(
'
add
'
,
this
.
showOrHide
,
this
);
this
.
model
.
on
(
'
remove
'
,
this
.
showOrHide
,
this
);
const
cachekey
=
`converse.roomslist
${
_converse
.
bare_jid
}
`
;
this
.
list_model
=
new
_converse
.
RoomsList
();
this
.
list_model
.
id
=
cachekey
;
this
.
list_model
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
storage
](
b64_sha1
(
cachekey
)
);
const
storage
=
_converse
.
session
.
get
(
'
storage
'
),
id
=
b64_sha1
(
`converse.roomslist
${
_converse
.
bare_jid
}
`
);
this
.
list_model
=
new
_converse
.
RoomsList
({
'
id
'
:
id
});
this
.
list_model
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
id
);
this
.
list_model
.
fetch
();
this
.
render
();
this
.
sortAndPositionAllItems
();
...
...
@@ -265,9 +262,12 @@
});
const
initRoomsListView
=
function
()
{
_converse
.
rooms_list_view
=
new
_converse
.
RoomsListView
(
{
'
model
'
:
new
_converse
.
OpenRooms
()
}
);
const
storage
=
_converse
.
session
.
get
(
'
storage
'
),
id
=
b64_sha1
(
`converse.open-rooms-{_converse.bare_jid}`
),
model
=
new
_converse
.
OpenRooms
();
model
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
id
);
_converse
.
rooms_list_view
=
new
_converse
.
RoomsListView
({
'
model
'
:
model
});
};
if
(
_converse
.
allow_bookmarks
)
{
...
...
src/converse-roster.js
View file @
62cecbec
...
...
@@ -49,20 +49,21 @@
_converse
.
initRoster
=
function
()
{
/* Initialize the Bakcbone collections that represent the contats
* roster and the roster groups.
*/
* roster and the roster groups.
*/
const
storage
=
_converse
.
session
.
get
(
'
storage
'
);
_converse
.
roster
=
new
_converse
.
RosterContacts
();
_converse
.
roster
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
storage
](
_converse
.
roster
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
b64_sha1
(
`converse.contacts-
${
_converse
.
bare_jid
}
`
));
_converse
.
roster
.
data
=
new
Backbone
.
Model
();
const
id
=
b64_sha1
(
`converse-roster-model-
${
_converse
.
bare_jid
}
`
);
_converse
.
roster
.
data
.
id
=
id
;
_converse
.
roster
.
data
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
storage
](
id
);
_converse
.
roster
.
data
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
id
);
_converse
.
roster
.
data
.
fetch
();
_converse
.
rostergroups
=
new
_converse
.
RosterGroups
();
_converse
.
rostergroups
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
storage
](
_converse
.
rostergroups
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
storage
](
b64_sha1
(
`converse.roster.groups
${
_converse
.
bare_jid
}
`
));
_converse
.
emit
(
'
rosterInitialized
'
);
};
...
...
src/converse-vcard.js
View file @
62cecbec
...
...
@@ -131,10 +131,11 @@
/* Event handlers */
_converse
.
initVCardCollection
=
function
()
{
_converse
.
vcards
=
new
_converse
.
VCards
();
_converse
.
vcards
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
storage
](
b64_sha1
(
`converse.vcards`
));
const
id
=
b64_sha1
(
`converse.vcards`
);
_converse
.
vcards
.
browserStorage
=
new
Backbone
.
BrowserStorage
[
_converse
.
session
.
get
(
'
storage
'
)](
id
);
_converse
.
vcards
.
fetch
();
}
_converse
.
api
.
listen
.
on
(
'
se
ssionInitialized
'
,
_converse
.
initVCardCollection
);
_converse
.
api
.
listen
.
on
(
'
se
tUserJID
'
,
_converse
.
initVCardCollection
);
_converse
.
on
(
'
addClientFeatures
'
,
()
=>
{
...
...
src/templates/login_panel.html
View file @
62cecbec
...
...
@@ -19,7 +19,7 @@
</div>
{[ } ]}
<div
class=
"form-group form-check"
>
<input
id=
"converse-login-trusted"
type=
"checkbox"
class=
"form-check-input"
name=
"trusted"
{[
if
(
o
.
_converse
.
trusted
)
{
]}
checked=
"checked"
{[
}
]}
>
<input
id=
"converse-login-trusted"
type=
"checkbox"
class=
"form-check-input"
name=
"trusted"
{[
if
(
o
.
_converse
.
session
.
get
('
trusted
')
)
{
]}
checked=
"checked"
{[
}
]}
>
<label
for=
"converse-login-trusted"
class=
"form-check-label"
>
{{{o.__('This is a trusted device')}}}
</label>
<i
class=
"fa fa-info-circle"
data-toggle=
"popover"
data-title=
"Trusted device?"
...
...
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