Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix indentation + add unit test for unsubscribe

  • Loading branch information...
commit fac7bde2bfcd0b6cc6b605b6c06cdfd28c7509d9 1 parent 6216a38
@nniclausse nniclausse authored
View
2  include/ts_jabber.hrl
@@ -51,7 +51,7 @@
node, %% pubsub node
resource,
node_type,
- subid
+ subid
}).
-define(setroster_intensity, 1/(ts_utils:get_val(setroster)*1000)).
View
10 src/test/ts_test_jabber.erl
@@ -114,6 +114,16 @@ get_message2_test()->
Rep=ts_jabber:get_message(Req,#state_rcv{}),
?assertEqual(RepOK,Rep ).
+pubsub_unsubscribe_test()->
+ erase(xmpp_user_id),
+ ts_msg_server:start(),
+ ts_user_server:reset(1),
+ Session = #jabber{id=0,username="foo",type='pubsub:unsubscribe',passwd="bar",domain={domain,"localdomain"},dest=random, node="node", pubsub_service="mypubsub", subid="myid",resource="tsung"},
+ Req=ts_jabber:add_dynparams(false,[],Session,"localhost"),
+ RepOK= << "<iq to='mypubsub' type='set' id='3'><pubsub xmlns='http://jabber.org/protocol/pubsub'><unsubscribe node='/home/localdomain/2/node' jid='foo1@localdomain' subid='myid'/></pubsub></iq>" >>,
+ {Rep,_}=ts_jabber:get_message(Req,#state_rcv{}),
+ ?assertEqual(RepOK,Rep ).
+
choose_id_limit_test()->
ts_user_server:reset(3),
View
14 src/tsung/ts_jabber_common.erl
@@ -608,13 +608,13 @@ subscribe_pubsub_node(Domain, PubSubComponent, UserFrom, UserTo, Node) ->
unsubscribe_pubsub_node(Domain, PubSubComponent, UserFrom, UserTo, Node, SubId) ->
list_to_binary(["<iq to='", PubSubComponent, "' type='set' id='", ts_msg_server:get_id(list),"'>"
"<pubsub xmlns='http://jabber.org/protocol/pubsub'>"
- "<unsubscribe",
- pubsub_node_attr(Node, Domain, UserTo),
- " jid='", UserFrom, "@", Domain, "'"
- " subid='", SubId, "'"
- "/>"
- "</pubsub>"
- "</iq>"]).
+ "<unsubscribe",
+ pubsub_node_attr(Node, Domain, UserTo),
+ " jid='", UserFrom, "@", Domain, "'",
+ " subid='", SubId, "'",
+ "/>",
+ "</pubsub>",
+ "</iq>"]).
%%%----------------------------------------------------------------------
%%% Func: publish_pubsub_node/4
View
3  src/tsung_controller/ts_config_jabber.erl
@@ -90,8 +90,7 @@ parse_config(Element = #xmlElement{name=jabber},
%% offline_user()
%% Otherwise: (any other string)
%% The specified string
-
- SubId = ts_config:getAttr(string, Element#xmlElement.attributes, 'subid', undefined),
+ SubId = ts_config:getAttr(string, Element#xmlElement.attributes, 'subid', undefined),
Domain =ts_config:get_default(Tab, jabber_domain_name, jabber_domain),
MUC_service = ts_config:get_default(Tab, muc_service, muc_service),
Please sign in to comment.
Something went wrong with that request. Please try again.