|
Line 0
Link Here
|
|
|
1 |
--- src/mod_pubsub.erl.orig 2016-09-07 00:45:01 UTC |
| 2 |
+++ src/mod_pubsub.erl |
| 3 |
@@ -232,7 +232,7 @@ stop(Host) -> |
| 4 |
%% {stop, Reason} |
| 5 |
%% Description: Initiates the server |
| 6 |
%%-------------------------------------------------------------------- |
| 7 |
--spec(init/1 :: |
| 8 |
+-spec(init |
| 9 |
( |
| 10 |
[binary() | [{_,_}],...]) |
| 11 |
-> {'ok',state()} |
| 12 |
@@ -478,7 +478,7 @@ send_loop(State) -> |
| 13 |
%% disco hooks handling functions |
| 14 |
%% |
| 15 |
|
| 16 |
--spec(disco_local_identity/5 :: |
| 17 |
+-spec(disco_local_identity |
| 18 |
( |
| 19 |
Acc :: [xmlel()], |
| 20 |
_From :: jid(), |
| 21 |
@@ -500,7 +500,7 @@ disco_local_identity(Acc, _From, To, <<> |
| 22 |
disco_local_identity(Acc, _From, _To, _Node, _Lang) -> |
| 23 |
Acc. |
| 24 |
|
| 25 |
--spec(disco_local_features/5 :: |
| 26 |
+-spec(disco_local_features |
| 27 |
( |
| 28 |
Acc :: [xmlel()], |
| 29 |
_From :: jid(), |
| 30 |
@@ -526,7 +526,7 @@ disco_local_items(Acc, _From, _To, _Node |
| 31 |
% when is_binary(Node) -> |
| 32 |
% disco_sm_identity(Acc, From, To, iolist_to_binary(Node), |
| 33 |
% Lang); |
| 34 |
--spec(disco_sm_identity/5 :: |
| 35 |
+-spec(disco_sm_identity |
| 36 |
( |
| 37 |
Acc :: empty | [xmlel()], |
| 38 |
From :: jid(), |
| 39 |
@@ -569,7 +569,7 @@ disco_identity(Host, Node, From) -> |
| 40 |
_ -> [] |
| 41 |
end. |
| 42 |
|
| 43 |
--spec(disco_sm_features/5 :: |
| 44 |
+-spec(disco_sm_features |
| 45 |
( |
| 46 |
Acc :: empty | {result, Features::[Feature::binary()]}, |
| 47 |
From :: jid(), |
| 48 |
@@ -605,7 +605,7 @@ disco_features(Host, Node, From) -> |
| 49 |
_ -> [] |
| 50 |
end. |
| 51 |
|
| 52 |
--spec(disco_sm_items/5 :: |
| 53 |
+-spec(disco_sm_items |
| 54 |
( |
| 55 |
Acc :: empty | {result, [xmlel()]}, |
| 56 |
From :: jid(), |
| 57 |
@@ -625,7 +625,7 @@ disco_sm_items({result, OtherItems}, Fro |
| 58 |
disco_items(jid:tolower(jid:remove_resource(To)), Node, From))}; |
| 59 |
disco_sm_items(Acc, _From, _To, _Node, _Lang) -> Acc. |
| 60 |
|
| 61 |
--spec(disco_items/3 :: |
| 62 |
+-spec(disco_items |
| 63 |
( |
| 64 |
Host :: mod_pubsub:host(), |
| 65 |
Node :: mod_pubsub:nodeId(), |
| 66 |
@@ -845,7 +845,7 @@ handle_call(stop, _From, State) -> |
| 67 |
%% @private |
| 68 |
handle_cast(_Msg, State) -> {noreply, State}. |
| 69 |
|
| 70 |
--spec(handle_info/2 :: |
| 71 |
+-spec(handle_info |
| 72 |
( |
| 73 |
_ :: {route, From::jid(), To::jid(), Packet::xmlel()}, |
| 74 |
State :: state()) |
| 75 |
@@ -933,7 +933,7 @@ terminate(_Reason, |
| 76 |
%% @private |
| 77 |
code_change(_OldVsn, State, _Extra) -> {ok, State}. |
| 78 |
|
| 79 |
--spec(do_route/7 :: |
| 80 |
+-spec(do_route |
| 81 |
( |
| 82 |
ServerHost :: binary(), |
| 83 |
Access :: atom(), |
| 84 |
@@ -1130,7 +1130,7 @@ iq_disco_info(Host, SNode, From, Lang) - |
| 85 |
node_disco_info(Host, Node, From) |
| 86 |
end. |
| 87 |
|
| 88 |
--spec(iq_disco_items/4 :: |
| 89 |
+-spec(iq_disco_items |
| 90 |
( |
| 91 |
Host :: mod_pubsub:host(), |
| 92 |
Node :: <<>> | mod_pubsub:nodeId(), |
| 93 |
@@ -1200,7 +1200,7 @@ iq_disco_items(Host, Item, From, RSM) -> |
| 94 |
end |
| 95 |
end. |
| 96 |
|
| 97 |
--spec(iq_sm/3 :: |
| 98 |
+-spec(iq_sm |
| 99 |
( |
| 100 |
From :: jid(), |
| 101 |
To :: jid(), |
| 102 |
@@ -1231,7 +1231,7 @@ iq_get_vcard(Lang) -> |
| 103 |
<<(translate:translate(Lang, <<"ejabberd Publish-Subscribe module">>))/binary, |
| 104 |
"\nCopyright (c) 2004-2016 ProcessOne">>}]}]. |
| 105 |
|
| 106 |
--spec(iq_pubsub/6 :: |
| 107 |
+-spec(iq_pubsub |
| 108 |
( |
| 109 |
Host :: mod_pubsub:host(), |
| 110 |
ServerHost :: binary(), |
| 111 |
@@ -1247,7 +1247,7 @@ iq_get_vcard(Lang) -> |
| 112 |
iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang) -> |
| 113 |
iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, all, plugins(Host)). |
| 114 |
|
| 115 |
--spec(iq_pubsub/8 :: |
| 116 |
+-spec(iq_pubsub |
| 117 |
( |
| 118 |
Host :: mod_pubsub:host(), |
| 119 |
ServerHost :: binary(), |
| 120 |
@@ -1357,7 +1357,7 @@ iq_pubsub(Host, ServerHost, From, IQType |
| 121 |
end. |
| 122 |
|
| 123 |
|
| 124 |
--spec(iq_pubsub_owner/6 :: |
| 125 |
+-spec(iq_pubsub_owner |
| 126 |
( |
| 127 |
Host :: mod_pubsub:host(), |
| 128 |
ServerHost :: binary(), |
| 129 |
@@ -1791,7 +1791,7 @@ update_auth(Host, Node, Type, Nidx, Subs |
| 130 |
%%<li>nodetree create_node checks if nodeid already exists</li> |
| 131 |
%%<li>node plugin create_node just sets default affiliation/subscription</li> |
| 132 |
%%</ul> |
| 133 |
--spec(create_node/5 :: |
| 134 |
+-spec(create_node |
| 135 |
( |
| 136 |
Host :: mod_pubsub:host(), |
| 137 |
ServerHost :: binary(), |
| 138 |
@@ -1805,7 +1805,7 @@ update_auth(Host, Node, Type, Nidx, Subs |
| 139 |
create_node(Host, ServerHost, Node, Owner, Type) -> |
| 140 |
create_node(Host, ServerHost, Node, Owner, Type, all, []). |
| 141 |
|
| 142 |
--spec(create_node/7 :: |
| 143 |
+-spec(create_node |
| 144 |
( |
| 145 |
Host :: mod_pubsub:host(), |
| 146 |
ServerHost :: binary(), |
| 147 |
@@ -1931,7 +1931,7 @@ create_node(Host, ServerHost, Node, Owne |
| 148 |
%%<li>The node is the root collection node, which cannot be deleted.</li> |
| 149 |
%%<li>The specified node does not exist.</li> |
| 150 |
%%</ul> |
| 151 |
--spec(delete_node/3 :: |
| 152 |
+-spec(delete_node |
| 153 |
( |
| 154 |
Host :: mod_pubsub:host(), |
| 155 |
Node :: mod_pubsub:nodeId(), |
| 156 |
@@ -2015,7 +2015,7 @@ delete_node(Host, Node, Owner) -> |
| 157 |
%%<li>The node does not support subscriptions.</li> |
| 158 |
%%<li>The node does not exist.</li> |
| 159 |
%%</ul> |
| 160 |
--spec(subscribe_node/5 :: |
| 161 |
+-spec(subscribe_node |
| 162 |
( |
| 163 |
Host :: mod_pubsub:host(), |
| 164 |
Node :: mod_pubsub:nodeId(), |
| 165 |
@@ -2134,7 +2134,7 @@ subscribe_node(Host, Node, From, JID, Co |
| 166 |
%%<li>The node does not exist.</li> |
| 167 |
%%<li>The request specifies a subscription ID that is not valid or current.</li> |
| 168 |
%%</ul> |
| 169 |
--spec(unsubscribe_node/5 :: |
| 170 |
+-spec(unsubscribe_node |
| 171 |
( |
| 172 |
Host :: mod_pubsub:host(), |
| 173 |
Node :: mod_pubsub:nodeId(), |
| 174 |
@@ -2172,7 +2172,7 @@ unsubscribe_node(Host, Node, From, Subsc |
| 175 |
%%<li>The item contains more than one payload element or the namespace of the root payload element does not match the configured namespace for the node.</li> |
| 176 |
%%<li>The request does not match the node configuration.</li> |
| 177 |
%%</ul> |
| 178 |
--spec(publish_item/6 :: |
| 179 |
+-spec(publish_item |
| 180 |
( |
| 181 |
Host :: mod_pubsub:host(), |
| 182 |
ServerHost :: binary(), |
| 183 |
@@ -2307,7 +2307,7 @@ publish_item(Host, ServerHost, Node, Pub |
| 184 |
%%<li>The node does not support persistent items.</li> |
| 185 |
%%<li>The service does not support the deletion of items.</li> |
| 186 |
%%</ul> |
| 187 |
--spec(delete_item/4 :: |
| 188 |
+-spec(delete_item |
| 189 |
( |
| 190 |
Host :: mod_pubsub:host(), |
| 191 |
Node :: mod_pubsub:nodeId(), |
| 192 |
@@ -2371,7 +2371,7 @@ delete_item(Host, Node, Publisher, ItemI |
| 193 |
%%<li>The node is not configured to persist items.</li> |
| 194 |
%%<li>The specified node does not exist.</li> |
| 195 |
%%</ul> |
| 196 |
--spec(purge_node/3 :: |
| 197 |
+-spec(purge_node |
| 198 |
( |
| 199 |
Host :: mod_pubsub:host(), |
| 200 |
Node :: mod_pubsub:nodeId(), |
| 201 |
@@ -2423,7 +2423,7 @@ purge_node(Host, Node, Owner) -> |
| 202 |
%% <p>The permission are not checked in this function.</p> |
| 203 |
%% @todo We probably need to check that the user doing the query has the right |
| 204 |
%% to read the items. |
| 205 |
--spec(get_items/7 :: |
| 206 |
+-spec(get_items |
| 207 |
( |
| 208 |
Host :: mod_pubsub:host(), |
| 209 |
Node :: mod_pubsub:nodeId(), |
| 210 |
@@ -2598,7 +2598,7 @@ dispatch_items(From, To, _Node, Stanza) |
| 211 |
ejabberd_router:route(service_jid(From), jid:make(To), Stanza). |
| 212 |
|
| 213 |
%% @doc <p>Return the list of affiliations as an XMPP response.</p> |
| 214 |
--spec(get_affiliations/4 :: |
| 215 |
+-spec(get_affiliations |
| 216 |
( |
| 217 |
Host :: mod_pubsub:host(), |
| 218 |
Node :: mod_pubsub:nodeId(), |
| 219 |
@@ -2651,7 +2651,7 @@ get_affiliations(Host, Node, JID, Plugin |
| 220 |
Error |
| 221 |
end. |
| 222 |
|
| 223 |
--spec(get_affiliations/3 :: |
| 224 |
+-spec(get_affiliations |
| 225 |
( |
| 226 |
Host :: mod_pubsub:host(), |
| 227 |
Node :: mod_pubsub:nodeId(), |
| 228 |
@@ -2696,7 +2696,7 @@ get_affiliations(Host, Node, JID) -> |
| 229 |
Error |
| 230 |
end. |
| 231 |
|
| 232 |
--spec(set_affiliations/4 :: |
| 233 |
+-spec(set_affiliations |
| 234 |
( |
| 235 |
Host :: mod_pubsub:host(), |
| 236 |
Node :: mod_pubsub:nodeId(), |
| 237 |
@@ -3101,7 +3101,7 @@ set_subscriptions(Host, Node, From, Enti |
| 238 |
end |
| 239 |
end. |
| 240 |
|
| 241 |
--spec(get_presence_and_roster_permissions/5 :: |
| 242 |
+-spec(get_presence_and_roster_permissions |
| 243 |
( |
| 244 |
Host :: mod_pubsub:host(), |
| 245 |
From :: ljid(), |
| 246 |
@@ -3167,7 +3167,7 @@ subscription_to_string(pending) -> <<"pe |
| 247 |
subscription_to_string(unconfigured) -> <<"unconfigured">>; |
| 248 |
subscription_to_string(_) -> <<"none">>. |
| 249 |
|
| 250 |
--spec(service_jid/1 :: |
| 251 |
+-spec(service_jid |
| 252 |
( |
| 253 |
Host :: mod_pubsub:host()) |
| 254 |
-> jid() |
| 255 |
@@ -3207,7 +3207,7 @@ sub_option_can_deliver(_, _, {deliver, f |
| 256 |
sub_option_can_deliver(_, _, {expire, When}) -> p1_time_compat:timestamp() < When; |
| 257 |
sub_option_can_deliver(_, _, _) -> true. |
| 258 |
|
| 259 |
--spec(presence_can_deliver/2 :: |
| 260 |
+-spec(presence_can_deliver |
| 261 |
( |
| 262 |
Entity :: ljid(), |
| 263 |
_ :: boolean()) |
| 264 |
@@ -3233,7 +3233,7 @@ presence_can_deliver({User, Server, Reso |
| 265 |
false, Ss) |
| 266 |
end. |
| 267 |
|
| 268 |
--spec(state_can_deliver/2 :: |
| 269 |
+-spec(state_can_deliver |
| 270 |
( |
| 271 |
Entity::ljid(), |
| 272 |
SubOptions :: mod_pubsub:subOptions() | []) |
| 273 |
@@ -3258,7 +3258,7 @@ state_can_deliver({U, S, R}, SubOptions) |
| 274 |
[], Resources) |
| 275 |
end. |
| 276 |
|
| 277 |
--spec(get_resource_state/3 :: |
| 278 |
+-spec(get_resource_state |
| 279 |
( |
| 280 |
Entity :: ljid(), |
| 281 |
ShowValues :: [binary()], |
| 282 |
@@ -3283,7 +3283,7 @@ get_resource_state({U, S, R}, ShowValues |
| 283 |
end |
| 284 |
end. |
| 285 |
|
| 286 |
--spec(payload_xmlelements/1 :: |
| 287 |
+-spec(payload_xmlelements |
| 288 |
( |
| 289 |
Payload :: mod_pubsub:payload()) |
| 290 |
-> Count :: non_neg_integer() |
| 291 |
@@ -4029,7 +4029,7 @@ unset_cached_item(Host, Nidx) -> |
| 292 |
_ -> ok |
| 293 |
end. |
| 294 |
|
| 295 |
--spec(get_cached_item/2 :: |
| 296 |
+-spec(get_cached_item |
| 297 |
( |
| 298 |
Host :: mod_pubsub:host(), |
| 299 |
Nidx :: mod_pubsub:nodeIdx()) |
| 300 |
@@ -4329,7 +4329,7 @@ string_to_ljid(JID) -> |
| 301 |
end |
| 302 |
end. |
| 303 |
|
| 304 |
--spec(uniqid/0 :: () -> mod_pubsub:itemId()). |
| 305 |
+-spec(uniqid () -> mod_pubsub:itemId()). |
| 306 |
uniqid() -> |
| 307 |
{T1, T2, T3} = p1_time_compat:timestamp(), |
| 308 |
iolist_to_binary(io_lib:fwrite("~.16B~.16B~.16B", [T1, T2, T3])). |
| 309 |
@@ -4344,7 +4344,7 @@ itemsEls(Items) -> |
| 310 |
[#xmlel{name = <<"item">>, attrs = itemAttr(ItemId), children = Payload} |
| 311 |
|| #pubsub_item{itemid = {ItemId, _}, payload = Payload} <- Items]. |
| 312 |
|
| 313 |
--spec(add_message_type/2 :: |
| 314 |
+-spec(add_message_type |
| 315 |
( |
| 316 |
Message :: xmlel(), |
| 317 |
Type :: atom()) |