diff options
author | Pablo Polvorin <pablo.polvorin@process-one.net> | 2009-08-06 19:45:13 +0400 |
---|---|---|
committer | Pablo Polvorin <pablo.polvorin@process-one.net> | 2009-08-06 19:45:13 +0400 |
commit | 1b85310f1a4134aa6b1f6b337e2c38b6030038c5 (patch) | |
tree | 0b117ba31a7e7249748e9914a9dc20b89ac907e3 /src/ejabberd_c2s.erl | |
parent | 6aa3706bec0499f6a2ebaae28694632df9f71815 (diff) |
Support for roster versioning (EJAB-964)
Introduces two options for mod_roster and mod_roster_odbc:
- {versioning, true | false} Enable or disable roster versioning on ejabberd.
- {store_current_id, true | false} If true, the current roster version is stored on DB (internal or odbc). Otherwise it is calculated on the fly each time.
Performance:
Setting store_current_id to true should help in reducing the load for both ejabberd and the DB.
Details:
If store_current_id is false, the roster version is a hash of the entire roster. If store_current_id is true, the roster version is a hash, but of the current time
(this has to do with transactional semantics; we need to perform both the roster update and the version update on the same transaction, but we don't
have the entire roster when we are changing a single item on DB. Loading it there requires significant changes to be introduced, so I opted for this simpler approach).
In either case, there is no difference for the clients, the roster version ID is opaque.
IMPORTANT:
mod_shared_roster is not compatible with the option 'store_current_id'. Shared roster and roster versioning can be both enabled, but store_current_id MUST be set to false.
SVN Revision: 2428
Diffstat (limited to 'src/ejabberd_c2s.erl')
-rw-r--r-- | src/ejabberd_c2s.erl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index f77c35a9d..e61b9e987 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -310,12 +310,17 @@ wait_for_stream({xmlstreamstart, #xmlel{ns = NS} = Opening}, StateData) -> _ -> case StateData#state.resource of undefined -> + RosterVersioningFeature = + case roster_versioning:is_enabled(ServerB) of + true -> [roster_versioning:stream_feature()]; + false -> [] + end, send_element( StateData, exmpp_stream:features([ exmpp_server_binding:feature(), exmpp_server_session:feature() - ])), + | RosterVersioningFeature])), fsm_next_state(wait_for_bind, StateData#state{ server = ServerB, |