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
d66ea207
Commit
d66ea207
authored
Feb 16, 2016
by
JC Brand
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #592 from davec82/master
add random resource also for auto_login
parents
a687e87e
2e50ecb9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
docs/CHANGES.md
docs/CHANGES.md
+1
-0
src/converse-core.js
src/converse-core.js
+12
-3
No files found.
docs/CHANGES.md
View file @
d66ea207
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
-
#573 xgettext build error:
`'javascript' unknown`
[jcbrand]
-
#573 xgettext build error:
`'javascript' unknown`
[jcbrand]
-
#587 Fix issue when logging out with
`auto_logout=true`
[davec82]
-
#587 Fix issue when logging out with
`auto_logout=true`
[davec82]
-
#589 Save scroll position on minimize and restore it on maximize [rlanvin]
-
#589 Save scroll position on minimize and restore it on maximize [rlanvin]
-
#592 Add random resource for auto_login, add method generateResource to generate random resource [davec82]
## 0.10.1 (2016-02-06)
## 0.10.1 (2016-02-06)
...
...
src/converse-core.js
View file @
d66ea207
...
@@ -415,6 +415,10 @@
...
@@ -415,6 +415,10 @@
// Module-level functions
// Module-level functions
// ----------------------
// ----------------------
this
.
generateResource
=
function
()
{
return
'
/converse.js-
'
+
Math
.
floor
(
Math
.
random
()
*
139749825
).
toString
();
};
this
.
sendCSI
=
function
(
stat
)
{
this
.
sendCSI
=
function
(
stat
)
{
/* Send out a Chat Status Notification (XEP-0352) */
/* Send out a Chat Status Notification (XEP-0352) */
if
(
converse
.
features
[
Strophe
.
NS
.
CSI
]
||
true
)
{
if
(
converse
.
features
[
Strophe
.
NS
.
CSI
]
||
true
)
{
...
@@ -4723,9 +4727,9 @@
...
@@ -4723,9 +4727,9 @@
if
(
jid
)
{
if
(
jid
)
{
resource
=
Strophe
.
getResourceFromJid
(
jid
);
resource
=
Strophe
.
getResourceFromJid
(
jid
);
if
(
!
resource
)
{
if
(
!
resource
)
{
jid
=
jid
.
toLowerCase
()
+
'
/converse.js-
'
+
Math
.
floor
(
Math
.
random
()
*
139749825
).
toString
();
jid
=
jid
.
toLowerCase
()
+
converse
.
generateResource
();
}
else
{
}
else
{
jid
=
Strophe
.
getBareJidFromJid
(
jid
).
toLowerCase
()
+
'
/
'
+
Strophe
.
getResourceFromJid
(
jid
)
;
jid
=
Strophe
.
getBareJidFromJid
(
jid
).
toLowerCase
()
+
'
/
'
+
resource
;
}
}
}
}
converse
.
connection
.
connect
(
jid
,
password
,
converse
.
onConnectStatusChanged
);
converse
.
connection
.
connect
(
jid
,
password
,
converse
.
onConnectStatusChanged
);
...
@@ -4893,7 +4897,12 @@
...
@@ -4893,7 +4897,12 @@
throw
new
Error
(
"
initConnection: If you use auto_login and
"
+
throw
new
Error
(
"
initConnection: If you use auto_login and
"
+
"
authentication='login' then you also need to provide a password.
"
);
"
authentication='login' then you also need to provide a password.
"
);
}
}
this
.
jid
=
Strophe
.
getBareJidFromJid
(
this
.
jid
).
toLowerCase
()
+
'
/
'
+
Strophe
.
getResourceFromJid
(
this
.
jid
);
var
resource
=
Strophe
.
getResourceFromJid
(
this
.
jid
);
if
(
!
resource
)
{
this
.
jid
=
this
.
jid
.
toLowerCase
()
+
converse
.
generateResource
();
}
else
{
this
.
jid
=
Strophe
.
getBareJidFromJid
(
this
.
jid
).
toLowerCase
()
+
'
/
'
+
resource
;
}
this
.
connection
.
connect
(
this
.
jid
,
this
.
password
,
this
.
onConnectStatusChanged
);
this
.
connection
.
connect
(
this
.
jid
,
this
.
password
,
this
.
onConnectStatusChanged
);
}
}
}
}
...
...
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