Commit Graph

149 Commits

Author SHA1 Message Date
JC Brand
e63607227d Escape interpolated values. Updates #779 2017-02-14 07:28:04 +01:00
JC Brand
f73a1d3fc0 Don't name the modules.
According to the require.js docs this shouldn't be done.
http://requirejs.org/docs/whyamd.html#namedmodules
2017-02-13 14:37:17 +00:00
JC Brand
85f6a75fed Escape user-generated input to avoid injection attacks 2017-02-13 13:41:37 +00:00
JC Brand
63888dd454 Fix failing tests 2017-02-02 21:55:05 +00:00
JC Brand
0424df9edc Rename the closured converse object to _converse
to indicate that it's private and to differentiate it from the outer "global"
converse object.
2017-02-02 20:43:48 +00:00
JC Brand
83feebb229 Two plugins changes
- Remove the `plugins.remove` API method.
- Throw an error when attempting to register multiple plugins with the same name.
2017-02-02 18:54:15 +00:00
JC Brand
9b48b2d6bd Update plugins to not depend on converse-core
To illustrate that this is not necessary (and also not possible with
non-bundled plugins).
2017-02-02 18:34:13 +00:00
JC Brand
b701c4830f Also use _converse as pluggable object reference. 2017-02-02 18:34:13 +00:00
JC Brand
b7b9711296 Rename the closured converse object to _converse
to indicate that it's private and to differentiate it from the outer "global"
converse object.
2017-02-02 18:34:13 +00:00
JC Brand
4dcb855562 Split API into public and private (plugin only) parts. 2017-02-02 18:30:59 +00:00
JC Brand
77f93a6471 Some initial work on removing jQuery 2017-02-02 18:30:08 +00:00
JC Brand
bcbeb8da6c Case-insensitive matching of moderation commands.
Also add `/subject` as alias to `/topic`
2017-02-02 14:56:56 +01:00
JC Brand
081f075aa9 Add eslint with lodash checking and apply its suggestions 2017-02-01 14:02:18 +01:00
JC Brand
c16dac1453 Rather don't expect join to always return the right context. 2016-12-09 19:15:16 +00:00
JC Brand
0bcf61389f Work around a Prosody bug.
Prosody doesn't handle it if we set the affiliation for multiple JIDs in one
stanza, so we need to send a stanza for each JID.

Refs https://prosody.im/issues/issue/795
2016-12-09 19:11:16 +00:00
JC Brand
37df4ad18c Bugfix. Need to return this. 2016-12-08 14:23:17 +01:00
JC Brand
b2240cfe94 Use $.when to keep track of all outgoing promises
Now that we are sending multiple IQ stanzas when setting affiliations.
We now again have a sendAffiliation method, so we use that.
2016-12-08 07:34:01 +00:00
JC Brand
f5fbf71275 New config setting: muc_disable_moderator_commands 2016-12-07 13:48:47 +00:00
JC Brand
636f02109d Various fixes in the delta algorithm 2016-12-07 13:02:03 +00:00
JC Brand
993c8f1695 We need to send out a separate IQ stanza for each affiliation
At least for Prosody.
2016-12-07 12:43:41 +00:00
JC Brand
54371f0e7d Remove setAffiliation and use the more general purpose setAffiliations 2016-12-07 11:45:51 +00:00
JC Brand
77d3e64f42 Specify the reason (if given) when setting someone's affiliation
This changed required me to go back to an array of maps instead of a single map
to store jids and affiliations.
2016-12-07 11:45:51 +00:00
JC Brand
b516ae51e7 Move code into separate function. 2016-12-07 10:34:02 +00:00
JC Brand
802c9d1f02 Make it configurable how the affiliations delta is computed.
When inviting someone to a members-only room, you only want to add an
affiliation of 'member' if they don't already have any other affiliation.

So we need to ignore the "new" member if they're already on *any* of the lists.
2016-12-06 20:04:08 +00:00
JC Brand
58f07cf115 Change the data structures representing members
Make the delta algorithm simpler. Fixed some delta bugs in the process.
2016-12-06 19:39:16 +00:00
JC Brand
c6767bcdaa Refactor to send out 3 affiliation request stanzas.
One for each affiliation (member, owner, admin).

Unfortunately Prosody doesn't give you correct results if you query for all
three affiliations in one stanza.

