Permalink
Browse files

Add a new option to send xmpp version in stream header

Add a new option "send_version" to the jabber connect
request. If enabled, tsung will use version="1.0" in the
stream header (needed for sasl authentication) if not,
tsung won't send the version attribute (and legacy auth
can be used).
  • Loading branch information...
1 parent 76d3f29 commit f61755ab40fc30efb70fa3040fd901611a24e116 @ppolv ppolv committed Aug 24, 2010
Showing with 11 additions and 5 deletions.
  1. +2 −1 include/ts_jabber.hrl
  2. +4 −2 src/tsung/ts_jabber_common.erl
  3. +3 −1 src/tsung_controller/ts_config_jabber.erl
  4. +2 −1 tsung-1.0.dtd
View
@@ -48,7 +48,8 @@
pubsub_service, %%ej: pubsub.localhost
group, %% roster group
node, %% pubsub node
- node_type
+ node_type,
+ send_version %% if true, send version='1.0' on stream headers
}).
-define(setroster_intensity, 1/(ts_utils:get_val(setroster)*1000)).
@@ -241,13 +241,15 @@ get_message2(Jabber=#jabber{type = 'auth_sasl_session'}) ->
%%----------------------------------------------------------------------
%% Func: connect/1
%%----------------------------------------------------------------------
-connect(#jabber{domain=Domain}) ->
+connect(#jabber{domain=Domain, send_version = SendVersion}) ->
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' ",
+ if SendVersion -> "version='1.0' "; true -> "" end,
+ "xmlns:stream='http://etherx.jabber.org/streams'>"]).
%%----------------------------------------------------------------------
%% Func: close/0
@@ -62,6 +62,7 @@ parse_config(Element = #xmlElement{name=jabber},
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"),
+ SendVersion = ts_config:getAttr(atom,Element#xmlElement.attributes, send_version, false),
Node = case ts_config:getAttr(string, Element#xmlElement.attributes, 'node', undefined) of
"" -> user_root;
X -> X
@@ -115,7 +116,8 @@ parse_config(Element = #xmlElement{name=jabber},
muc_service = MUC_service,
pubsub_service = PubSub_service,
node = Node,
- node_type = NodeType
+ node_type = NodeType,
+ send_version = SendVersion
}
},
ts_config:mark_prev_req(Id-1, Tab, CurS),
View
@@ -198,7 +198,8 @@ repeat | if | change_type )*>
room CDATA #IMPLIED
group CDATA #IMPLIED
node CDATA #IMPLIED
- node_type CDATA #IMPLIED >
+ node_type CDATA #IMPLIED
+ send_version (true | false) "false">
<!ELEMENT fs (#PCDATA) >
<!ATTLIST fs

0 comments on commit f61755a

Please sign in to comment.