Commit Graph

86 Commits

Author SHA1 Message Date
Badlop b3211b1f71 Update copyright year to 2022 2022-02-11 09:39:25 +01:00
Badlop 6e0161470e Update newest copyright year to 2021 (#3464) 2021-01-27 17:02:06 +01:00
Stu Tomlinson bd11a00f8f
Use include_lib() to include headers from dependencies (#3369) 2020-09-03 13:45:57 +02:00
Holger Weiss e01e528235 mod_carboncopy: Bump supported XEP revision
Since mod_carboncopy supports "urn:xmpp:carbons:rules:0", it implements
version 0.13.x of XEP-0280.
2020-04-05 22:52:55 +02:00
Badlop 260c289d34 Fix Dialyzer warning that jid can't be 'undefined' 2020-03-18 12:02:16 +01:00
Badlop 2d32c66fd7 Update copyright to 2020 (#3149) 2020-01-28 15:49:23 +01:00
Holger Weiss ec035e3c41 mod_carboncopy: Omit check for undefined 'from'
These days, the 'from' of an outgoing #message is guaranteed to be set
to the sender's JID by xmpp_stream_in:process_authenticated_packet/2.
2020-01-13 00:45:33 +01:00
Holger Weiss 430b9bef38 mod_carboncopy: Don't process non-message stanzas
Avoid examining presence and IQ stanzas, as they're not eligible for
carbon-copying.

This is just an optimization and should not change the behavior.
2020-01-13 00:31:01 +01:00
Holger Weiss ff193a1a6f mod_carboncopy: Also copy mediated MUC invitations 2020-01-13 00:13:54 +01:00
Holger Weiss 74c01caf08 mod_carboncopy: Improve is_carbon_copy() check
Make sure the hook chain is stopped early whenever a carbon copy is
processed, not just in some cases.
2020-01-12 14:04:31 +01:00
Holger Weiss a8f6c1db1d mod_carboncopy: Support new copying rules
Support the copying rules added to XEP-0280 with version 0.13.0 under
the "urn:xmpp:carbons:rules:0" namespace.

Closes #3011.
2020-01-12 13:42:00 +01:00
Evgeny Khramtsov 97da380acd Generate ejabberd.yml.5 man page from source code directly
Several documentation callbacks (doc/0 and mod_doc/0) are implemented
and `ejabberdctl man` command is added to generate a man page. Note
that the command requires a2x to be installed (which is a part of
asciidoc package).
2020-01-08 12:24:51 +03:00
Evgeny Khramtsov 5770946f03 Correctly handle unicode in log messages 2019-09-23 15:17:20 +03:00
Evgeny Khramtsov ca0e53b3c5 Fix typo in log message 2019-07-24 18:56:44 +03:00
Evgeny Khramtsov 00f2a736eb Improve extraction of translated strings
Now every such string MUST be encapsulated into ?T() macro.
The macro itself is defined in include/translate.hrl.
Example:

-module(foo).
-export([bar/1]).
-include("translate.hrl").

bar(Lang) ->
    translate:translate(Lang, ?T("baz")).
2019-06-22 17:08:45 +03:00
Evgeny Khramtsov a02cff0e78 Use new configuration validator 2019-06-14 12:33:26 +03:00
Badlop 55417dfb37 Update copyright to 2019 (#2756) 2019-01-08 22:53:27 +01:00
Evgeny Khramtsov 6cd8d1025c Don't lose carbons on presence change or session resumption 2018-12-10 11:53:27 +03:00
Evgeny Khramtsov 109ed8f2f6 Keep info about carbons inside session table
Accordingly, Mnesia/SQL/Riak table 'carboncopy' is not used anymore
and can be safely removed.

As a consequence, the commit deprecates the following options of
mod_carboncopy:
- ram_db_type
- use_cache
- cache_size
- cache_missed
- cache_life_time

Fixes #2663
2018-12-01 13:33:44 +03:00
Evgeny Khramtsov 2d246f61dd Fix some dialyzer warnings 2018-09-09 09:59:08 +03:00
Evgeniy Khramtsov fd8e07af47 Get rid of ejabberd.hrl header
The header consisted of too many unrelated stuff and macros misuse.
Some stuff is moved into scram.hrl and type_compat.hrl.
All macros have been replaced with the corresponding function calls.

TODO: probably type_compat.hrl is not even needed anymore since
we support only Erlang >= OTP 17.5
2018-06-14 14:00:47 +03:00
Holger Weiss ea87bdfbe5 mod_carboncopy: Apply cosmetic change
The xmpp:has_subtag/2 function returns a boolen() value, so it can be
used with the 'not' operator.
2018-02-22 00:46:47 +01:00
Holger Weiss 7a1ed065fe mod_carboncopy: Copy outgoing MUC PMs
Incoming MUC PMs aren't carbon-copied, as the MUC service usually forks
them.  However, don't suppress copying of outgoing PMs, where no such
forking takes place.
2018-02-22 00:40:09 +01:00
Evgeniy Khramtsov ec0f0f7c72 Move some log messages to debug level 2018-02-21 17:12:50 +03:00
Evgeniy Khramtsov 66fc1bf3b6 Remove 'iqdisc' option
Since we got rid of all bottle-neck processes and we have
a connection pool for every database, the option is no longer
needed and in fact is detrimental: in practice what you get
is just a bunch of overloaded processes in the IQ handlers pool
no matter how much you increase the `iqdisc` value.

Given that there are close to zero operators understanding
the meaning of the option and, hence, not using it all,
it's not simply deprecated but completely removed.

The commit also deprecates the following functions:
- gen_iq_handler:add_iq_handler/6
- gen_iq_handler:handle/5
- gen_iq_handler:iqdisc/1
2018-02-11 12:54:15 +03:00
Paweł Chmielowski f6ebbe4c78 Fix compilation ordering in mix by s/-behavior/-behaviour/ 2018-01-31 14:57:43 +01:00
Evgeniy Khramtsov 2269d290d8 Switch to newer fast_xml and xmpp and update record fields in the code 2018-01-25 20:02:47 +03:00
Evgeniy Khramtsov ba2b650464 Introduce new gen_mod callback: mod_options/1
The callback is supposed to provide known options and their default
values, as long as the documentation. Passing default values into
get_mod functions is now deprecated: all defaults should be provided
by the Mod:mod_options/1 callback.
2018-01-23 10:54:52 +03:00
Evgeniy Khramtsov cdc7c1d1ed Update copyright dates 2018-01-05 23:18:58 +03:00
Evgeniy Khramtsov cf53d834e9 Introduce 'iqdisc' global option 2017-05-04 12:24:47 +03:00
Evgeniy Khramtsov fddd6110e0 Don't validate an option in gen_mod:get*opt() functions
The changes are very similar to those from previous commit:
* Now there is no need to pass validating function in
  gen_mod:get_opt() and gen_mod:get_module_opt() functions,
  because the modules' configuration keeps already validated values.
* New functions gen_mod:get_opt/2 and gen_mod:get_module_opt/3 are
  introduced.
* Functions gen_mod:get_opt/4 and get_module_opt/5 are deprecated.
  If the functions are still called, the "function" argument is
  simply ignored.
* Validating callback Mod:listen_opt_type/1 is introduced to validate
  listening options at startup.
2017-04-30 19:01:47 +03:00
Evgeniy Khramtsov e40baf0bda Use cache in front of Redis/SQL RAM backends 2017-04-14 13:57:52 +03:00
Evgeniy Khramtsov 31fd83b2ae Add SQL as mod_carboncopy RAM backend 2017-03-30 10:31:51 +03:00
Evgeniy Khramtsov 3c4057ff55 Reload modules when reloading configuration file 2017-02-22 19:46:47 +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 28f66ddd7c Attach modules to gen_mod's supervisor 2017-02-14 12:39:26 +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 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
Holger Weiss 3325e69ae6 Let mod_carboncopy mark copied messages
Carbon copies are now marked with a 'carbon_copy' flag.  This makes it
easier to identify them.
2016-11-22 22:21:34 +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 b8dcc911a3 Make common tests working again 2016-11-18 13:38:08 +03:00
Evgeniy Khramtsov 7e9f1a6dc1 Don't auto-decode forwarded payload 2016-11-13 13:41:04 +03: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
Holger Weiss e7787e2f33 mod_carboncopy: Don't copy MUC PMs
Carbon copies of private MUC message are generally not desired,
especially not when multiple clients joined the room with the same nick.
In this case, the MUC service usually sends PMs to all joined resources
anyway, so carbon-copying those PMs would create duplicates.
2016-09-19 22:46:36 +02:00
Evgeniy Khramtsov 522a186a38 Improve some type specs 2016-08-09 10:56:32 +03:00
Evgeniy Khramtsov 9a8e197d7e Initial version based on XML generator 2016-07-18 15:01:32 +03:00
Evgeniy Khramtsov 71f27ee7d4 Get rid of warnings 2016-07-07 12:17:38 +03:00
Evgeniy Khramtsov 9c369b7a8c Improve detection of databases supported by modules (#1092) 2016-04-27 17:10:50 +03:00
Evgeniy Khramtsov 222572bd56 Clean mod_carboncopy.erl from DB specific code 2016-04-15 15:48:56 +03:00