]> granicus.if.org Git - ejabberd/commitdiff
Move copyright definition to ejabberd.hrl
authorEvgeniy Khramtsov <ekhramtsov@process-one.net>
Wed, 23 Nov 2016 12:51:48 +0000 (15:51 +0300)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Wed, 23 Nov 2016 12:51:48 +0000 (15:51 +0300)
include/ejabberd.hrl
src/mod_irc.erl
src/mod_muc.erl
src/mod_multicast.erl
src/mod_proxy65_service.erl
src/mod_pubsub.erl
src/mod_vcard.erl
test/proxy65_tests.erl
test/pubsub_tests.erl
test/vcard_tests.erl

index 7a6df564409cf58811d63e42caaeb5c478f7b627..391089a0e7d92a08b2d39459a4140b51e32b6771 100644 (file)
@@ -39,6 +39,8 @@
 
 -define(EJABBERD_URI, <<"http://www.process-one.net/en/ejabberd/">>).
 
+-define(COPYRIGHT, "Copyright (c) 2002-2016 ProcessOne").
+
 -define(S2STIMEOUT, timer:minutes(10)).
 
 %%-define(DBGFSM, true).
index 2fb35414d5e945e580800b2089595abf80b33663..3dd0e492dc56333c376ff28ba128ae75d08cd914 100644 (file)
@@ -420,10 +420,9 @@ iq_disco(ServerHost, Node, Lang) ->
 
 iq_get_vcard(Lang) ->
     Desc = translate:translate(Lang, <<"ejabberd IRC module">>),
-    Copyright = <<"Copyright (c) 2003-2016 ProcessOne">>,
     #vcard_temp{fn = <<"ejabberd/mod_irc">>,
                url = ?EJABBERD_URI,
-               desc = <<Desc/binary, $\n, Copyright/binary>>}.
+               desc = <<Desc/binary, $\n, ?COPYRIGHT>>}.
 
 command_items(ServerHost, Host, Lang) ->
     lists:map(fun({Node, Name, _Function}) ->
index 28008aaaea6a31b5f4351fca2920b1fcc7ff4a7d..554a2170499116c101039da35727fc5e43e95901 100644 (file)
@@ -429,11 +429,10 @@ do_route1(Host, ServerHost, Access, HistorySize, RoomShaper,
 -spec process_vcard(iq()) -> iq().
 process_vcard(#iq{type = get, lang = Lang, sub_els = [#vcard_temp{}]} = IQ) ->
     Desc = translate:translate(Lang, <<"ejabberd MUC module">>),
-    Copyright = <<"Copyright (c) 2003-2016 ProcessOne">>,
     xmpp:make_iq_result(
       IQ, #vcard_temp{fn = <<"ejabberd/mod_muc">>,
                      url = ?EJABBERD_URI,
-                     desc = <<Desc/binary, $\n, Copyright/binary>>});
+                     desc = <<Desc/binary, $\n, ?COPYRIGHT>>});
 process_vcard(#iq{type = set, lang = Lang} = IQ) ->
     Txt = <<"Value 'set' of 'type' attribute is not allowed">>,
     xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang));
index 72046491fb0f6bfe01b4f130799a931f2efa39bb..0aa2270ae35573b650622c0b5b3316935b4e05a2 100644 (file)
@@ -268,10 +268,9 @@ iq_disco_info(From, Lang, State) ->
 
 iq_vcard(Lang) ->
     Desc = translate:translate(Lang, <<"ejabberd Multicast service">>),
-    Copyright = <<"Copyright (c) 2002-2016 ProcessOne">>,
     #vcard_temp{fn = <<"ejabberd/mod_multicast">>,
                url = ?EJABBERD_URI,
-               desc = <<Desc/binary, $\n, Copyright/binary>>}.
+               desc = <<Desc/binary, $\n, ?COPYRIGHT>>}.
 
 %%%-------------------------
 %%% Route
index 789771d7dbcc4641d9042380bb68a31565ce0e7f..0f69086e0c3d8a3d156d2dcf4e5b7f415e73256f 100644 (file)
@@ -136,11 +136,10 @@ process_vcard(#iq{type = set, lang = Lang} = IQ) ->
     xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang));
 process_vcard(#iq{type = get, lang = Lang} = IQ) ->
     Desc = translate:translate(Lang, <<"ejabberd SOCKS5 Bytestreams module">>),
-    Copyright = <<"Copyright (c) 2003-2016 ProcessOne">>,
     xmpp:make_iq_result(
       IQ, #vcard_temp{fn = <<"ejabberd/mod_proxy65">>,
                      url = ?EJABBERD_URI,
-                     desc = <<Desc/binary, $\n, Copyright/binary>>}).
+                     desc = <<Desc/binary, $\n, ?COPYRIGHT>>}).
 
 -spec process_bytestreams(iq()) -> iq().
 process_bytestreams(#iq{type = get, from = JID, to = To, lang = Lang} = IQ) ->
index a138b1896842560f2c96704048e5e19bd61aad80..c379760edb1d68f463009fde089d59711386ea5b 100644 (file)
@@ -1186,10 +1186,9 @@ iq_sm(#iq{to = To, sub_els = [SubEl]} = IQ) ->
 -spec iq_get_vcard(binary()) -> vcard_temp().
 iq_get_vcard(Lang) ->
     Desc = translate:translate(Lang, <<"ejabberd Publish-Subscribe module">>),
-    Copyright = <<"Copyright (c) 2004-2016 ProcessOne">>,
     #vcard_temp{fn = <<"ejabberd/mod_pubsub">>,
                url = ?EJABBERD_URI,
-               desc = <<Desc/binary, $\n, Copyright/binary>>}.
+               desc = <<Desc/binary, $\n, ?COPYRIGHT>>}.
 
 -spec iq_pubsub(binary() | ljid(), atom(), iq()) ->
                       {result, pubsub()} | {error, stanza_error()}.
