25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

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; [#roster_version{version = V}] -> V;
[] -> error [] -> error
end; end;
read_roster_version(LServer, LUser, odbc) -> read_roster_version(LUser, LServer, odbc) ->
Username = ejabberd_odbc:escape(LUser), Username = ejabberd_odbc:escape(LUser),
case odbc_queries:get_roster_version(LServer, Username) case odbc_queries:get_roster_version(LServer, Username)
of of

View File

@ -161,6 +161,7 @@ db_tests() ->
presence_broadcast, presence_broadcast,
last, last,
roster_get, roster_get,
roster_ver,
private, private,
privacy, privacy,
blocking, blocking,
@ -308,6 +309,29 @@ roster_get(Config) ->
send_recv(Config, #iq{type = get, sub_els = [#roster{}]}), send_recv(Config, #iq{type = get, sub_els = [#roster{}]}),
disconnect(Config). 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) -> presence(Config) ->
send(Config, #presence{}), send(Config, #presence{}),
JID = my_jid(Config), JID = my_jid(Config),

View File

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