We'll have to see whether setting all three in one stanza actually works.
2016-12-06 18:34:54 +00:00
JC Brand
6c725409c2 converse-muc: Only send the delta when setting the member list.
As required by XEP-0045.

This requires that we first fetch the existing member list, compute the delta
and then send that if there is one.
2016-12-06 15:18:33 +00:00
JC Brand
cf42911754 converse-muc: rename wrapping function again and put on converse
So that it can be overridden.
2016-12-05 18:31:58 +00:00
JC Brand
376c50fbc8 When inviting to a members-only room, first add to user to the member-list 2016-12-05 15:06:20 +00:00
JC Brand
088eb03b54 Immediately hide chat room on close.
Also, use sendPresence from latest strophe so that we have a timeout in case a
responding presence never comes.
2016-12-05 10:49:51 +00:00
JC Brand
7ad39cfdb9 Fetch the room information before opening the room. 2016-12-05 06:07:01 +00:00
JC Brand
5b944f9e5f Fixes #737: translations weren't being applied. 2016-12-04 16:53:35 +00:00
JC Brand
81e3cb976c converse-muc: Show a spinner while fetching the config form 2016-12-04 15:11:09 +00:00
JC Brand
fd40f24710 converse-muc: Don't delete reference, can cause attribute error 2016-12-04 15:08:02 +00:00
JC Brand
be25c688ff converse-controlbox: Use event listeners instead of (removed) overrides
Due to changes in `converse-core` the controlbox wasn't aware anymore of
disconnection or reconnection events.
2016-12-04 15:07:46 +00:00
JC Brand
2a81d2e6f3 converse-mam: Don't fetch MAM messages on each page load. 2016-12-04 14:45:36 +00:00
JC Brand
ec91175a70 converse-muc: Don't send a join presence at every page reload.
Instead, keep track of the connection state of the room and send a presence
only when the room's connection was disrupted.
2016-12-04 14:41:03 +01:00
JC Brand
d7892d942c converse-muc: Bugfix.
Switching from bookmarks form to config form shows only spinner.
2016-12-04 14:40:55 +01:00
JC Brand
4026248c68 converse-muc: Fixes concerning room occupants.
- Fixed a sessionStorage caching bug caused by putting the nickname (which is
  liable to change) in the cache key.
- Clear the occupants sessionStorage when closing a chat room.
2016-12-04 14:40:43 +01:00
JC Brand
69e2068241 converse-muc: Remove unused promises
Now that we cache disco info and not the room configuration.
2016-12-04 14:40:40 +01:00
JC Brand
81879bc070 converse-muc: Cache the room disco information
Instead of the room configuration.
This is because non-owners have access to the former, but not the latter.
2016-12-04 14:40:28 +01:00
JC Brand
0f4efac084 converse-muc: Docstrings. 2016-12-04 14:40:25 +01:00
JC Brand
fbf2e56be4 converse-muc: Cache the room configuration on the Backbone.Model object 2016-12-04 14:40:20 +01:00
JC Brand
6379676cff converse-muc: Rename _transform to getWrappedChatBox. 2016-12-04 14:40:13 +01:00
JC Brand
5e1b094881 Expand upon rooms.open testcase to test configuration 2016-12-02 21:35:56 +01:00
JC Brand
910e9bddcd Refactoring in MUC
What started as an attempt to fix a bug in parseXUserElement, turned into
another large refactoring of MUC code, and it's not clear how to break this up
into multiple atomic commits. So I'm just pushing it all.

At least there are two new tests added to the suite.
2016-12-02 18:41:05 +01:00
JC Brand
a3bc7a18e5 Fixes #735. Querying by attribute returns empty list 2016-11-30 18:47:29 +01:00
JC Brand
9edc97101b Don't maximize minimized rooms when calling rooms.open 2016-11-30 11:03:28 +01:00
JC Brand
1b434dbe81 Updates #723 and #734.
`converse.rooms.open` ignored the `muc_nickname_from_jid` setting.
2016-11-24 09:25:06 +01:00
JC Brand
a5f76abcf1 Updates #729. Minimized chat boxes don't stay hidden
Bug got introduced during fix for #677

Eventually had to do a significant refactoring, to more consistently use the
`hidden` class instead of `display: None`. (relevant for #695)
2016-11-22 17:42:58 +01:00