index dc947620605f1dad01714341cbb5ba23a6d6e9ca..843281ef8d277f11fe89afdb3e0035734106baec 100644 (file)
@@ -191,11 +191,10 @@ process_local_iq(#iq{type = set, lang = Lang} = IQ) ->
     xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang));
 process_local_iq(#iq{type = get, lang = Lang} = IQ) ->
     Desc = translate:translate(Lang, <<"Erlang Jabber Server">>),
-    Copyright = <<"Copyright (c) 2002-2016 ProcessOne">>,
     xmpp:make_iq_result(
       IQ, #vcard_temp{fn = <<"ejabberd">>,
                      url = ?EJABBERD_URI,
-                     desc = <<Desc/binary, $\n, Copyright/binary>>,
+                     desc = <<Desc/binary, $\n, ?COPYRIGHT>>,
                      bday = <<"2002-11-16">>}).
 
 -spec process_sm_iq(iq()) -> iq().
@@ -228,11 +227,10 @@ process_vcard(#iq{type = set, lang = Lang} = IQ) ->
     xmpp:make_error(IQ, xmpp:err_not_allowed(Txt, Lang));
 process_vcard(#iq{type = get, lang = Lang} = IQ) ->
     Desc = translate:translate(Lang, <<"ejabberd vCard module">>),
-    Copyright = <<"Copyright (c) 2003-2016 ProcessOne">>,
     xmpp:make_iq_result(
       IQ, #vcard_temp{fn = <<"ejabberd/mod_vcard">>,
                      url = ?EJABBERD_URI,
-                     desc = <<Desc/binary, $\n, Copyright/binary>>}).
+                     desc = <<Desc/binary, $\n, ?COPYRIGHT>>}).
 
 -spec process_search(iq()) -> iq().
 process_search(#iq{type = get, to = To, lang = Lang} = IQ) ->
index 01292f508b15a22a0c3ea1f5e5fdd43f27938d85..49e195d38eafbe257eb91e91ef8485aa9c3920db 100644 (file)
 %%%===================================================================
 single_cases() ->
     {proxy65_single, [sequence],
-     [single_test(feature_enabled)]}.
+     [single_test(feature_enabled),
+      single_test(service_vcard)]}.
 
 feature_enabled(Config) ->
     true = is_feature_advertised(Config, ?NS_BYTESTREAMS, proxy_jid(Config)),
     disconnect(Config).
 
+service_vcard(Config) ->
+    JID = proxy_jid(Config),
+    ct:comment("Retreiving vCard from ~s", [jid:to_string(JID)]),
+    #iq{type = result, sub_els = [#vcard_temp{}]} =
+       send_recv(Config, #iq{type = get, to = JID, sub_els = [#vcard_temp{}]}),
+    disconnect(Config).
+
 %%%===================================================================
 %%% Master-slave tests
 %%%===================================================================
index fae7234e40a196df085f844543113b952555fdb4..daffc29ecdac6225f98aa23dacca5ebad363895b 100644 (file)
@@ -25,6 +25,7 @@
 single_cases() ->
     {pubsub_single, [sequence],
      [single_test(test_features),
+      single_test(test_vcard),
       single_test(test_create),
       single_test(test_configure),
       single_test(test_delete),
@@ -67,6 +68,13 @@ test_features(Config) ->
     true = sets:is_subset(NeededFeatures, AllFeatures),
     disconnect(Config).
 
+test_vcard(Config) ->
+    JID = pubsub_jid(Config),
+    ct:comment("Retreiving vCard from ~s", [jid:to_string(JID)]),
+    #iq{type = result, sub_els = [#vcard_temp{}]} =
+       send_recv(Config, #iq{type = get, to = JID, sub_els = [#vcard_temp{}]}),
+    disconnect(Config).
+
 test_create(Config) ->
     Node = ?config(pubsub_node, Config),
     Node = create_node(Config, Node),
index bb3efb4758579b4a54498edd9eec48dc1d90cea5..26cfdc92b24d642ec2e5e51b1357b19ec3595957 100644 (file)
@@ -11,7 +11,7 @@
 %% API
 -compile(export_all).
 -import(suite, [send_recv/2, disconnect/1, is_feature_advertised/2,
-               is_feature_advertised/3,
+               is_feature_advertised/3, server_jid/1,
                my_jid/1, wait_for_slave/1, wait_for_master/1,
                recv_presence/1, recv/1]).
 
@@ -26,7 +26,8 @@
 single_cases() ->
     {vcard_single, [sequence],
      [single_test(feature_enabled),
-      single_test(get_set)]}.
+      single_test(get_set),
+      single_test(service_vcard)]}.
 
 feature_enabled(Config) ->
     BareMyJID = jid:remove_resource(my_jid(Config)),
@@ -72,6 +73,13 @@ get_set(Config) ->
         send_recv(Config, #iq{type = get, sub_els = [#vcard_temp{}]}),
     disconnect(Config).
 
+service_vcard(Config) ->
+    JID = server_jid(Config),
+    ct:comment("Retreiving vCard from ~s", [jid:to_string(JID)]),
+    #iq{type = result, sub_els = [#vcard_temp{}]} =
+       send_recv(Config, #iq{type = get, to = JID, sub_els = [#vcard_temp{}]}),
+    disconnect(Config).
+
 %%%===================================================================
 %%% Master-slave tests
 %%%===================================================================