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
b36d2f18
Commit
b36d2f18
authored
Apr 25, 2013
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for the BOSH bind URL as a setting parameter
parent
9d4d651d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
36 deletions
+39
-36
converse.js
converse.js
+38
-36
main.js
main.js
+1
-0
No files found.
converse.js
View file @
b36d2f18
...
...
@@ -1864,27 +1864,35 @@
'
<li><a class="current" href="#login">Sign in</a></li>
'
),
template
:
_
.
template
(
'
<form id="converse-login">
'
+
'
<label>XMPP
ID
:</label>
'
+
'
<label>XMPP
/Jabber Username
:</label>
'
+
'
<input type="text" id="jid">
'
+
'
<label>Password:</label>
'
+
'
<input type="password" id="password">
'
+
'
<label>BOSH Service URL:</label>
'
+
'
<input type="text" id="bosh_service_url">
'
+
'
<input type="submit" name="submit"/>
'
+
'
</form">
'
),
authenticate
:
function
(
ev
)
{
bosh_url_input
:
_
.
template
(
'
<label>BOSH Service URL:</label>
'
+
'
<input type="text" id="bosh_service_url">
'
),
authenticate
:
$
.
proxy
(
function
(
ev
)
{
ev
.
preventDefault
();
var
$form
=
$
(
ev
.
target
),
$bsu_input
=
$form
.
find
(
'
input#bosh_service_url
'
),
bosh_service_url
=
$bsu_input
.
val
(),
$jid_input
=
$form
.
find
(
'
input#jid
'
),
jid
=
$jid_input
.
val
(),
$pw_input
=
$form
.
find
(
'
input#password
'
),
password
=
$pw_input
.
val
(),
connection
=
new
Strophe
.
Connection
(
bosh_service_url
);
$bsu_input
=
null
,
errors
=
false
;
var
errors
=
false
;
if
(
!
this
.
bosh_service_url
)
{
$bsu_input
=
$form
.
find
(
'
input#bosh_service_url
'
);
this
.
bosh_service_url
=
$bsu_input
.
val
();
if
(
!
this
.
bosh_service_url
)
{
errors
=
true
;
$bsu_input
.
addClass
(
'
error
'
);
}
}
if
(
!
jid
)
{
errors
=
true
;
$jid_input
.
addClass
(
'
error
'
);
...
...
@@ -1893,43 +1901,38 @@
errors
=
true
;
$pw_input
.
addClass
(
'
error
'
);
}
if
(
!
bosh_service_url
)
{
errors
=
true
;
$bsu_input
.
addClass
(
'
error
'
);
}
if
(
errors
)
{
return
;
}
// Clear the form's fields, so that it can't be submitted twice
if
(
$bsu_input
)
{
$bsu_input
.
val
(
''
);
}
$jid_input
.
val
(
''
);
$pw_input
.
val
(
''
);
var
connection
=
new
Strophe
.
Connection
(
this
.
bosh_service_url
);
connection
.
connect
(
jid
,
password
,
$
.
proxy
(
function
(
status
)
{
if
(
status
===
Strophe
.
Status
.
CONNECTED
)
{
console
.
log
(
'
Connected
'
);
converse
.
onConnected
(
connection
);
this
.
onConnected
(
connection
);
}
else
if
(
status
===
Strophe
.
Status
.
DISCONNECTED
)
{
console
.
log
(
'
Disconnected
'
);
this
.
$feedback
.
text
(
'
Unable to communicate with chat server
'
).
css
(
'
background-image
'
,
"
url(images/error_icon.png)
"
);
this
.
giveFeedback
(
'
Disconnected
'
).
css
(
'
background-image
'
,
"
url(images/error_icon.png)
"
);
}
else
if
(
status
===
Strophe
.
Status
.
Error
)
{
console
.
log
(
'
Error
'
);
this
.
giveFeedback
(
'
Error
'
);
}
else
if
(
status
===
Strophe
.
Status
.
CONNECTING
)
{
console
.
log
(
'
Connecting
'
);
this
.
$feedback
.
text
(
'
Connecting to chat...
'
);
this
.
giveFeedback
(
'
Connecting
'
);
}
else
if
(
status
===
Strophe
.
Status
.
CONNFAIL
)
{
console
.
log
(
'
Connection Failed
'
);
this
.
giveFeedback
(
'
Connection Failed
'
);
}
else
if
(
status
===
Strophe
.
Status
.
AUTHENTICATING
)
{
console
.
log
(
'
Authenticating
'
);
converse
.
giveFeedback
(
'
Authenticating
'
);
this
.
giveFeedback
(
'
Authenticating
'
);
}
else
if
(
status
===
Strophe
.
Status
.
AUTHFAIL
)
{
console
.
log
(
'
Authenticating Failed
'
);
converse
.
giveFeedback
(
'
Authentication failed
'
);
this
.
giveFeedback
(
'
Authentication Failed
'
);
}
else
if
(
status
===
Strophe
.
Status
.
DISCONNECTING
)
{
console
.
log
(
'
Disconnecting
'
);
this
.
giveFeedback
(
'
Disconnecting
'
);
}
else
if
(
status
===
Strophe
.
Status
.
ATTACHED
)
{
console
.
log
(
'
Attached
'
);
}
},
this
));
},
},
converse
));
},
converse
),
remove
:
function
()
{
this
.
$parent
.
find
(
'
#controlbox-tabs
'
).
empty
();
...
...
@@ -1938,7 +1941,11 @@
render
:
function
()
{
this
.
$parent
.
find
(
'
#controlbox-tabs
'
).
append
(
this
.
tab_template
());
this
.
$parent
.
find
(
'
#controlbox-panes
'
).
append
(
this
.
$el
.
html
(
this
.
template
()));
template
=
this
.
template
();
if
(
!
this
.
bosh_url_input
)
{
template
.
find
(
'
form
'
).
append
(
this
.
bosh_url_input
);
}
this
.
$parent
.
find
(
'
#controlbox-panes
'
).
append
(
this
.
$el
.
html
(
template
));
return
this
;
}
});
...
...
@@ -1973,7 +1980,7 @@
};
converse
.
giveFeedback
=
function
(
message
)
{
$
(
'
.conn-feedback
'
).
text
(
message
);
return
$
(
'
.conn-feedback
'
).
text
(
message
);
}
converse
.
onConnected
=
function
(
connection
)
{
...
...
@@ -2028,12 +2035,7 @@
};
converse
.
initialize
=
function
(
settings
)
{
this
.
prebind
=
settings
.
prebind
;
this
.
fullname
=
settings
.
fullname
;
this
.
xhr_user_search
=
settings
.
xhr_user_search
;
this
.
auto_subscribe
=
settings
.
auto_subscribe
;
this
.
animate
=
settings
.
animate
;
_
.
extend
(
this
,
settings
);
this
.
chatboxes
=
new
this
.
ChatBoxes
();
this
.
chatboxesview
=
new
this
.
ChatBoxesView
({
model
:
this
.
chatboxes
});
$
(
'
a.toggle-online-users
'
).
bind
(
...
...
main.js
View file @
b36d2f18
require
([
"
jquery
"
,
"
converse
"
],
function
(
$
,
converse
)
{
converse
.
initialize
({
bosh_service_url
:
'
https://bind.opkode.im
'
,
prebind
:
false
,
xhr_user_search
:
false
,
auto_subscribe
:
false
...
...
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