Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add option to use legacy stream (no version send) (TSUN-230)

  • Loading branch information...
commit 12cdf334857c751c51cad60c31d7fa5898e13983 1 parent 2dbe72e
Nicolas Niclausse nniclausse authored
3  include/ts_jabber.hrl
View
@@ -51,7 +51,8 @@
node, %% pubsub node
resource,
node_type,
- subid
+ subid,
+ version %% 1.0 or "legacy", used by type=connect
}).
-define(setroster_intensity, 1/(ts_utils:get_val(setroster)*1000)).
21 src/test/ts_test_jabber.erl
View
@@ -124,6 +124,25 @@ pubsub_unsubscribe_test()->
{Rep,_}=ts_jabber:get_message(Req,#state_rcv{}),
?assertEqual(RepOK,Rep ).
+connect_legacy_test()->
+ erase(xmpp_user_id),
+ ts_msg_server:start(),
+ ts_user_server:reset(1),
+ Session = #jabber{id=0,username="foo",type='connect',passwd="bar",domain={domain,"localdomain"},resource="tsung", version="legacy"},
+ Req=ts_jabber:add_dynparams(false,[],Session,"localhost"),
+ RepOK= <<"<?xml version='1.0'?><stream:stream id='4' to='localdomain' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams'>" >>,
+ {Rep,_} = ts_jabber:get_message(Req,#state_rcv{}),
+ ?assertEqual(RepOK,Rep).
+
+connect_xmpp_test()->
+ erase(xmpp_user_id),
+ ts_msg_server:start(),
+ ts_user_server:reset(1),
+ Session = #jabber{id=0,username="foo",type='connect',passwd="bar",domain={domain,"localdomain"},resource="tsung", version="1.0"},
+ Req=ts_jabber:add_dynparams(false,[],Session,"localhost"),
+ RepOK= <<"<?xml version='1.0'?><stream:stream id='5' to='localdomain' xmlns='jabber:client' version='1.0' xmlns:stream='http://etherx.jabber.org/streams'>" >>,
+ {Rep,_} = ts_jabber:get_message(Req,#state_rcv{}),
+ ?assertEqual(RepOK,Rep).
choose_id_limit_test()->
ts_user_server:reset(3),
@@ -136,8 +155,6 @@ choose_id_limit_test()->
erase(xmpp_user_id),
?assertExit(no_free_userid, ts_jabber:choose_or_cache_user_id(0,"user","pwd")).
-
-
myset_env()->
myset_env(0).
myset_env(Val)->
10 src/tsung/ts_jabber_common.erl
View
@@ -277,13 +277,19 @@ get_message2(Jabber=#jabber{type = 'auth_sasl_session'}) ->
%%----------------------------------------------------------------------
%% Func: connect/1
%%----------------------------------------------------------------------
-connect(#jabber{domain=Domain}) ->
+connect(#jabber{domain=Domain, version = Version}) ->
+ VersionStr = case Version of
+ "legacy" ->
+ "";
+ V when is_list(V) ->
+ "version='" ++ Version ++"' "
+ end,
list_to_binary([
"<?xml version='1.0'?><stream:stream id='",
ts_msg_server:get_id(list),
"' to='",
Domain,
- "' xmlns='jabber:client' version='1.0' xmlns:stream='http://etherx.jabber.org/streams'>"]).
+ "' xmlns='jabber:client' ",VersionStr,"xmlns:stream='http://etherx.jabber.org/streams'>"]).
%%----------------------------------------------------------------------
%% Func: close/0
4 src/tsung_controller/ts_config_jabber.erl
View
@@ -60,6 +60,7 @@ parse_config(Element = #xmlElement{name=jabber},
Status= ts_config:getAttr(string,Element#xmlElement.attributes, status, "Available"),
Resource= ts_config:getAttr(string,Element#xmlElement.attributes, resource, "tsung"),
Type= list_to_atom(TypeStr),
+ Version = ts_config:getAttr(string,Element#xmlElement.attributes, version, "1.0"),
Room = ts_config:getAttr(string,Element#xmlElement.attributes, room, undefined),
Nick = ts_config:getAttr(string,Element#xmlElement.attributes, nick, undefined),
Group = ts_config:getAttr(string,Element#xmlElement.attributes, group, "Tsung Group"),
@@ -138,7 +139,8 @@ parse_config(Element = #xmlElement{name=jabber},
pubsub_service = PubSub_service,
node = Node,
node_type = NodeType,
- subid = SubId
+ subid = SubId,
+ version = Version
}
},
ts_config:mark_prev_req(Id-1, Tab, CurS),
1  tsung-1.0.dtd
View
@@ -224,6 +224,7 @@ repeat | if | change_type | foreach | set_option)*>
regexp CDATA #IMPLIED
resource CDATA "tsung"
node_type CDATA #IMPLIED
+ version CDATA #IMPLIED
subid CDATA #IMPLIED >
<!ELEMENT xmpp_authenticate EMPTY >
Please sign in to comment.
Something went wrong with that request. Please try again.