Commit Graph

248 Commits

Author SHA1 Message Date
Christophe Romain fd7bf7fed3 Fix typo from 9c5427e0c 2017-08-11 17:54:53 +02:00
Christophe Romain 7a90cda8ff Process on_user_offline only from valid sessions 2017-08-11 12:05:14 +02:00
Christophe Romain 024713a441 Remove temporary debug 2017-08-11 10:53:19 +02:00
Christophe Romain 32fbfe1981 Use correct c2s process sending PEP with multi devices 2017-08-11 10:32:36 +02:00
Christophe Romain 9c5427e0c2 PubSub: refactor send_last_items remove send_loop 2017-08-11 10:20:33 +02:00
Christophe Romain e903348dd3 Fix pubsub send_loop after 3fec7824 2017-08-09 11:34:36 +02:00
Evgeniy Khramtsov 3fec782494 Introduce 'hosts' option
The option can be used as a replacement of 'host' option
when several (sub)domains are needed to be registered for the module.
Note that you cannot combine both 'host' and 'hosts' in the config
because 'host' option is of a higher priority. Example:

mod_pubsub:
   ...
   hosts:
     - "pubsub1.@HOST@"
     - "pubsub2.@HOST@"

Fixes #1883
2017-08-08 17:46:26 +03:00
Christophe Romain 06450f4a82 Keep disco#info on PEP compatible with XEP-0060 (#1717) 2017-08-03 15:48:23 +02:00
Christophe Romain ce0beb550c Move pubsub sql export to pubsub_db_sql module 2017-08-03 15:34:01 +02:00
Christophe Romain 96c0483533 Fix Xref from 5dcc97c 2017-08-03 14:54:06 +02:00
Badlop 5dcc97c85a Preliminary export PubSub data from Mnesia tables to SQL file (#1571) 2017-08-03 10:53:01 +02:00
Christophe Romain 73509686f1 Fix getting cached last item (#1814) 2017-08-02 12:24:34 +02:00
Jing Sun 50511fcff7 Fix spec for mod_pubsub:subscribe_node 2017-08-02 10:31:42 +02:00
Christophe Romain 5e26190b98 Fix PubSub send last published items (#1572) 2017-08-01 17:00:52 +02:00
Christophe Romain 0ba6c78ed0 Fix disco#items on PEP service 2017-08-01 15:15:01 +02:00
Christophe Romain 636d68e0a9 Fix PEP node identity (#1717) 2017-08-01 14:41:16 +02:00
Christophe Romain 800965a957 Avoid useless calls on simples subscriptions (#1313) 2017-06-29 15:24:18 +02:00
Evgeniy Khramtsov f782955c06 Implement cache for roster 2017-05-17 14:47:35 +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
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
Christophe Romain b75780b9cd Always init pubsub_index when using mnesia 2017-04-03 12:13:20 +02:00
Christophe Romain 55ea097bce Remove obsolete mnesia migration calls
Now that plugins directly use ejabberd_mnesia and can include their own
transform handler, we don't need pubsub_migrate anymore.

People upgrading from 2.1.1x version must upgrade to 17.01 first.
pubsub_migrate module remains to support any manual process requiring it
2017-04-03 11:37:07 +02:00
Christophe Romain bfde473c3b Add missing jlib->aux convertion 2017-03-30 14:28:55 +02:00
Christophe Romain c93bf732db Refactor pubsub's get_last_items 2017-03-30 14:26:30 +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
Christophe Romain 5b6d042de2 Fix PEP issues (#1636) 2017-03-27 16:24:24 +02:00
Evgeniy Khramtsov f3ecba0445 Use new xdata compiler API 2017-03-20 09:57:11 +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
Christophe Romain 87b5e2500b Fix match of itemid on get_cached_item, fixes 14e771d8 2017-02-22 17:44:47 +01: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 28f66ddd7c Attach modules to gen_mod's supervisor 2017-02-14 12:39:26 +03:00
Evgeniy Khramtsov f664e39374 Improve modules start/stop procedures 2017-02-14 10:25:08 +03:00
Holger Weiss 14e771d871 mod_pubsub: Fix last item cache for multiple hosts
Don't let the last item cache intermix PubSub items of different virtual
domains.
2017-01-21 00:14:56 +01: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
Christophe Romain 4f5d54f062 Try db migration only when mnesia is configured (#1458) 2017-01-20 09:26:13 +01:00
Evgeniy Khramtsov 0baaad30b1 Implement database backend interface for MUC, BOSH and auth_anonyous 2017-01-13 12:03:39 +03:00
Christophe Romain 6ff81946cf Fix migration of old pubsub database (#1409) 2017-01-10 12:10:11 +01: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 309bdfbe28 Add xmpp_stream_out behaviour and rewrite s2s/SM code 2016-12-28 09:47:11 +03:00
Holger Weiss df92d96d4f Revert "Fix 'nodetree' configuration lookups for PEP"
This reverts commit 7ef8dfb4e0.

The config/3 function copes with the PEP case.
2016-12-25 01:24:40 +01:00
Holger Weiss 7ef8dfb4e0 Fix 'nodetree' configuration lookups for PEP 2016-12-25 00:58:20 +01:00
Evgeniy Khramtsov 5cc8e807df Initial version of new XMPP stream behaviour (for review) 2016-12-11 15:03:37 +03:00
Christophe Romain 92db9ff105 Improve handling of mnesia schema 2016-11-30 11:09:17 +01:00
Evgeniy Khramtsov 49f1275e20 Get rid of excessive (io)list_to_binary/1 calls 2016-11-24 15:06:06 +03:00
Evgeniy Khramtsov 5d434c1aea Move copyright definition to ejabberd.hrl 2016-11-23 15:51:48 +03:00
Christophe Romain 2929f5b5bc Minor cosmetic changes on pubsub code 2016-11-15 18:35: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 6a3691ef7c Add xdata generator and make some code using it 2016-10-07 10:31:03 +03:00
Christophe Romain 767dba8f3b PubSub: fix notification on subscription change 2016-09-29 12:00:59 +02:00
Evgeniy Khramtsov fa31e3ef23 Deprecate jlib:integer_to_binary/1 and jlib:binary_to_integer/1 2016-09-24 23:34:28 +03:00
Evgeniy Khramtsov e987b88848 Make common tests working again 2016-09-13 12:30:05 +03:00
Evgeniy Khramtsov c29a48695d Rename #error{} record to #stanza_error{} 2016-09-08 17:08:48 +03:00
Evgeniy Khramtsov 5ec972b00f Improve pubsub code 2016-09-08 15:49:27 +03:00
Holger Weiss e29f47893f mod_pubsub: Remove outdated comment 2016-09-06 00:05:54 +02:00
Evgeniy Khramtsov 45eb49125b Rewrite mod_pubsub to use XML codec 2016-08-30 09:48:08 +03: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
Christophe Romain 6b38d19085 Do send last items only for subscription on current plugin type 2016-07-08 15:18:39 +02:00
Evgeniy Khramtsov 4220a2b98c Make modules loading in a dependent order (#1191) 2016-07-06 14:58:48 +03:00
Paweł Chmielowski 0737958b45 Fix compilation issues on R19 2016-07-01 21:20:10 +02:00
Holger Weiss 1794dd19d0 mod_pubsub: Fix matching of set_node/1 result
nodetree_tree_sql:set_node/1 returns {result, NodeIdx} on success, not
{ok, NodeIdx}.  Thanks to Christophe Romain for spotting this.
2016-06-23 14:23:24 +02:00
Holger Weiss 78d4200f05 mod_pubsub: Fix node configuration changes for SQL
nodetree_tree_sql:set_node/1 returns {ok, NodeIdx} rather than 'ok' on
success.
2016-06-06 00:18:24 +02:00
Holger Weiss c958fa2f06 Add support for PubSub publishing options
Add code necessary to support publishing options as described in
XEP-0060, #7.1.5.  A node plugin that expects publishing options must
add <<"publish-options">> to the features/0 list and then handle the
publishing options handed over to the publish_item/7 call.

Signed-off-by: Christian Ulrich <christian@rechenwerk.net>
2016-05-25 08:40:12 +02:00
Christophe Romain 07196b6c62 Fix sender in case of explicit pep subscriptions 2016-05-02 15:04:14 +02:00
Christophe Romain 639c2fb640 Add pubsub subscribe/unsubscribe hook 2016-04-28 15:57:55 +02:00
Evgeniy Khramtsov 9c369b7a8c Improve detection of databases supported by modules (#1092) 2016-04-27 17:10:50 +03:00
Christophe Romain ef90a389c1 Fix use of pubsub node plugin when configured with default_node_config 2016-04-25 09:44:46 +02:00
Evgeniy Khramtsov 1aae8a9fda Rename odbc to sql everywhere 2016-04-20 13:25:42 +03:00
Evgeniy Khramtsov 9ac6e4edf7 Replace more ?ERR_* macros with ?ERRT_* 2016-04-05 13:09:44 +03:00
Evgeniy Khramtsov 55c567ff00 Unregister route at the very end 2016-03-13 17:37:39 +03:00
Evgeniy Khramtsov 5045fb584d Define pubsub node configuration per route/host explicitly 2016-03-13 13:16:43 +03:00
Evgeniy Khramtsov 357e48fb6b Make it possible to get virtual host of a registered route 2016-03-13 11:38:40 +03:00
Christophe Romain 9297782868 Fix config fetch after host/serverhost cleanup 2016-03-11 17:25:46 +01:00
Evgeniy Khramtsov b5121a346d Experimental MIX (XEP-0369) support 2016-03-08 20:04:29 +03:00
Elias Rohrer 8e6a301026 Fixed type specifications for 'rebar doc'
- Fixed type @specs and -specs to remove 'rebar doc' errors
- Removed a lot of wrong and deprecated documentation in ejabberd_piefxis.erl
2016-03-07 15:06:19 +01:00
Christophe Romain 10d6c330a5 Fix pubsub disco after host/serverhost cleanup 2016-03-03 14:52:03 +01:00
Christophe Romain 56523784e1 Implementation of pubsub#itemreply (EJAB-1347)(#928) 2016-02-26 10:32:03 +01:00
Christophe Romain 1c6d20924b Fix host/serverhost usage (#902) 2016-02-26 09:33:07 +01:00
Mickael Remond dfc29ea03c Switch to Fast XML module 2016-02-03 19:03:17 +01:00
Nathan Bruning 80fc34fb0c Fix presence-based delivery 2016-02-02 14:06:07 +01:00
Badlop f448ff608a Update copyright to 2016 (#901) 2016-01-13 12:29:14 +01:00
Christophe Romain 6957e892dd Fix last item message type as message attribute 2015-12-16 17:04:45 +01:00
Christophe Romain c8986ffa5e Use correct notification_type for last items (#827) 2015-12-16 16:19:35 +01:00
Christophe Romain 08b0530164 Don't read pubsub options when plugin does not use them
This also revert commit 6052f7b
2015-12-16 12:56:06 +01:00
Christophe Romain 3b69d26368 Fix pubsub headers 2015-12-15 16:12:20 +01:00
Christophe Romain 6357ea1d5d Limit number of subscriptions per node and allow custom default node configuration 2015-12-11 12:46:44 +01:00
Christophe Romain 86a8606fd1 Virtual nodetree is not attached to any backend 2015-12-11 12:46:40 +01:00
Christophe Romain c4943cffe8 Follow pubsub configuration when using virtual nodetree 2015-12-11 12:46:35 +01:00
Christophe Romain 10c920ef13 Don't force max_items_node to MAXITEMS if not defined 2015-12-11 12:30:16 +01:00
Paweł Chmielowski 5ac10d6555 Remove now() in pubsub code 2015-12-07 16:16:11 +01:00
Evgeniy Khramtsov 95265dd3ad Move JID related functions to jid.erl (#847) 2015-11-24 18:44:13 +03:00
Christophe Romain 880114a909 Enforce get_allowed_items_call 2015-10-07 16:40:37 +02:00
Christophe Romain 6aeb9dcb38 cosmetic cleanup 2015-10-07 14:18:38 +02:00
Christophe Romain d481017746 Merge pull request #642 from weiss/pep-on-caps-update
Also send PEP notifications when local contact updates CAPS
2015-07-24 12:07:22 +02:00
Christophe Romain 9c36a9df78 Do not init nodes from mod_pubsub (#609)
Let each plugin do its own initialisation in init_plugins
init_nodes was an old function to be removed.
2015-07-22 08:03:27 +02:00
Holger Weiss 0f96414279 Trigger PEP notifications on CAPS updates
Let mod_pubsub send last items whenever a contact updates the entity
capabilities.  This was already done for remote contacts and is now also
done for local contacts.
2015-07-07 09:33:00 +02:00
Holger Weiss edb18deb8f mod_pubsub: Explain caps_update usage in a comment
The reason to use the caps_update hook for sending last items to remote
contacts is probably not obvious.
2015-07-06 23:45:25 +02:00
Badlop 6631078884 Document a few more supported protocols 2015-06-22 13:11:37 +02:00
Christophe Romain d528457ba5 Don't force persistence if cache enabled (fix previous commit) 2015-06-18 12:54:46 +02:00
Christophe Romain e5a98b100d Fix max_items and don't let PEP depends on item cache 2015-06-18 12:06:29 +02:00
Evgeniy Khramtsov fb6267f38e Add config validation at startup 2015-06-01 15:38:27 +03:00
Christophe Romain b83c07251c Fix pubsub/odbc crash on remote user unsubscribe (EJAB-1483) 2015-05-26 19:19:57 +02:00
Badlop 0c725b5fac Document protocol support (EJABS-1620) 2015-05-21 17:04:05 +02:00
Christophe Romain 8bb994dbca Call integer_to_binary using jlib (#554) 2015-05-18 17:30:25 +02:00
Evgeniy Khramtsov 9c85cb5f25 Fix validating function for iqdisc 2015-04-23 14:59:18 +03:00
Christophe Romain 38dd44e18f Improve purge_offline filter and speed (#543) 2015-04-22 18:11:39 +02:00
Christophe Romain 6e4d6caebf Add support for publish-only (#30) 2015-04-21 17:23:59 +02:00
Christophe Romain cf37f3977a Fix typo, oups... 2015-04-21 16:13:23 +02:00
Christophe Romain 61f80396da remove deferred Collection shim header 2015-04-21 16:11:00 +02:00
Christophe Romain 747d25b4ad Fixed node type (thanks to saczawap) (#435) 2015-04-21 15:24:24 +02:00
Christophe Romain e0563e3918 PubSub improvements
This commit contains
- code cleanup
- use of db_type instead of old mod_pubsub_odbc
- some minor optimizations
- some minor bugfixes
2015-04-21 15:24:16 +02:00
Holger Weiss f40e6a0421 Don't bother with filtering out PEP error messages
Now that ejabberd_sm won't deliver error messages that were sent to bare
JIDs anymore, PEP error messages should no longer arrive.
2015-03-25 02:02:08 +01:00
Christophe Romain a265ea53f9 Merge pull request #384 from weiss/fix-last-item-type
Use correct message type when sending last published PEP/PubSub items
2015-02-27 11:40:12 +01:00
Badlop 5a35405cd5 Update copyright dates to 2015 (EJAB-1733) 2015-01-08 17:34:43 +01:00
Holger Weiss d734f6beca Use correct message type for last published items
When sending last published PubSub/PEP items, set the message type
that was used for broadcasting those items originally.
2014-12-21 20:11:05 +01:00
Holger Weiss e5428c5500 Improve add_message_type/2 function
Let add_message_type/2 accept the type as an atom, and let the function
handle the 'normal' message type.  This doesn't change the behavior, but
avoids some code duplication.
2014-12-21 18:44:53 +01:00
Jerome Sautret cc958f7787 Fix upgrade of PubSub mnesia tables from older ejabberd version. 2014-12-18 11:51:28 +01:00
Holger Weiss 9899935e42 Improve interface for adding timestamps
Provide a simpler interface for adding <delay/> and <x/> timestamps to
stanzas.  This also makes sure that only one <delay/> tag and one <x/>
tag is added to a given stanza.
2014-12-07 15:55:18 +01:00
Evgeny Khramtsov e97e56d776 Merge pull request #363 from weiss/drop-pep-errors
Don't route PEP error messages to clients
2014-11-25 14:20:11 +03:00
Holger Weiss 30687c40ef Don't route PEP error messages to clients 2014-11-24 21:19:32 +01:00
Holger Weiss 84c227e6ae Don't duplicate last published PEP items
When a contact becomes available, usually both the 'caps_update' hook
and the 'presence_probe_hook' are called.  For remote contacts, both
hooks triggered PEP notifications, so each item was sent twice.  Fix
this by ignoring the 'presence_probe_hook' for remote contacts.
2014-11-18 01:13:22 +01:00
Holger Weiss f69d1ca282 Send last PEP items to remote subscribers
When a remote subscriber becomes available, send him the last published
PEP items, as we do for local subscribers.

However, the current implementation depends on a running ejabberd_c2s
process of the publisher to send items to remote subscribers.  So, for
those, the behavior is always like it is for local subscribers when
"ignore_pep_from_offline" is set to "true".
2014-11-14 01:33:11 +01:00
Holger Weiss 830fdccd21 Don't broadcast last published PEP items
When a client becomes available, don't send the last published PEP items
of all his peers to all his other peers, but only to that client.
2014-11-14 01:03:26 +01:00
Holger Weiss 5cc30c3977 Move routing of last PEP items into new function
This doesn't change the behavior, but avoids some code duplication.
2014-11-14 00:16:13 +01:00
Nathan Bruning 4f63cb21c2 Fix migration of pubsub nodes. Was deleting and re-creating all nodes on each startup. 2014-08-03 21:03:16 +02:00
Nathan Bruning 99c28ab4d6 Fix configuraton with custom nodetree plugin 2014-07-15 12:04:06 +02:00
Christophe Romain 58717923eb Fix PEP broadcasting issue (EJAB-1680) 2014-05-06 12:37:44 +02:00
Christophe Romain a6244275b7 remove compilation warnings 2014-05-05 18:16:48 +02:00
Christophe Romain 4bdf1bc7a6 avoid sending duplicated events 2014-05-05 17:53:50 +02:00
Christophe Romain faa6ad26a0 avoid sending empty events 2014-05-05 17:53:44 +02:00
Christophe Romain 530ac43758 store item when persist_item=false and cache_last_item=false but need last_item 2014-05-05 17:40:42 +02:00
Nathan Bruning f3aa74a043 Fix small bug in presence_based_delivery implementation 2014-05-05 14:14:03 +02:00
Badlop 633d47f784 Update copyright dates to 2014 (EJAB-1679) 2014-03-13 12:30:57 +01:00
Badlop a6b0e18bde add Pubsub data migration from mnesia to odbc (EJAB-1126)
By calling:
  ejd2odbc:export_pubsub("localhost","/tmp/aa.txt").
it will generate SQL files like these:
  /tmp/pubsub_item.txt
  /tmp/pubsub_node.txt
  /tmp/pubsub_state.txt

Conflicts:
	src/ejabberd_admin.erl
	src/ejd2odbc.erl
2013-11-14 19:29:16 +01:00
Christophe Romain 63b2d21b13 clean subscriptions handling and avoid function_clause 2013-08-27 14:46:54 +02:00
Christophe Romain b82eeeeec9 fix call to get_session_pid with binary arguments 2013-08-27 14:46:22 +02:00
Christophe Romain 8621a8f006 fix invalid response on get_options when no options set (EJAB-1648) 2013-07-09 18:11:27 +02:00
Christophe Romain ae1af885ce fix feature build on node disco#info 2013-06-25 14:49:22 +02:00
Christophe Romain 0c60718bef fix empty itemid on publish when passing Access 2013-06-20 17:51:07 +02:00
Christophe Romain 4221d56c04 fix pubsub issue on binary switch 2013-06-20 17:07:40 +02:00
Evgeniy Khramtsov 8ea41718ac Fix node auto-creation 2013-06-18 04:11:54 +10:00
Christophe Romain 08fc6df853 fix auto-create issue due to bad binary matching 2013-06-17 16:30:20 +02:00
Christophe Romain 26b815f52d cosmetic changes, move badly placed comments 2013-06-14 00:04:25 +02: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