Fix roster version support

This commit is contained in:
Evgeniy Khramtsov 2013-09-24 18:40:32 +10:00
parent 7fd91a4b12
commit 07c8bf5064
3 changed files with 32 additions and 2 deletions

View File

@ -196,7 +196,7 @@ read_roster_version(LUser, LServer, mnesia) ->
[#roster_version{version = V}] -> V;
[] -> error
end;
read_roster_version(LServer, LUser, odbc) ->
read_roster_version(LUser, LServer, odbc) ->
Username = ejabberd_odbc:escape(LUser),
case odbc_queries:get_roster_version(LServer, Username)
of

View File

@ -161,6 +161,7 @@ db_tests() ->
presence_broadcast,
last,
roster_get,
roster_ver,
private,
privacy,
blocking,
@ -308,6 +309,29 @@ roster_get(Config) ->
send_recv(Config, #iq{type = get, sub_els = [#roster{}]}),
disconnect(Config).
roster_ver(Config) ->
%% Get initial "ver"
#iq{type = result, sub_els = [#roster{ver = Ver1, items = []}]} =
send_recv(Config, #iq{type = get,
sub_els = [#roster{ver = <<"">>}]}),
%% Should receive empty IQ-result
#iq{type = result, sub_els = []} =
send_recv(Config, #iq{type = get,
sub_els = [#roster{ver = Ver1}]}),
%% Attempting to subscribe to server's JID
send(Config, #presence{type = subscribe, to = server_jid(Config)}),
%% Receive a single roster push with the new "ver"
#iq{type = set, sub_els = [#roster{ver = Ver2}]} = recv(),
%% Requesting roster with the previous "ver". Should receive Ver2 again
#iq{type = result, sub_els = [#roster{ver = Ver2}]} =
send_recv(Config, #iq{type = get,
sub_els = [#roster{ver = Ver1}]}),
%% Now requesting roster with the newest "ver". Should receive empty IQ.
#iq{type = result, sub_els = []} =
send_recv(Config, #iq{type = get,
sub_els = [#roster{ver = Ver2}]}),
disconnect(Config).
presence(Config) ->
send(Config, #presence{}),
JID = my_jid(Config),

View File

@ -33,7 +33,9 @@ host_config:
- "flat"
- "hometree"
- "pep"
mod_roster:
mod_roster:
versioning: true
store_current_id: true
db_type: odbc
mod_vcard:
db_type: odbc
@ -85,6 +87,8 @@ Welcome to this XMPP server."
- "hometree"
- "pep"
mod_roster:
versioning: true
store_current_id: true
db_type: odbc
mod_vcard:
db_type: odbc
@ -129,6 +133,8 @@ Welcome to this XMPP server."
- "hometree"
- "pep"
mod_roster:
versioning: true
store_current_id: true
db_type: internal
mod_vcard:
db_type: internal