disconnect(Config).
ldap_shared_roster_get(Config) ->
- Item = #roster_item{jid = jid:from_string(<<"user2@ldap.localhost">>), name = <<"Test User 2">>,
+ Item = #roster_item{jid = jid:decode(<<"user2@ldap.localhost">>), name = <<"Test User 2">>,
groups = [<<"group1">>], subscription = both},
#iq{type = result, sub_els = [#roster_query{items = [Item]}]} =
send_recv(Config, #iq{type = get, sub_els = [#roster_query{}]}),
JID <- [undefined, server_jid(Config)],
NS <- ?VERSIONS,
Default <- [always, never, roster],
- Always <- [[], [jid:from_string(<<"foo@bar.baz">>)]],
- Never <- [[], [jid:from_string(<<"baz@bar.foo">>)]]],
+ Always <- [[], [jid:decode(<<"foo@bar.baz">>)]],
+ Never <- [[], [jid:decode(<<"baz@bar.foo">>)]]],
lists:foreach(
fun({To, Prefs}) ->
NS = Prefs#mam_prefs.xmlns,
Range = lists:seq(1, 5),
lists:foreach(
fun(JID) ->
- ct:comment("Sending query with jid ~s", [jid:to_string(JID)]),
+ ct:comment("Sending query with jid ~s", [jid:encode(JID)]),
Query = if NS == ?NS_MAM_TMP ->
#mam_query{xmlns = NS, with = JID, id = QID};
true ->
service_vcard(Config) ->
MUC = muc_jid(Config),
- ct:comment("Retreiving vCard from ~s", [jid:to_string(MUC)]),
+ ct:comment("Retreiving vCard from ~s", [jid:encode(MUC)]),
#iq{type = result, sub_els = [#vcard_temp{}]} =
send_recv(Config, #iq{type = get, to = MUC, sub_els = [#vcard_temp{}]}),
disconnect(Config).
service_unique(Config) ->
MUC = muc_jid(Config),
- ct:comment("Requesting muc unique from ~s", [jid:to_string(MUC)]),
+ ct:comment("Requesting muc unique from ~s", [jid:encode(MUC)]),
#iq{type = result, sub_els = [#muc_unique{name = Name}]} =
send_recv(Config, #iq{type = get, to = MUC, sub_els = [#muc_unique{}]}),
ct:comment("Checking if unique name is set in the response"),
disco_items(Config) ->
MUC = muc_jid(Config),
- ct:comment("Performing disco#items request to ~s", [jid:to_string(MUC)]),
+ ct:comment("Performing disco#items request to ~s", [jid:encode(MUC)]),
#iq{type = result, from = MUC, sub_els = [DiscoItems]} =
send_recv(Config, #iq{type = get, to = MUC,
sub_els = [#disco_items{}]}),
set_vcard(Config, VCard) ->
Room = muc_room_jid(Config),
- ct:comment("Setting vCard for ~s", [jid:to_string(Room)]),
+ ct:comment("Setting vCard for ~s", [jid:encode(Room)]),
case send_recv(Config, #iq{type = set, to = Room,
sub_els = [VCard]}) of
#iq{type = result, sub_els = []} ->
get_vcard(Config) ->
Room = muc_room_jid(Config),
- ct:comment("Retreiving vCard from ~s", [jid:to_string(Room)]),
+ ct:comment("Retreiving vCard from ~s", [jid:encode(Room)]),
case send_recv(Config, #iq{type = get, to = Room,
sub_els = [#vcard_temp{}]}) of
#iq{type = result, sub_els = [VCard]} ->
MyJID = my_jid(Config),
MyBareJID = jid:remove_resource(MyJID),
Peer = ?config(peer, Config),
- Peer_s = jid:to_string(Peer),
+ Peer_s = jid:encode(Peer),
ct:comment("Getting headers"),
#iq{type = result,
sub_els = [#disco_items{
deny_bare_jid_master(Config) ->
PeerJID = ?config(peer, Config),
PeerBareJID = jid:remove_resource(PeerJID),
- deny_master(Config, {jid, jid:to_string(PeerBareJID)}).
+ deny_master(Config, {jid, jid:encode(PeerBareJID)}).
deny_bare_jid_slave(Config) ->
deny_slave(Config).
deny_full_jid_master(Config) ->
PeerJID = ?config(peer, Config),
- deny_master(Config, {jid, jid:to_string(PeerJID)}).
+ deny_master(Config, {jid, jid:encode(PeerJID)}).
deny_full_jid_slave(Config) ->
deny_slave(Config).
ServerJID = server_jid(Config),
MyJID = my_jid(Config),
ct:comment("Sending IQs from ~s to ~s",
- [jid:to_string(ServerJID), jid:to_string(MyJID)]),
+ [jid:encode(ServerJID), jid:encode(MyJID)]),
lists:foreach(
fun(Type) ->
ejabberd_router:route(
server_recv_iqs(Config) ->
ServerJID = server_jid(Config),
- ct:comment("Receiving IQs from ~s", [jid:to_string(ServerJID)]),
+ ct:comment("Receiving IQs from ~s", [jid:encode(ServerJID)]),
lists:foreach(
fun(Type) ->
#iq{type = Type, from = ServerJID} = recv_iq(Config)
ServerJIDResource = jid:replace_resource(ServerJID, <<"resource">>),
%% All stanzas sent should be handled by local_send_to_resource_hook
%% and should be bounced with item-not-found error
- ct:comment("Sending IQs to ~s", [jid:to_string(ServerJIDResource)]),
+ ct:comment("Sending IQs to ~s", [jid:encode(ServerJIDResource)]),
lists:foreach(
fun(Type) ->
#iq{type = error} = Err =
send_recv(Config, #iq{type = Type, to = ServerJIDResource}),
#stanza_error{reason = 'item-not-found'} = xmpp:get_error(Err)
end, [set, get]),
- ct:comment("Sending messages to ~s", [jid:to_string(ServerJIDResource)]),
+ ct:comment("Sending messages to ~s", [jid:encode(ServerJIDResource)]),
lists:foreach(
fun(Type) ->
#message{type = error} = Err =
send_recv(Config, #message{type = Type, to = ServerJIDResource}),
#stanza_error{reason = 'item-not-found'} = xmpp:get_error(Err)
end, [normal, chat, groupchat, headline]),
- ct:comment("Sending presences to ~s", [jid:to_string(ServerJIDResource)]),
+ ct:comment("Sending presences to ~s", [jid:encode(ServerJIDResource)]),
lists:foreach(
fun(Type) ->
#presence{type = error} = Err =
service_vcard(Config) ->
JID = proxy_jid(Config),
- ct:comment("Retreiving vCard from ~s", [jid:to_string(JID)]),
+ ct:comment("Retreiving vCard from ~s", [jid:encode(JID)]),
#iq{type = result, sub_els = [#vcard_temp{}]} =
send_recv(Config, #iq{type = get, to = JID, sub_els = [#vcard_temp{}]}),
disconnect(Config).
socks5_connect(#streamhost{host = Host, port = Port},
{SID, JID1, JID2}) ->
- Hash = p1_sha:sha([SID, jid:to_string(JID1), jid:to_string(JID2)]),
+ Hash = p1_sha:sha([SID, jid:encode(JID1), jid:encode(JID2)]),
{ok, Sock} = gen_tcp:connect(binary_to_list(Host), Port,
[binary, {active, false}]),
Init = <<?VERSION_5, 1, ?AUTH_ANONYMOUS>>,
test_vcard(Config) ->
JID = pubsub_jid(Config),
- ct:comment("Retreiving vCard from ~s", [jid:to_string(JID)]),
+ ct:comment("Retreiving vCard from ~s", [jid:encode(JID)]),
#iq{type = result, sub_els = [#vcard_temp{}]} =
send_recv(Config, #iq{type = get, to = JID, sub_els = [#vcard_temp{}]}),
disconnect(Config).
disconnect(Config).
set_item(Config) ->
- JID = jid:from_string(<<"nurse@example.com">>),
+ JID = jid:decode(<<"nurse@example.com">>),
Item = #roster_item{jid = JID},
{V1, Item} = set_items(Config, [Item]),
{V1, [Item]} = get_items(Config),
del_roster(disconnect(Config), JID).
iq_set_many_items(Config) ->
- J1 = jid:from_string(<<"nurse1@example.com">>),
- J2 = jid:from_string(<<"nurse2@example.com">>),
+ J1 = jid:decode(<<"nurse1@example.com">>),
+ J2 = jid:decode(<<"nurse2@example.com">>),
ct:comment("Trying to send roster-set with many <item/> elements"),
Items = [#roster_item{jid = J1}, #roster_item{jid = J2}],
#stanza_error{reason = 'bad-request'} = set_items(Config, Items),
disconnect(Config).
iq_set_duplicated_groups(Config) ->
- JID = jid:from_string(<<"nurse@example.com">>),
+ JID = jid:decode(<<"nurse@example.com">>),
G = randoms:get_string(),
ct:comment("Trying to send roster-set with duplicated groups"),
Item = #roster_item{jid = JID, groups = [G, G]},
disconnect(Config).
iq_set_ask(Config) ->
- JID = jid:from_string(<<"nurse@example.com">>),
+ JID = jid:decode(<<"nurse@example.com">>),
ct:comment("Trying to send roster-set with 'ask' included"),
Item = #roster_item{jid = JID, ask = subscribe},
#stanza_error{reason = 'bad-request'} = set_items(Config, [Item]),
disconnect(Config).
iq_get_item(Config) ->
- JID = jid:from_string(<<"nurse@example.com">>),
+ JID = jid:decode(<<"nurse@example.com">>),
ct:comment("Trying to send roster-get with <item/> element"),
#iq{type = error} = Err3 =
send_recv(Config, #iq{type = get,
disconnect(Config).
iq_unexpected_element(Config) ->
- JID = jid:from_string(<<"nurse@example.com">>),
+ JID = jid:decode(<<"nurse@example.com">>),
ct:comment("Trying to send IQs with unexpected element"),
lists:foreach(
fun(Type) ->
disconnect(Config).
version(Config) ->
- JID = jid:from_string(<<"nurse@example.com">>),
+ JID = jid:decode(<<"nurse@example.com">>),
ct:comment("Requesting roster"),
{InitialVersion, _} = get_items(Config, <<"">>),
ct:comment("Requesting roster with initial version"),
get_features(Config, server_jid(Config)).
get_features(Config, To) ->
- ct:comment("Getting features of ~s", [jid:to_string(To)]),
+ ct:comment("Getting features of ~s", [jid:encode(To)]),
#iq{type = result, sub_els = [#disco_info{features = Features}]} =
send_recv(Config, #iq{type = get, sub_els = [#disco_info{}], to = To}),
Features.
PeerBareJID = jid:remove_resource(PeerJID),
PeerLJID = jid:tolower(PeerBareJID),
ct:comment("Adding ~s to roster with subscription '~s' in groups ~p",
- [jid:to_string(PeerBareJID), Subscription, Groups]),
+ [jid:encode(PeerBareJID), Subscription, Groups]),
{atomic, _} = mod_roster:set_roster(#roster{usj = {U, S, PeerLJID},
us = {U, S},
jid = PeerLJID,
{U, S, _} = jid:tolower(MyJID),
PeerBareJID = jid:remove_resource(PeerJID),
PeerLJID = jid:tolower(PeerBareJID),
- ct:comment("Removing ~s from roster", [jid:to_string(PeerBareJID)]),
+ ct:comment("Removing ~s from roster", [jid:encode(PeerBareJID)]),
{atomic, _} = mod_roster:del_roster(U, S, PeerLJID),
Config.
service_vcard(Config) ->
JID = server_jid(Config),
- ct:comment("Retreiving vCard from ~s", [jid:to_string(JID)]),
+ ct:comment("Retreiving vCard from ~s", [jid:encode(JID)]),
#iq{type = result, sub_els = [#vcard_temp{}]} =
send_recv(Config, #iq{type = get, to = JID, sub_els = [#vcard_temp{}]}),
disconnect(Config).