Commit Graph

399 Commits

Author SHA1 Message Date
Christophe Romain af0a493c66 Merge pull request #1253 from Amuhar/xep0356 2016-09-07 14:34:31 +02:00
Holger Weiss 91e26fbf7a Add user's JID to CSI hook arguments
Add the JID of the CSI user to the arguments of the 'csi_filter_stanza'
and 'csi_flush_queue' hooks.
2016-08-05 23:47:18 +02:00
Holger Weiss c2ef55a075 Cosmetic change: Set CSI state 'active' on resume
The CSI state is always set to 'active' when a stream management session
is resumed; so there's no need to apply the CSI state of the old c2s
process, first.
2016-08-05 20:09:52 +02:00
Holger Weiss 78fa9e08a5 XEP-0198: Handle timeouts during stream resumption
If session resumption failed because requesting the #state from the old
c2s process took too long, the new c2s process will usually receive the
response.  Let the new process handle that case gracefully.
2016-08-03 02:28:46 +02:00
Holger Weiss 3c1e4f0dfd XEP-0198: Increase timeout for stream resumption
During stream resumption, the #state is transferred from the old c2s
process to the new one.  This is usually very fast, but under certain
conditions, it can take longer than five seconds.
2016-08-03 02:15:15 +02:00
Paweł Chmielowski fd365b2893 Display data that is send to websocket connection in debug log level
This should help with detecting problems like in #1097
2016-07-28 16:20:28 +02:00
Holger Weiss 4b0d71d402 Don't return error for blocked MUC PMs
If a message stanza is blocked as per XEP-0016 or XEP-0191 and the
stanza is marked as a private MUC message, don't return an error.  This
makes sure users won't be kicked from MUC rooms when blocking other
participants.
2016-07-24 20:55:11 +02:00
Holger Weiss d4d1941133 XEP-0198: Log debug message when dropping stanza
Log a debug message when an unacknowledged message is neither resent nor
bounced because it's archived.
2016-07-23 01:23:24 +02:00
Holger Weiss 749033598d Omit [info] message with number of queued stanzas
Just log a debug message if a stream management session times out and
some stanzas weren't acknowledged.
2016-07-10 22:21:57 +02:00
Paweł Chmielowski 3446aba753 Include correct version in stream:stream when reporting errors
This fixes issue #1174
2016-06-27 16:40:57 +02:00
Holger Weiss c928956d73 XEP-0198: Apply cosmetic changes 2016-06-21 23:17:17 +02:00
Holger Weiss 7ddeac38b6 XEP-0198: Also count stanzas when socket is closed
Don't forget to count stanzas received from the stream management client
that are processed right after the connection was lost.
2016-06-21 22:54:41 +02:00
Paweł Chmielowski 3a8da27d86 Use {access,shaper}_rules_validator in other places where access rules are used 2016-06-21 13:18:24 +02:00
Holger Weiss c91c5aa352 Fix handling of queued stanzas on session timeout
Don't fail to resend or bounce unacknowledged stanzas if the stream
management session timed out.

