Commit Graph

240 Commits

Author SHA1 Message Date
Evgeniy Khramtsov 01a2c9fe12 Add type specs for Module:opt_type/1 2017-05-08 12:59:28 +03:00
Evgeniy Khramtsov b82b93f8f0 Don't validate an option in ejabberd_config:get_option() functions
The commit introduces the following changes:
* Now there is no need to pass validating function in
  ejabberd_config:get_option() functions, because the configuration
  keeps already validated values.
* New function ejabberd_config:get_option/1 is introduced
* Function ejabberd_config:get_option/3 is deprecated. If the function
  is still called, the second argument (validating function) is simply
  ignored.
* The second argument for ejabberd_config:get_option/2 is now
  a default value, not a validating function.
2017-04-29 11:39:40 +03:00
Evgeniy Khramtsov 0a7eb33772 Better process session close 2017-04-14 20:41:25 +03:00
Evgeniy Khramtsov e40baf0bda Use cache in front of Redis/SQL RAM backends 2017-04-14 13:57:52 +03:00
Christophe Romain cf784772c9 Merge pull request #1664 from weiss/fix-routing
Fix routing of groupchat and headline messages
2017-04-07 15:10:26 +02:00
Holger Weiss 179e8934cf ejabberd_sm: Fix routing of headline messages
As per RFC 6121, silently drop headline messages sent to the bare JID of
an offline user or to the full JID of an unavailable resource.
2017-04-05 21:03:13 +02:00
Holger Weiss 8bfb6fdd4e ejabberd_sm: Fix routing of groupchat messages
As per RFC 6121, don't (re)route groupchat messages sent to a bare JID
or to an unavailable resource.
2017-04-05 20:41:10 +02:00
Holger Weiss 89f81c89da ejabberd_sm: Fix typo in debug message 2017-04-05 20:23:28 +02:00
Evgeniy Khramtsov 6fa55e7c38 Set 'read_concurrency' for some ETS tables 2017-04-05 15:10:18 +03:00
Evgeniy Khramtsov c1439ddd5b Get rid of jid:to_string/1 and jid:from_string/1 2017-02-26 10:07:12 +03:00
Evgeniy Khramtsov 603ec9cb19 Don't pass empty resource to jid:make() 2017-02-25 10:01:01 +03:00
Evgeniy Khramtsov c15d230a57 Return ejabberd_sm:stop/0 back 2017-02-24 12:39:44 +03:00
Evgeniy Khramtsov 67d6ca9f10 Improve startup procedure 2017-02-24 12:05:47 +03:00
Holger Weiss b475df2250 Include stanza ID with archived offline messages
Fixes #1480.
2017-02-23 16:55:35 +01:00
Evgeniy Khramtsov 7d68112265 Start/stop virtual hosts when reloading configuration file 2017-02-23 10:12:19 +03:00
Evgeniy Khramtsov 940ca9311d Fix some dialyzer warnings 2017-02-18 09:36:27 +03:00
Evgeniy Khramtsov 8b2d308498 Change routing API
Now 'From' and 'To' arguments must be omitted in functions
and structures related to routing.
The commit deprecates the following functions:
     ejabberd_router:route/3 in favor of ejabberd_router:route/1
     ejabberd_router:route_error/4 in favor of ejabberd_router:route_error/2
     ejabberd_local:route_iq/4 in favor of ejabberd_local:route_iq/2
     ejabberd_local:route_iq/5 in favor of ejabberd_local:route_iq/3
