Commit Graph

181 Commits

Author SHA1 Message Date
Evgeniy Khramtsov 6e5439db5c Find and fix typos using 'codespell' 2018-01-27 19:35:38 +03: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
Paweł Chmielowski 4c799528c7 Fix ejabberd command privacy_set
This fixes issue #2205
2018-01-04 14:57:36 +01:00
Badlop 0e5b343f1b Add Id attribute in stanza built by send_message command 2017-11-23 17:14:39 +01:00
Badlop cbbfe32d8b Unregister commands when stopping node only if it's last one (#2083) 2017-11-06 16:53:49 +01:00
Badlop 2198fbce97 Fix command set_last that always returned code 1, error (#2010) 2017-09-25 18:43:24 +02:00
Paweł Chmielowski 33a9d6a3c3 Fix args_examples from last commit 2017-07-14 17:17:26 +02:00
Badlop fdb863ce70 Describe even more command arguments and results in mod_admin_extra 2017-07-14 16:43:30 +02:00
Badlop aaef1a14b4 Fix set_presence command to work in recent ejabberd 2017-07-07 10:55:08 +02:00
Badlop f87b46f454 Fix srg_user_add/del for non-Mnesia database backends (#1780) 2017-06-15 11:05:41 +02:00
Badlop 63b6e0d381 Switch access rule delete_old_users with protect_old_users (#1772) 2017-06-09 19:18:47 +02:00
Badlop b25b5c2f98 Improve export2sql explanation; remove obsolete and duplicated command 2017-06-09 12:02:49 +02:00
Badlop ee8bbccb2a Fix and document push_roster_all command 2017-06-08 19:54:34 +02:00
Evgeniy Khramtsov 35d19b32f4 Implement cache for mod_privacy/mod_blocking 2017-05-20 22:36:32 +03:00
Evgeniy Khramtsov cdb191bb48 Rename is_user_exists -> user_exists 2017-05-11 15:49:06 +03:00
Evgeniy Khramtsov 633b68db11 Use cache for authentication backends
The commit introduces the following API incompatibilities:

In ejabberd_auth.erl:
* dirty_get_registered_users/0 is renamed to get_users/0
* get_vh_registered_users/1 is renamed to get_users/1
* get_vh_registered_users/2 is renamed to get_users/2
* get_vh_registered_users_number/1 is renamed to count_users/1
* get_vh_registered_users_number/2 is renamed to count_users/2

In ejabberd_auth callbacks
* plain_password_required/0 is replaced by plain_password_required/1
  where the argument is a virtual host
* store_type/0 is replaced by store_type/1 where the argument is
  a virtual host
* set_password/3 is now an optional callback
* remove_user/3 callback is no longer needed
* remove_user/2 now should return `ok | {error, atom()}`
* is_user_exists/2 now must only be implemented for backends
  with `external` store type
* check_password/6 is no longer needed
* check_password/4 now must only be implemented for backends
  with `external` store type
* try_register/3 is now an optional callback and should return
  `ok | {error, atom()}`
* dirty_get_registered_users/0 is no longer needed
* get_vh_registered_users/1 is no longer needed
* get_vh_registered_users/2 is renamed to get_users/2
* get_vh_registered_users_number/1 is no longer needed
* get_vh_registered_users_number/2 is renamed to count_users/2
* get_password_s/2 is no longer needed
* get_password/2 now must only be implemented for backends with
  `plain` or `scram` store type

Additionally, the commit introduces two new callbacks:
* use_cache/1 where the argument is a virtual host
* cache_nodes/1 where the argument is a virtual host

New options are also introduced: `auth_use_cache`, `auth_cache_missed`,
`auth_cache_life_time` and `auth_cache_size`.
2017-05-11 14:37:21 +03:00
Badlop d18d99e8ec Bug requesting non-existent data with private_get command (#1690) 2017-04-26 23:14:30 +02:00
Badlop ca9d04ba6b Fix private_get command sending a proper xmlel (#1683) 2017-04-20 16:50:08 +02:00
Christophe Romain b1acd1183f Rename aux.erl as misc.erl
Thanks Microsoft Windows to not support some filenames
2017-04-11 12:13:58 +02:00
Evgeniy Khramtsov 7bcbea2108 Deprecate jlib.erl in favor of aux.erl
Since the main goal of jlib.erl is lost, all auxiliary functions
are now moved to aux.erl, and the whole jlib.erl is now deprecated.
2017-03-30 14:17:13 +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
Paweł Chmielowski e8c0e21f71 We don't like now() 2017-02-24 12:08:57 +01:00
Badlop 57181c0a76 get_last now always returns tuple with UTC XEP-0082 and status (#1565) 2017-02-23 23:27:57 +01:00
Badlop 6314a96b05 Protect users from delete_old_users command using a fixed access rule (#1462) 2017-02-23 19:38:17 +01:00
Evgeniy Khramtsov 3c4057ff55 Reload modules when reloading configuration file 2017-02-22 19:46:47 +03:00
Evgeniy Khramtsov 218eeae797 Fix some dialyzer warnings 2017-02-16 14:18:36 +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
Peter Lemenkov e7733ce7d9 Use crypto:hash/2 function
Use crypto:hash/2 function instead of ones from p1_sha.

This function exists since commit
erlang/otp@208f9ad382 and also implemented
as NIF, so I believe it's safe to use it.

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>
2017-02-13 18:42:50 +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
Badlop 9605e2b2a4 Fix problem with get_vcard command (#1447) 2017-01-06 16:13:57 +01:00
Badlop f5290a8e44 Specify that process_rosteritems command works only with Mnesia storage 2017-01-03 01:38:56 +01:00
Badlop 5fdd1c39fe Update copyright date automatically (#1442) 2017-01-02 21:42:06 +01:00
Evgeniy Khramtsov 5cc8e807df Initial version of new XMPP stream behaviour (for review) 2016-12-11 15:03:37 +03:00
Christophe Romain 8a7ea85a7e Cleanup ext_mod and fix compilation path 2016-12-07 09:27:21 +01:00
Christophe Romain 1883a98d1c Fix compilation of external module with new xmpp lib 2016-12-06 12:01:04 +01:00
Christophe Romain 0c2491d9ea Remove obsolete remove_node api (use leave_cluster) 2016-12-05 14:17:57 +01:00
Christophe Romain 95a4b1b266 Cleanup admin_extra, add few functions 2016-11-30 10:31:36 +01:00
Christophe Romain 12683b4aaf Fix typo in copyright date 2016-11-23 14:36:11 +01:00
Paweł Chmielowski 5ffc01db53 Fix types in check_password_hash 2016-11-15 10:02:21 +01:00
Evgeniy Khramtsov b8f22ff538 Deprecate most of the functions from jlib.erl 2016-11-13 10:44:53 +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
Badlop bd060bc1bb Support several groups separated by ; in add_rosteritem command 2016-11-04 18:45:27 +01:00
Evgeniy Khramtsov f6236d456d Add more tests for privacy lists and blocking command 2016-10-22 13:01:45 +03:00
Holger Weiss dffcfe74d4 Don't let "send_message" duplicate the message
In the past, the "send_message" command sent a copy of the message to
each resource if the message was addressed to the bare JID of a local
online user.  When message carbons are enabled, this creates duplicates;
and with MAM enabled, each copy is archived.  Therefore, "send_message"
no longer creates copies of the message.
2016-10-10 00:17:17 +02:00
Evgeniy Khramtsov 58969fb854 Improve namespace handling 2016-09-24 14:17:21 +03:00
Badlop 5b4f347da8 Support sql backend in mod_shared_roster commands (#1244) 2016-08-15 15:53:35 +02:00
Christophe Romain 72b0fb49e8 Fix type convertion bug injected by 4ccc40b (#1229) 2016-08-04 09:49:23 +02:00
Mickael Remond 2a49f8cae7
Change name of result key for offline count to value
This is more user friendly and should be more consistent with other commands.
2016-07-30 20:12:04 +02:00
Evgeniy Khramtsov f91f2bc3d2 Rewrite several modules to use XML generator 2016-07-29 13:21:00 +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 4220a2b98c Make modules loading in a dependent order (#1191) 2016-07-06 14:58:48 +03:00
Badlop 4ccc40bce5 push_roster must convert read strings to binaries (#1075) 2016-06-08 21:16:30 +02:00
Holger Weiss bbb90b9928 Ignore offline sessions
Let mod_admin_extra and mod_configure ignore offline sessions when
querying the session table.
2016-06-01 01:01:54 +02:00
Christophe Romain e7843bf92b Fix set_presence API 2016-05-31 11:47:08 +02:00
Matthias Rieber b67dc00db2 Fix check_password 2016-04-10 15:37:36 +02:00
Badlop 27b4217a9d Tweak srg_get_info result formatting (#1048) 2016-04-06 17:55:19 +02:00
Mickael Remond abf768274a Fix error message paramater formatting 2016-04-06 15:05:19 +02:00
Mickael Remond e24da5789e Apply fixes and remove tests for missing methods 2016-04-01 13:05:41 +02:00
Mickael Remond f243c30847 Rollback mod_admin_extra 2016-04-01 12:24:00 +02:00
Alexey Shchepin 3dc55c6d47 Commands refactor, first pass.
- add API versionning
- changed error handling, based on exception
- commands moved/merged from mod_admin_p1 to mod_admin_extra
- command bufixes
- add some elixir unit test cases

Squashed commit of the following:

commit dd59855b3486f78a9349756e4f102e79b3accff8
Merge: 14e8ffc 506e08e
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Fri Oct 30 11:43:18 2015 +0100

    Merge branch '3.2.x' into api

commit 14e8ffce78cbea6c8605371d1fc50a0c1d1e012c
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Tue Oct 27 16:35:17 2015 +0100

    Added OAuth tests to ejabberd_commands

commit f81c550c14628edfe4861c228576cb767924366a
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Tue Oct 27 16:34:55 2015 +0100

    Added some mod_http_api tests

commit 6a64578d5b2ba532a2feb6503ed98561e56d5d53
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Mon Oct 26 15:29:36 2015 +0100

    Fix get_last command test

    Previous version won't work with dst.

commit 27e0cde9e9c1f001effe68f8424a365ad947c068
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Fri Oct 23 17:59:34 2015 +0200

    Add tests on admin command policy

commit 19dad8d54f54c9fabd454280483cccfb06c8e78a
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Fri Oct 23 16:49:36 2015 +0200

    Added command related tests (http api & user policy)

commit e0e596ab4a3f3a70aba5f374f028939ab794de33
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Fri Oct 23 16:49:16 2015 +0200

    Fix command call.

commit 128cd7d1ede3c47a34f8ec3a750c980ccad2c61d
Merge: 60c4c4c 447313c
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Thu Oct 22 14:48:39 2015 +0200

    Merge branch '3.2.x' into api

commit 60c4c4c0751302524c14219c6bc8c56a6069a689
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Thu Oct 22 14:45:57 2015 +0200

    Fix ejabberd_commands spec.

commit 8e145c28c5da762c2b93ee32327eff1db94ebfed
Merge: 397273a f13dc94
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Wed Oct 21 18:26:07 2015 +0200

    Merge branch '3.2.x' into api

commit 397273a23ed415feac87aed33da6452229793387
Merge: c30e89b f289e27
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Wed Oct 21 15:27:45 2015 +0200

    Merge branch '3.2.x' into api

commit c30e89bb8a0013bff37e61e4c6953350c9c1f313
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Wed Oct 21 12:47:02 2015 +0200

    Merge mod_http_api

commit 7b0db22b4acd48ff6fabce41c1b2525e6580a3c5
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Fri Oct 16 11:55:48 2015 +0200

    Fix exunit tests to run with common_test suites

commit d8b1a89800ac7379a57a7eb4a09c3c93c3e1e5eb
Merge: 2879ae8 63455b3
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Thu Oct 15 11:39:45 2015 +0200

    Merge branch '3.2.x' into api

commit 2879ae87ff3eee369ef3d780136b96ecff5285d1
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Wed Oct 14 14:53:44 2015 +0200

    Fix update_roster command.

commit a1d453dd7a3afda9861a8d747494a45057ad574b
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Tue Oct 13 16:14:28 2015 +0200

    API commands refactor

    Moving and/or merging commands from mod_admin_p1 to mod_admin_extra

commit b709ed26b0fc0ca4f3bdd5a59fa58ec7e3db97fa
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Wed Oct 7 15:10:01 2015 +0200

    Add tests on commands

commit 6711687bee9c672cb3d5aed0744e13420ecf6dbd
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Tue Sep 29 15:58:16 2015 +0200

    Add ejabberd_commands tests

commit df8682f419cf3877e77e36a19bca0fc55dc991f8
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Mon Sep 28 14:54:39 2015 +0200

    Added API versioning for ejabberdctl and rest commands

commit cd017b0e3aac431bc3ee807ceb7f8641e1523ef5
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Fri Sep 18 11:21:45 2015 +0200

    Better error handling of HTTP API commands.

commit ca5cb6acd8e4643f9d6c484d2277b0d7e88471e5
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Tue Sep 15 15:03:05 2015 +0200

    add commands to mod_admin_extra:
    - get_offline_count
    - get_presence
    - change_password

commit 7f583fa099e30ac2b0915669fd8f102ac565b833
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Tue Sep 15 15:02:16 2015 +0200

    Improve REST API error handling

commit 14753b1c02cdce434a786b7f80f6c09f0d210075
Author: Jerome Sautret <jerome.sautret@process-one.net>
Date:   Mon Sep 14 10:51:17 2015 +0200

    Change REST API return codes for integer type.
2016-03-31 14:53:31 +03:00
Badlop e7ef65a22d Improve ban_account command to work with other DBs than Mnesia (#977) 2016-03-21 18:30:05 +01:00
Paweł Chmielowski 7b72247b2c Don't use jlib:jid_remove_resource 2016-03-16 13:32:19 +01:00
root 058b3d96bf Bare JID in 'from' of Roster Push (RFC 6121 section 2.1.6) in mod_admin_extra 2016-03-15 10:57:56 +05:00
Holger Weiss b871fbba1b Fix result type of "connected_users_info" command
Closes #1002.
2016-03-14 00:51:12 +01:00
Badlop 9c3d57e63e Mark get_queue_length obsolete, and use count_offline_messages (#970) 2016-03-04 11:09:14 +01:00
Paweł Chmielowski 217b6da5fd Fix example value for rescode return type 2016-02-09 16:44:57 +01:00
Paweł Chmielowski d5b3e6af00 More documentation of arguments in mod_admin_extra 2016-02-09 16:33:32 +01:00
Paweł Chmielowski 30d171e79e Start documenting arguments in mod_admin_extra commands 2016-02-09 13:03:40 +01: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
HAMANO Tsukasa 5a85b0fb52 rename timestamp function #917 2016-01-23 17:58:10 +09:00
Christophe Romain 2ddbd032ee Add error handling to send_stanza 2016-01-19 16:16:04 +01:00
badlop 6ac839dd76 Merge pull request #906 from hamano/stats_processes
add stats processes command
2016-01-15 19:26:23 +01:00
HAMANO Tsukasa 6cb1905f7c add stats processes command 2016-01-15 00:27:15 +09:00
Holger Weiss 5deb6a91f7 mod_admin_extra: Replace deprecated function calls 2016-01-02 21:27:48 +01:00
Badlop 91d205715e New send_stanza command (ejabberd_contrib#142) 2015-12-30 12:53:40 +01:00
Paweł Chmielowski a18a3dfbb1 Add commands for generating html or markdown documentation for commands 2015-12-28 12:20:06 +01:00
Paweł Chmielowski 5c329a7699 Remove now() - part 1 2015-12-04 15:08:43 +01:00
Evgeniy Khramtsov 95265dd3ad Move JID related functions to jid.erl (#847) 2015-11-24 18:44:13 +03:00
Alexey Shchepin cf975da8f2 Update several commands for recent ejabberd_commands changes 2015-09-28 15:29:25 +03:00
Badlop 4ae1b4db03 When passwords are scrammed, report check_password_hash cannot work (#559) 2015-06-25 13:39:45 +02:00
Badlop 4ed6a3d78f Fix commands export2odbc, connected_users_vhost and push_alltoall (#586) 2015-06-02 12:52:15 +02:00
badlop 0de7864880 Merge pull request #585 from CorCornelisse/master
push_roster* not updated on binarification
2015-06-02 12:24:46 +02:00
Evgeniy Khramtsov fb6267f38e Add config validation at startup 2015-06-01 15:38:27 +03:00
Cor Cornelisse 22d9011c0c These arguments should be binary instead of strings, otherwise it won't work properly 2015-06-01 13:30:26 +02:00
Mickael Remond 9574e71e8d Include session record from header file instead of duplicating it 2015-05-26 10:08:46 +02:00
Badlop b07cb1ed84 Use namespace definitions when possible 2015-05-21 17:04:14 +02:00
Badlop 25beb46391 Fix check_password_hash argument parsing (#559) 2015-05-08 12:04:04 +02:00
Badlop fa99519f8b Simplify internal code of get_last and set_last commands 2015-05-05 12:54:20 +02:00
Badlop 96c62acb1b Improve get_last command to provide also last activity status 2015-05-05 12:46:21 +02:00
Badlop 77e57afae1 Fix set_last command to work with recent ejabberd (#555) 2015-05-05 12:45:53 +02:00
Badlop c2e6ce0f04 Remove load_config command because is superseded by reload_config (#532) 2015-04-20 15:57:44 +02:00
Badlop 7d3b2cad26 Replace crypto calls that will be removed in a future release 2015-04-04 14:09:58 +02:00
Badlop 94761ff31e Improve srg_get_info result format (processone/ejabberd-contrib#92) 2015-04-03 12:16:11 +02:00
Paweł Chmielowski 088c5c4672 Fix output formatting in srg_get_info commend from mod_admin_extra 2015-04-02 16:55:51 +02:00
Paweł Chmielowski b580da3547 Fix problems with get_vcard* functions from mod_admin_extra 2015-04-01 16:32:34 +02:00
Paweł Chmielowski cf3b4dbc7b Drop exmpp usage from mod_admin_extra 2015-04-01 15:44:49 +02:00