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
848c13eb
Commit
848c13eb
authored
Apr 21, 2015
by
JC Brand
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into roster_refactor
Conflicts: dev.html
parents
f7a077a9
f002ab04
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
128 additions
and
16 deletions
+128
-16
converse.js
converse.js
+26
-10
dev.html
dev.html
+0
-2
docs/CHANGES.rst
docs/CHANGES.rst
+3
-2
docs/source/development.rst
docs/source/development.rst
+2
-2
spec/register.js
spec/register.js
+97
-0
No files found.
converse.js
View file @
848c13eb
...
...
@@ -3084,7 +3084,13 @@
var
contact_jid
,
$forwarded
,
$received
,
$sent
,
msgid
=
$message
.
attr
(
'
id
'
),
chatbox
,
resource
,
roster_item
,
message_from
=
$message
.
attr
(
'
from
'
);
message_from
=
$message
.
attr
(
'
from
'
),
message_to
=
$message
.
attr
(
'
to
'
);
if
(
!
_
.
contains
([
converse
.
connection
.
jid
,
converse
.
bare_jid
],
message_to
))
{
// Ignore messages sent to a different resource
return
true
;
}
if
(
message_from
===
converse
.
connection
.
jid
)
{
// FIXME: Forwarded messages should be sent to specific resources,
// not broadcasted
...
...
@@ -4106,7 +4112,7 @@
if
(
contact
.
showInRoster
())
{
if
(
this
.
model
.
get
(
'
state
'
)
===
CLOSED
)
{
if
(
view
.
$el
[
0
].
style
.
display
!==
"
none
"
)
{
view
.
$el
.
hide
();
}
if
(
this
.
$el
[
0
].
style
.
display
===
"
none
"
)
{
this
.
$el
.
show
();
}
if
(
!
this
.
$el
.
is
(
'
:visible
'
)
)
{
this
.
$el
.
show
();
}
}
else
{
if
(
this
.
$el
[
0
].
style
.
display
!==
"
block
"
)
{
this
.
show
();
}
}
...
...
@@ -4131,10 +4137,12 @@
},
show
:
function
()
{
// FIXME: There's a bug here, if show_only_online_users is true
// Possible solution, get the group, call _.each and check
// showInRoster
this
.
$el
.
nextUntil
(
'
dt
'
).
addBack
().
show
();
this
.
$el
.
show
();
_
.
each
(
this
.
getAll
(),
function
(
contactView
)
{
if
(
contactView
.
model
.
showInRoster
())
{
contactView
.
$el
.
show
();
}
});
},
hide
:
function
()
{
...
...
@@ -5179,11 +5187,19 @@
var
$inputs
=
$
(
ev
.
target
).
find
(
'
:input:not([type=button]):not([type=submit])
'
),
iq
=
$iq
({
type
:
"
set
"
})
.
c
(
"
query
"
,
{
xmlns
:
Strophe
.
NS
.
REGISTER
})
.
c
(
"
x
"
,
{
xmlns
:
Strophe
.
NS
.
XFORM
,
type
:
'
submit
'
});
$inputs
.
each
(
function
()
{
iq
.
cnode
(
utils
.
webForm2xForm
(
this
)).
up
();
});
if
(
this
.
form_type
==
'
xform
'
)
{
iq
.
c
(
"
x
"
,
{
xmlns
:
Strophe
.
NS
.
XFORM
,
type
:
'
submit
'
});
$inputs
.
each
(
function
()
{
iq
.
cnode
(
utils
.
webForm2xForm
(
this
)).
up
();
});
}
else
{
$inputs
.
each
(
function
()
{
var
$input
=
$
(
this
);
iq
.
c
(
$input
.
attr
(
'
name
'
),
{},
$input
.
val
());
});
}
converse
.
connection
.
_addSysHandler
(
this
.
_onRegisterIQ
.
bind
(
this
),
null
,
"
iq
"
,
null
,
null
);
converse
.
connection
.
send
(
iq
);
this
.
setFields
(
iq
.
tree
());
...
...
dev.html
View file @
848c13eb
...
...
@@ -52,8 +52,6 @@
<script>
require
([
'
converse
'
],
function
(
converse
)
{
converse
.
initialize
({
allow_registration
:
false
,
allow_logout
:
true
,
bosh_service_url
:
'
https://conversejs.org/http-bind/
'
,
// Please use this connection manager only for testing purposes
i18n
:
locales
[
'
en
'
],
// Refer to ./locale/locales.js to see which locales are supported
keepalive
:
true
,
...
...
docs/CHANGES.rst
View file @
848c13eb
...
...
@@ -6,6 +6,7 @@ Changelog
* Add the ability to log in anonymously. [jcbrand]
* Add the ability to log in automatically. [jcbrand]
* #374 Fix collapsed group visibility on page load. [floriancargoet]
0.9.2 (2015-04-09)
------------------
...
...
@@ -27,7 +28,7 @@ Changelog
* Set the JID input field in the login form to ``type=email``. [chatme]
* New configuration setting `allow_contact_removal <https://conversejs.org/docs/html/configuration.html#allow-contact-removal>`_ [jcbrand]
* Document that event handlers receive 'event' obj as first arg. [jcbrand]
* Add a test to check that notifications are played in chat rooms. [jcbrand]
* Add a test to check that notifications are played in chat rooms. [jcbrand]
* #333 Enable automatic reconnection when ``prebind`` and ``prebind_url`` are specified. [jcbrand]
* #339 Require the JID to be specified when using ``keepalive`` with ``prebind``. Also add a logout API method. [jcbrand]
* #349 Indicate visitors in chat rooms. [c143]
...
...
@@ -214,7 +215,7 @@ Changelog
to fetch the newest strophe.muc.plugin (for bugfix of #85).
This release contains 3 different builds:
- converse.min.js
- converse.min.js
- converse-no-otr.min.js (Without OTR encryption)
- converse-no-locales-no-otr.min.js (Without OTR encryption or any translations)
...
...
docs/source/development.rst
View file @
848c13eb
...
...
@@ -369,7 +369,7 @@ Similar to chats.get API
To open a single multi user chat box, provide the JID of the room::
converse.room.open('group@muc.example.com')
converse.room
s
.open('group@muc.example.com')
To return an array of chat boxes, provide an array of JIDs::
...
...
@@ -377,7 +377,7 @@ To return an array of chat boxes, provide an array of JIDs::
To setup a custom nickname when joining the room, provide the optionnal nick argument::
converse.room.open('group@muc.example.com', 'mycustomnick')
converse.room
s
.open('group@muc.example.com', 'mycustomnick')
"settings" grouping
...
...
spec/register.js
View file @
848c13eb
...
...
@@ -160,5 +160,102 @@
expect
(
registerview
.
$
(
'
input[type=button]
'
).
length
).
toBe
(
1
);
},
converse
));
it
(
"
will set form_type to legacy and submit it as legacy
"
,
$
.
proxy
(
function
()
{
var
cbview
=
this
.
chatboxviews
.
get
(
'
controlbox
'
);
cbview
.
$
(
'
#controlbox-tabs
'
).
find
(
'
li
'
).
last
().
find
(
'
a
'
).
click
();
// Click the Register tab
var
registerview
=
this
.
chatboxviews
.
get
(
'
controlbox
'
).
registerpanel
;
spyOn
(
registerview
,
'
onProviderChosen
'
).
andCallThrough
();
spyOn
(
registerview
,
'
getRegistrationFields
'
).
andCallThrough
();
spyOn
(
registerview
,
'
onRegistrationFields
'
).
andCallThrough
();
spyOn
(
registerview
,
'
renderRegistrationForm
'
).
andCallThrough
();
registerview
.
delegateEvents
();
// We need to rebind all events otherwise our spy won't be called
spyOn
(
this
.
connection
,
'
connect
'
).
andCallThrough
();
registerview
.
$
(
'
input[name=domain]
'
).
val
(
'
conversejs.org
'
);
registerview
.
$
(
'
input[type=submit]
'
).
click
();
var
stanza
=
new
Strophe
.
Builder
(
"
stream:features
"
,
{
'
xmlns:stream
'
:
"
http://etherx.jabber.org/streams
"
,
'
xmlns
'
:
"
jabber:client
"
})
.
c
(
'
register
'
,
{
xmlns
:
"
http://jabber.org/features/iq-register
"
}).
up
()
.
c
(
'
mechanisms
'
,
{
xmlns
:
"
urn:ietf:params:xml:ns:xmpp-sasl
"
});
this
.
connection
.
_connect_cb
(
test_utils
.
createRequest
(
stanza
));
stanza
=
$iq
({
'
type
'
:
'
result
'
,
'
id
'
:
'
reg1
'
}).
c
(
'
query
'
,
{
'
xmlns
'
:
'
jabber:iq:register
'
})
.
c
(
'
instructions
'
)
.
t
(
'
Please choose a username, password and provide your email address
'
).
up
()
.
c
(
'
username
'
).
up
()
.
c
(
'
password
'
).
up
()
.
c
(
'
email
'
);
this
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
expect
(
registerview
.
form_type
).
toBe
(
'
legacy
'
);
registerview
.
$
(
'
input[name=username]
'
).
val
(
'
testusername
'
);
registerview
.
$
(
'
input[name=password]
'
).
val
(
'
testpassword
'
);
registerview
.
$
(
'
input[name=email]
'
).
val
(
'
test@email.local
'
);
spyOn
(
converse
.
connection
,
'
send
'
);
registerview
.
$
(
'
input[type=submit]
'
).
click
();
expect
(
converse
.
connection
.
send
).
toHaveBeenCalled
();
var
$stanza
=
$
(
converse
.
connection
.
send
.
argsForCall
[
0
][
0
].
tree
());
expect
(
$stanza
.
children
(
'
query
'
).
children
().
length
).
toBe
(
3
);
expect
(
$stanza
.
children
(
'
query
'
).
children
()[
0
].
tagName
).
toBe
(
'
username
'
);
},
converse
));
it
(
"
will set form_type to xform and submit it as xform
"
,
$
.
proxy
(
function
()
{
var
cbview
=
this
.
chatboxviews
.
get
(
'
controlbox
'
);
cbview
.
$
(
'
#controlbox-tabs
'
).
find
(
'
li
'
).
last
().
find
(
'
a
'
).
click
();
// Click the Register tab
var
registerview
=
this
.
chatboxviews
.
get
(
'
controlbox
'
).
registerpanel
;
spyOn
(
registerview
,
'
onProviderChosen
'
).
andCallThrough
();
spyOn
(
registerview
,
'
getRegistrationFields
'
).
andCallThrough
();
spyOn
(
registerview
,
'
onRegistrationFields
'
).
andCallThrough
();
spyOn
(
registerview
,
'
renderRegistrationForm
'
).
andCallThrough
();
registerview
.
delegateEvents
();
// We need to rebind all events otherwise our spy won't be called
spyOn
(
this
.
connection
,
'
connect
'
).
andCallThrough
();
registerview
.
$
(
'
input[name=domain]
'
).
val
(
'
conversejs.org
'
);
registerview
.
$
(
'
input[type=submit]
'
).
click
();
var
stanza
=
new
Strophe
.
Builder
(
"
stream:features
"
,
{
'
xmlns:stream
'
:
"
http://etherx.jabber.org/streams
"
,
'
xmlns
'
:
"
jabber:client
"
})
.
c
(
'
register
'
,
{
xmlns
:
"
http://jabber.org/features/iq-register
"
}).
up
()
.
c
(
'
mechanisms
'
,
{
xmlns
:
"
urn:ietf:params:xml:ns:xmpp-sasl
"
});
this
.
connection
.
_connect_cb
(
test_utils
.
createRequest
(
stanza
));
stanza
=
$iq
({
'
type
'
:
'
result
'
,
'
id
'
:
'
reg1
'
}).
c
(
'
query
'
,
{
'
xmlns
'
:
'
jabber:iq:register
'
})
.
c
(
'
instructions
'
)
.
t
(
'
Using xform data
'
).
up
()
.
c
(
'
x
'
,
{
'
xmlns
'
:
'
jabber:x:data
'
,
'
type
'
:
'
form
'
})
.
c
(
'
instructions
'
).
t
(
'
xform instructions
'
).
up
()
.
c
(
'
field
'
,
{
'
type
'
:
'
text-single
'
,
'
var
'
:
'
username
'
}).
c
(
'
required
'
).
up
().
up
()
.
c
(
'
field
'
,
{
'
type
'
:
'
text-private
'
,
'
var
'
:
'
password
'
}).
c
(
'
required
'
).
up
().
up
()
.
c
(
'
field
'
,
{
'
type
'
:
'
text-single
'
,
'
var
'
:
'
email
'
}).
c
(
'
required
'
).
up
().
up
()
this
.
connection
.
_dataRecv
(
test_utils
.
createRequest
(
stanza
));
expect
(
registerview
.
form_type
).
toBe
(
'
xform
'
);
registerview
.
$
(
'
input[name=username]
'
).
val
(
'
testusername
'
);
registerview
.
$
(
'
input[name=password]
'
).
val
(
'
testpassword
'
);
registerview
.
$
(
'
input[name=email]
'
).
val
(
'
test@email.local
'
);
spyOn
(
converse
.
connection
,
'
send
'
);
registerview
.
$
(
'
input[type=submit]
'
).
click
();
expect
(
converse
.
connection
.
send
).
toHaveBeenCalled
();
var
$stanza
=
$
(
converse
.
connection
.
send
.
argsForCall
[
0
][
0
].
tree
());
expect
(
$stanza
.
children
(
'
query
'
).
children
().
length
).
toBe
(
1
);
expect
(
$stanza
.
children
(
'
query
'
).
children
().
children
().
length
).
toBe
(
3
);
expect
(
$stanza
.
children
(
'
query
'
).
children
().
children
()[
0
].
tagName
).
toBe
(
'
field
'
);
},
converse
));
},
converse
,
mock
,
test_utils
));
}));
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