The format of {route, From, To, Packet} is changed in favor of {route, Packet}
2017-02-16 11:10:24 +03:00
Evgeniy Khramtsov f61c933a7a Only use GEN_SERVER macro where appropriate 2017-02-14 15:39:57 +03:00
Evgeniy Khramtsov f664e39374 Improve modules start/stop procedures 2017-02-14 10:25:08 +03:00
Evgeniy Khramtsov e1ba499bd6 Check result of gen_mod:start/2 callback (#1534) 2017-02-13 11:11:41 +03:00
Evgeniy Khramtsov 99fd621aed Speedup features list when a lot of virtual hosts configured 2017-01-24 10:38:29 +03:00
Evgeniy Khramtsov e564f9ae31 Make a message is not bounced if it's archived 2017-01-21 13:47:47 +03:00
Evgeniy Khramtsov d5d906184f Merge branch 'new_stream'
Conflicts:
	src/cyrsasl.erl
	src/ejabberd_c2s.erl
	src/ejabberd_cluster.erl
	src/ejabberd_frontend_socket.erl
	src/ejabberd_node_groups.erl
	src/ejabberd_router.erl
	src/mod_bosh.erl
	src/mod_ip_blacklist.erl
	src/mod_muc_mnesia.erl
	src/mod_offline.erl
	src/mod_proxy65_sm.erl
2017-01-20 19:35:46 +03:00
Evgeniy Khramtsov 0baaad30b1 Implement database backend interface for MUC, BOSH and auth_anonyous 2017-01-13 12:03:39 +03:00
Evgeniy Khramtsov 02f96d0f41 Implement database backend interface for ejabberd_router 2017-01-11 16:25:43 +03:00
Evgeniy Khramtsov 1e55e018e5 Adopt remaining code to support new hooks 2017-01-09 17:02:17 +03:00
Badlop 5fdd1c39fe Update copyright date automatically (#1442) 2017-01-02 21:42:06 +01:00
Evgeniy Khramtsov e7fe4dc474 More refactoring on session management 2016-12-30 00:00:36 +03:00
Evgeniy Khramtsov 309bdfbe28 Add xmpp_stream_out behaviour and rewrite s2s/SM code 2016-12-28 09:47:11 +03:00
Evgeniy Khramtsov 5cc8e807df Initial version of new XMPP stream behaviour (for review) 2016-12-11 15:03:37 +03:00
Evgeniy Khramtsov ca1b22bdd4 Use ejabberd_router:route_error/4 wherever possible 2016-11-25 11:41:24 +03:00
Holger Weiss 560038c808 Use xmpp:put_meta/3 to update metadata 2016-11-24 10:47:26 +01:00
Holger Weiss 114ca786ee Let ejabberd_sm mark copied messages
When multiple resources have the same (highest) priority, ejabberd_sm
dispatches messages addressed to the bare JID (or to an unavailable
resource) to each of these resources.  Such messages are now marked with
an 'sm_copy' flag for all but one of the resources.  This makes it
easier for other modules to identify those duplicates.

Resolves #1356.
2016-11-22 19:25:20 +01:00
Evgeniy Khramtsov 78a44e0176 Merge branch 'master' into xml-ng
Conflicts:
	src/adhoc.erl
	src/cyrsasl_oauth.erl
	src/ejabberd_c2s.erl
	src/ejabberd_config.erl
	src/ejabberd_service.erl
	src/gen_mod.erl
	src/mod_admin_extra.erl
	src/mod_announce.erl
	src/mod_carboncopy.erl
	src/mod_client_state.erl
	src/mod_configure.erl
	src/mod_echo.erl
	src/mod_mam.erl
	src/mod_muc.erl
	src/mod_muc_room.erl
	src/mod_offline.erl
	src/mod_pubsub.erl
	src/mod_stats.erl
	src/node_flat_sql.erl
	src/randoms.erl
2016-11-12 13:27:15 +03:00
Evgeniy Khramtsov e841a6ec34 Add more tests for offline storage 2016-11-08 15:15:19 +03:00
Evgeniy Khramtsov 56c91d3c58 Add roster tests 2016-11-07 10:10:57 +03:00
Holger Weiss 9cee3760db ejabberd_sm: Clean up old offline session entries
If the number of offline sessions exceeds the 'max_user_sessions' limit,
remove the oldest entry from the table.
2016-10-02 22:01:03 +02:00
Evgeniy Khramtsov 31faa4eb9a Add more type specs 2016-08-12 13:17:42 +03:00
Evgeniy Khramtsov 522a186a38 Improve some type specs 2016-08-09 10:56:32 +03:00
Evgeniy Khramtsov 23858469b7 Get rid of "jlib.hrl" dependency in some files 2016-07-26 11:29:17 +03:00
Holger Weiss 814b80c644 Preserve PID for offline sessions
Don't set the PID to 'undefined' when a session goes offline, as this
looses the information which node created the session table entry.

Fixes #1196.
2016-07-23 01:08:05 +02:00
Evgeniy Khramtsov 9a8e197d7e Initial version based on XML generator 2016-07-18 15:01:32 +03: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 d6700bdc5b Merge remote-tracking branch 'processone/pr/1088'
* processone/pr/1088:
  Process messages of unknown type consistently
2016-05-05 00:20:15 +02:00
Holger Weiss 6da07d78b5 Merge remote-tracking branch 'processone/pr/1086'
* processone/pr/1086:
  Return error when blocking message to offline user
2016-05-02 21:08:06 +02:00
Evgeniy Khramtsov 9c369b7a8c Improve detection of databases supported by modules (#1092) 2016-04-27 17:10:50 +03:00
Holger Weiss 45321fa2e2 Process messages of unknown type consistently
If an incoming message sent to an unavailable resource has an unknown
type, handle it like messages of type "normal" (as mandated by RFC 6121,
section 5.2.2).  The same is already done for messages of unknown type
sent to the bare JID of an offline user.
2016-04-25 01:13:41 +02:00
Holger Weiss 65ad70d7dc Fix error text for message bounces 2016-04-25 00:53:48 +02:00
Holger Weiss a37cf33358 Drop headline messages sent to offline resources
Don't bounce an error when a message of type "headline" is sent to an
unavailable resource.  This is consistent with how headline messages
sent to the bare JID of an offline user are dropped, and it avoids a
presence leak.
2016-04-25 00:02:12 +02:00
Holger Weiss cebdfb6523 Return error when blocking message to offline user
As per XEP-0016 and XEP-0191, return a service-unavailable error when an
incoming message sent to an offline user was blocked by a privacy list.
The same is done for a message sent to an online user, so this avoids a
presence leak.
2016-04-24 22:00:15 +02:00
Evgeniy Khramtsov 1aae8a9fda Rename odbc to sql everywhere 2016-04-20 13:25:42 +03:00
Evgeniy Khramtsov fafeeb80c2 Rename ejabberd_sm_odbc -> ejabberd_sm_sql 2016-04-20 09:11:02 +03:00
Paweł Chmielowski 86dfbe6ece Make sure that ejabberd_sm sid are unique 2016-04-08 10:52:29 +02:00
Evgeniy Khramtsov fced8dc3d9 Replace some ?ERR_* macros with ?ERRT_* 2016-03-31 11:00:29 +03:00
Evgeniy Khramtsov b5121a346d Experimental MIX (XEP-0369) support 2016-03-08 20:04:29 +03:00
Evgeniy Khramtsov 4b0860e7de Make it possible to define 'sm_db_type' per virtual host 2016-02-19 16:38:43 +03:00
Mickael Remond dfc29ea03c Switch to Fast XML module 2016-02-03 19:03:17 +01:00
Paweł Chmielowski bdeb4a7e32 Add a way to get all ejabberd_commands, not only those that was registered
This is part of (TECH-1828).
2016-01-26 10:00:28 +01:00
Badlop f448ff608a Update copyright to 2016 (#901) 2016-01-13 12:29:14 +01:00
Evgeniy Khramtsov 95265dd3ad Move JID related functions to jid.erl (#847) 2015-11-24 18:44:13 +03: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
Alexey Shchepin cf975da8f2 Update several commands for recent ejabberd_commands changes 2015-09-28 15:29:25 +03:00
Evgeniy Khramtsov fb6267f38e Add config validation at startup 2015-06-01 15:38:27 +03:00
Evgeniy Khramtsov 3b267eaa61 Do not bounce normal messages sent to unavailable resource 2015-05-19 10:58:36 +03:00
Holger Weiss 1fa73fd33f Remove unused case clauses to make dialyzer happy 2015-04-03 20:37:42 +02:00
Holger Weiss 1b1878409f Route headlines sent to bare JIDs to all resources
As per RFC 6121, deliver headline messages that were sent to a bare JID
to all resources with a non-negative priority, not just to those with
the highest priority.  If no such resource is available, discard them
silently.
2015-03-25 01:17:35 +01:00
Holger Weiss 8f9a2d6df8 Don't route error/groupchat messages to bare JIDs
As per RFC 6121, drop error messages that were sent to bare JIDs, and
return an error if a groupchat message was sent to a bare JID.
2015-03-25 00:52:49 +01:00
Holger Weiss bc008d4041 Update routing for unavailable resources
As per RFC 6121, don't reroute non-chat messages sent to unavailable
resources.
2015-03-25 00:13:05 +01:00
Evgeniy Khramtsov a0fafc383a Add Redis backend for SM 2015-03-11 14:46:57 +03:00
Evgeniy Khramtsov 72d9b099c6 Make it possible to use SQL as an SM backend 2015-03-09 16:41:13 +03:00
Evgeniy Khramtsov 86e03f3828 Separate db backend from the SM 2015-03-09 14:57:33 +03:00
Holger Weiss 7fd7e53e4a Fix typo in debug message 2015-02-08 23:49:17 +01:00
Badlop 5a35405cd5 Update copyright dates to 2015 (EJAB-1733) 2015-01-08 17:34:43 +01:00
Matthias Rieber 8184326eb9 Fix kick_user command 2014-11-10 20:53:00 +01:00
Holger Weiss 9121ca14de Rename disconnect_user/2 command
The mod_admin_extra module provides a kick_session/4 command.  Rename
the disconnect_user/2 command to kick_user/2 for consistency.
2014-05-12 12:44:40 +02:00
Evgeniy Khramtsov 318b0f2208 Fix previous commit (C2S session close on server shutdown) 2014-05-08 21:47:50 +04:00
Evgeniy Khramtsov 181e7a823e Fix C2S session close on server shutdown 2014-05-08 21:39:53 +04:00
Holger Weiss d343447cc9 Merge remote-tracking branch 'processone/master' into xep-0198
Conflicts:
	doc/guide.tex
	src/ejabberd_c2s.erl
2014-05-06 21:41:29 +02:00
Evgeniy Khramtsov 806c0e56e1 Do not crash on version downgrade 2014-05-03 17:55:03 +04:00
Evgeniy Khramtsov 8e2bc8d19e Check for 'max_user_sessions' option 2014-05-02 17:42:13 +04:00
Holger Weiss ebbceab93f Translate disconnect_user/2 string sent to client 2014-04-29 11:56:28 +02:00
Holger Weiss 6d1055abec New ejabberd command: disconnect_user/2 2014-04-29 00:50:43 +02:00
badlop 37d4109e8a Merge pull request #161 from weiss/fix-carbons
Let mod_carboncopy take care of messages sent to bare/unavailable JIDs
2014-04-22 13:52:11 +02:00
badlop 285c4c17cf Merge pull request #146 from jamielinux/master
Update FSF address
2014-04-11 13:35:46 +02:00
Holger Weiss 9d5426315f Carbons: Also forward messages sent to bare JIDs
Don't ignore messages sent to bare JIDs, but forward them to all
carbon-copy-enabled resources that don't have the highest priority.
2014-04-07 22:10:08 +02:00
Badlop 8b9c49440a Fix user_resources command, and ejabberd_xmlrpc parsing auth details in call 2014-03-31 16:51:47 +02:00
Holger Weiss e360c56f87 Support XEP-0198 session resumption
Implement the optional session resumption feature described in XEP-0198.
A client that supports this feature may now resume the previous session
(within a configurable number of seconds) if the connection was lost.
During resumption, ejabberd will retransmit any stanzas that hadn't been
acknowledged by the client.
2014-03-19 00:51:33 +01:00
Badlop 633d47f784 Update copyright dates to 2014 (EJAB-1679) 2014-03-13 12:30:57 +01:00
Jamie Nguyen 8538997d61 Update FSF address 2014-02-22 10:27:40 +00:00
Alexey Shchepin 62fb432e3e Fixed broadcast messages handling 2013-06-17 16:41:02 +03:00
Evgeniy Khramtsov 4d8f770624 Switch to rebar build tool
Use dynamic Rebar configuration
Make iconv dependency optional
Disable transient_supervisors compile option
Add hipe compilation support
Only compile ibrowse and lhttpc when needed
Make it possible to generate an OTP application release
Add --enable-debug compile option
Add --enable-all compiler option
Add --enable-tools configure option
Add --with-erlang configure option.
Add --enable-erlang-version-check configure option.
Add lager support
Improve the test suite
2013-06-13 11:11:02 +02:00
Badlop 9deb294328 Accumulated patch to binarize and indent code 2013-03-14 10:33:02 +01:00
Alexey Shchepin 0ae400533c Update copyright dates 2013-01-24 16:25:13 +02:00
Alexey Shchepin b1e2538488 Update copyright dates 2012-02-23 17:52:34 +02:00
Badlop a0f8a2c3a4 New option resource_conflict defines server action (thanks to Lee Boynton)(EJAB-650) 2011-08-17 19:44:39 +02:00
Christophe Romain fd52f2cb7d update copyright up to 2011 2011-02-14 13:50:55 +01:00
Badlop afa0f4d403 Fix for Erlang R12, that doesn't support: true andalso ok 2010-06-15 22:59:53 +02:00
Badlop 6ae1f62469 Don't store blocked messages in offline queue (thanks to Brian Acton)(EJAB-1224) 2010-04-27 13:30:00 +02:00
Badlop 1c00a9713d Automatic vcard avatar addition in presence (thanks to Igor Goryachev)(EJAB-208) 2010-04-27 12:33:56 +02:00