Closes #1160.
2016-06-19 23:32:15 +02:00
Paweł Chmielowski fffae97940 Use acl:access_matches in c2s 2016-05-26 11:08:53 +02:00
Holger Weiss 30e814dd4b XEP-0198: Add 'h' attribute to <failed/> element
If a resume request is rejected because the session timed out, indicate
the number of handled stanzas as per version 1.5 of XEP-0198.
2016-05-24 22:20:58 +02:00
Holger Weiss ba74c1c367 Move CSI queue handling into mod_client_state
Let mod_client_state handle the queueing of stanzas, not just their
classification.  This simplifies the ejabberd_c2s code and gives
(custom) CSI modules more flexibility.
2016-05-17 19:27:18 +02:00
Evgeniy Khramtsov be2a9e35ae Fix C2S session data leak (#1078) 2016-05-09 14:18:47 +03:00
Holger Weiss ff4a0e1808 XEP-0198: Use different error message for bounces
When stanzas are bounced from the stream management queue (because the
session timed out or was closed for some other reason), use a different
error message so that this situation can be distinguished from other
cases.
2016-05-06 14:12:22 +02:00
Holger Weiss 36164d9446 Return error when blocking last activity request
As per XEP-0016 and XEP-0191, return a service-unavailable error when an
incoming last activity query was blocked by a privacy list (just as we
do for other IQ requests).
2016-04-25 09:33:47 +02:00
Holger Weiss 58478e52bf Don't omit bounces for messages of type "result" 2016-04-24 22:47:53 +02:00
Paweł Chmielowski 86dfbe6ece Make sure that ejabberd_sm sid are unique 2016-04-08 10:52:29 +02:00
Evgeniy Khramtsov b83ec483e9 Send stream trailer at the very end 2016-04-08 11:49:50 +03:00
Evgeniy Khramtsov fced8dc3d9 Replace some ?ERR_* macros with ?ERRT_* 2016-03-31 11:00:29 +03:00
Evgeniy Khramtsov 46568fb959 Merge commit 'refs/pull/524/head' of github.com:processone/ejabberd into sasl-api-change 2016-03-25 18:16:50 +03:00
Paweł Chmielowski ef02053a9d Fix issue #1015 2016-03-17 18:41:39 +01:00
Paweł Chmielowski efbaba5d04 Make auto generated resources shorter 2016-03-16 11:30:45 +01:00
Balázs Galambosi 83accedded fix syntax highlighting by keeping "~s" together 2016-03-07 16:06:18 +01:00
Holger Weiss 5b4aefbacd Accept stream compression request after SASL
This is an updated version of the patch submitted to EJAB-1382 by
Alexey (thanks!).
2016-02-19 18:53:28 +01:00
Evgeniy Khramtsov 4839ba5ae4 XEP-0013: Flexible Offline Message Retrieval support 2016-02-09 17:59:54 +03:00
Holger Weiss a31f59ea31 XEP-0198: Fix session timeout corner case
If the "resend_on_timeout" option is set to 'if_offline' and a pending
stream management session is terminated because a new session is opened
by the same resource (while no other resource is online), resend
unacknowledged messages rather than bouncing error messages.
2016-02-06 22:28:55 +01:00
Pablo Polvorin 942072cf9d Make hibernate timeouts configurable
Two *global* options added:
c2s_hibernate and receiver_hibernate.

Default if not specified is 90000, the previous hardcoded value.
2016-02-04 15:45:29 -03:00
Mickael Remond dfc29ea03c Switch to Fast XML module 2016-02-03 19:03:17 +01:00
Mickael Remond 71ee0d56fa Switch to fast_tls and update app names 2016-02-03 16:13:16 +01:00
Alexey Shchepin a150bf8fdc Make C2S session establishment optional (ECS-11) 2016-01-18 16:33:57 +03:00
Holger Weiss ddaa409ee2 XEP-0198: Let MAM take care of pending messages
If a stream management session times out for a user who appears to be
using MAM, drop any unacknowledged messages rather than resending or
bouncing them.  This avoids duplicates or bogus error messages.

However, this is only done if the new mod_mam option "assume_mam_usage"
is set to 'if_enabled' or 'on_request'.  In the former case, a user is
assumed to be using MAM if archiving is enabled for his account.  In the
latter case, MAM usage is assumed only if archiving was explicitly
requested by the client, or if archiving was enabled by means of
mod_mam's "request_activates_archiving" option.
2016-01-15 01:08:22 +01:00
Badlop f448ff608a Update copyright to 2016 (#901) 2016-01-13 12:29:14 +01:00
Holger Wei 64d96778b4 Don't return error for blocked MUC messages
If a message stanza is blocked as per XEP-0016 or XEP-0191, return an
error only if the type of the blocked message is "normal" or "chat".
This makes sure users won't be kicked from MUC rooms when blocking other
participants.

Closes #897.
2016-01-12 10:20:35 +01:00
Paweł Chmielowski 29db302808 More now() replacements 2015-12-07 16:09:48 +01:00
Holger Weiss ba916c3162 XEP-0198: Fix stanza counting corner case issue
Don't forget to count outgoing stanzas that are processed while the
ejabberd_c2s process is already waiting for stream resumption.
2015-12-02 19:25:10 +01:00
Evgeniy Khramtsov 95265dd3ad Move JID related functions to jid.erl (#847) 2015-11-24 18:44:13 +03:00
Christophe Romain 341be9b682 Remove supervisor option, disable it for c2s and muc 2015-11-04 16:24:35 +01:00
Holger Weiss 5e467b96a1 ejabberd_c2s: Let stop/1 close XEP-0198 sessions
The stop/1 function now terminates stream management sessions
immediately, just as it does for other sessions.  The new
ejabberd_c2s:close/1 function can be used to close the socket without
terminating the stream management session, like stop/1 did before.
2015-10-17 23:15:31 +02:00
Holger Weiss 53bd0ee818 ejabberd_c2s: Close socket when waiting for resume
Make sure the socket is closed when mod_ping calls ejabberd_c2s:stop/1
for an XEP-0198 session.
2015-10-17 22:07:29 +02:00
Christophe Romain 6aeb9dcb38 cosmetic cleanup 2015-10-07 14:18:38 +02:00
Evgeniy Khramtsov c7750689e8 Fix force_update_presence 2015-10-02 16:06:47 +02:00
Holger Weiss 59321ac56e XEP-0198: Improve handling of non-message stanzas
When an XEP-0198 session times out, always return an error for
unacknowledged IQ stanzas, and always drop presence stanzas.  That is,
the "resend_on_timeout" option no longer applies to those stanzas types,
but only to messages.
2015-09-15 22:42:22 +02:00
Holger Weiss 5095fdb6b0 New XEP-0198 option: "max_resume_timeout"
In the past, the "resume_timeout" option defined both the default resume
timeout and the maximum resume timeout clients are permitted to request.
Admins might want to allow clients to request a timeout value that's
larger than the default, though.  This can now be done by specifying the
"max_resume_timeout" option.
2015-09-03 21:20:15 +02:00
Holger Weiss 1048e21643 XEP-0198: Don't add <delay/> tags to IQ stanzas 2015-07-28 21:00:12 +02:00
Paweł Chmielowski 8df134e025 Don't crash web admin when displaying info about websocket using users 2015-07-22 11:54:11 +02:00