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
b584f2ef
Commit
b584f2ef
authored
Mar 27, 2018
by
JC Brand
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a new config setting `nickname`
- for subscription requests - when entering chat rooms
parent
33540839
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
12 deletions
+25
-12
CHANGES.md
CHANGES.md
+1
-0
docs/source/configuration.rst
docs/source/configuration.rst
+9
-0
src/converse-core.js
src/converse-core.js
+13
-11
src/converse-muc-views.js
src/converse-muc-views.js
+1
-1
src/converse-muc.js
src/converse-muc.js
+1
-0
No files found.
CHANGES.md
View file @
b584f2ef
...
...
@@ -15,6 +15,7 @@ The UI is now based on Bootstrap4 and Flexbox is used extensively.
*
Removed
`xhr_user_search`
in favor of only accepting
`xhr_user_search_url`
as configuration option.
*
The data returned from the
`xhr_user_search_url`
must now include the user's
`jid`
instead of just an
`id`
.
-
New configuration setting
[
nickname
](
https://conversejs.org/docs/html/configurations.html#nickname
)
### Bugfixes
...
...
docs/source/configuration.rst
View file @
b584f2ef
...
...
@@ -992,6 +992,15 @@ muc_show_join_leave
Determines whether Converse.js will show info messages inside a chatroom
whenever a user joins or leaves it.
nickname
--------
* Default: ``undefined``
This setting allows you to specify the nickname for the current user.
The nickname will be included in presence requests to other users and will also
be used as the default nickname when entering MUC chatrooms.
notify_all_room_messages
------------------------
...
...
src/converse-core.js
View file @
b584f2ef
...
...
@@ -318,6 +318,7 @@
],
message_carbons
:
true
,
message_storage
:
'
session
'
,
nickname
:
undefined
,
password
:
undefined
,
prebind_url
:
null
,
priority
:
0
,
...
...
@@ -903,8 +904,8 @@
if
(
message
&&
message
!==
""
)
{
pres
.
c
(
"
status
"
).
t
(
message
).
up
();
}
const
nick
=
_converse
.
xmppstatus
.
get
(
'
fullname
'
);
if
(
nick
&&
nick
!==
""
)
{
const
nick
=
_converse
.
xmppstatus
.
get
(
'
nickname
'
)
||
_converse
.
xmppstatus
.
get
(
'
fullname
'
);
if
(
nick
)
{
pres
.
c
(
'
nick
'
,
{
'
xmlns
'
:
Strophe
.
NS
.
NICK
}).
t
(
nick
).
up
();
}
_converse
.
connection
.
send
(
pres
);
...
...
@@ -1131,8 +1132,7 @@
if
(
item
.
getAttribute
(
'
action
'
)
===
'
add
'
)
{
_converse
.
roster
.
addAndSubscribe
(
item
.
getAttribute
(
'
jid
'
),
null
,
_converse
.
xmppstatus
.
get
(
'
fullname
'
)
_converse
.
xmppstatus
.
get
(
'
nickname
'
)
||
_converse
.
xmppstatus
.
get
(
'
fullname
'
)
);
}
});
...
...
@@ -1159,7 +1159,7 @@
contact
.
subscribe
(
message
);
}
}
this
.
addContact
(
jid
,
name
,
groups
,
attributes
).
then
(
handler
,
handler
);
this
.
addContact
ToRoster
(
jid
,
name
,
groups
,
attributes
).
then
(
handler
,
handler
);
},
sendContactAddIQ
(
jid
,
name
,
groups
,
callback
,
errback
)
{
...
...
@@ -1180,7 +1180,7 @@
_converse
.
connection
.
sendIQ
(
iq
,
callback
,
errback
);
},
addContact
(
jid
,
name
,
groups
,
attributes
)
{
addContact
ToRoster
(
jid
,
name
,
groups
,
attributes
)
{
/* Adds a RosterContact instance to _converse.roster and
* registers the contact on the XMPP server.
* Returns a promise which is resolved once the XMPP server has
...
...
@@ -1216,7 +1216,7 @@
});
},
subscribeBack
(
bare_jid
)
{
subscribeBack
(
bare_jid
,
presence
)
{
const
contact
=
this
.
get
(
bare_jid
);
if
(
contact
instanceof
_converse
.
RosterContact
)
{
contact
.
authorize
().
subscribe
();
...
...
@@ -1227,7 +1227,8 @@
contact
.
authorize
().
subscribe
();
}
}
this
.
addContact
(
bare_jid
,
''
,
[],
{
'
subscription
'
:
'
from
'
}).
then
(
handler
,
handler
);
const
nickname
=
_
.
get
(
sizzle
(
`nick[xmlns="
${
Strophe
.
NS
.
NICK
}
"]`
,
presence
).
pop
(),
'
textContent
'
,
null
);
this
.
addContactToRoster
(
bare_jid
,
nickname
,
[],
{
'
subscription
'
:
'
from
'
}).
then
(
handler
,
handler
);
}
},
...
...
@@ -1340,13 +1341,13 @@
* Note: this method gets completely overridden by converse-vcard.js
*/
const
bare_jid
=
Strophe
.
getBareJidFromJid
(
presence
.
getAttribute
(
'
from
'
)),
nick
_el
=
presence
.
querySelector
(
`nick[xmlns="
${
Strophe
.
NS
.
NICK
}
"]`
);
nick
name
=
_
.
get
(
sizzle
(
`nick[xmlns="
${
Strophe
.
NS
.
NICK
}
"]`
,
presence
).
pop
(),
'
textContent
'
,
null
);
const
user_data
=
{
'
jid
'
:
bare_jid
,
'
subscription
'
:
'
none
'
,
'
ask
'
:
null
,
'
requesting
'
:
true
,
'
fullname
'
:
nick
_el
&&
nick_el
.
textContent
||
bare_jid
,
'
fullname
'
:
nick
name
};
this
.
create
(
user_data
);
_converse
.
emit
(
'
contactRequest
'
,
user_data
);
...
...
@@ -1365,7 +1366,7 @@
}
if
(
_converse
.
auto_subscribe
)
{
if
((
!
contact
)
||
(
contact
.
get
(
'
subscription
'
)
!==
'
to
'
))
{
this
.
subscribeBack
(
bare_jid
);
this
.
subscribeBack
(
bare_jid
,
presence
);
}
else
{
contact
.
authorize
();
}
...
...
@@ -1485,6 +1486,7 @@
return
{
"
status
"
:
_converse
.
default_state
,
"
jid
"
:
_converse
.
bare_jid
,
"
nickname
"
:
_converse
.
nickname
,
"
vcard_updated
"
:
null
}
},
...
...
src/converse-muc-views.js
View file @
b584f2ef
...
...
@@ -114,7 +114,7 @@
if
(
!
this
.
roomspanel
.
model
.
get
(
'
nick
'
))
{
this
.
roomspanel
.
model
.
save
({
nick
:
Strophe
.
getNodeFromJid
(
_converse
.
bare_jid
)
nick
:
_converse
.
xmppstatus
.
get
(
'
nickname
'
)
||
Strophe
.
getNodeFromJid
(
_converse
.
bare_jid
)
});
}
_converse
.
emit
(
'
roomsPanelRendered
'
);
...
...
src/converse-muc.js
View file @
b584f2ef
...
...
@@ -264,6 +264,7 @@
'
affiliation
'
:
null
,
'
connection_status
'
:
converse
.
ROOMSTATUS
.
DISCONNECTED
,
'
name
'
:
''
,
'
nick
'
:
_converse
.
xmppstatus
.
get
(
'
nickname
'
),
'
description
'
:
''
,
'
features_fetched
'
:
false
,
'
roomconfig
'
:
{},
...
...
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