25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

* src/mod_pubsub/mod_pubsub.erl: Fix incorrect implementation of

Pubsub payload requirements (thanks to Andy Skelton)(EJAB-823)

SVN Revision: 1921
This commit is contained in:
Badlop 2009-02-25 21:17:14 +00:00
parent 1650a946f2
commit fd26056d01
2 changed files with 11 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2009-02-25 Badlop <badlop@process-one.net>
* src/mod_pubsub/mod_pubsub.erl: Fix incorrect implementation of
Pubsub payload requirements (thanks to Andy Skelton)(EJAB-823)
2009-02-24 Badlop <badlop@process-one.net> 2009-02-24 Badlop <badlop@process-one.net>
* src/ejabberd_listener.erl: Fix report message of 'undef' error * src/ejabberd_listener.erl: Fix report message of 'undef' error

View File

@ -1492,6 +1492,8 @@ publish_item(Host, ServerHost, Node, Publisher, ItemId, Payload) ->
PublishFeature = lists:member("publish", Features), PublishFeature = lists:member("publish", Features),
PublishModel = get_option(Options, publish_model), PublishModel = get_option(Options, publish_model),
MaxItems = max_items(Options), MaxItems = max_items(Options),
DeliverPayloads = get_option(Options, deliver_payloads),
PersistItems = get_option(Options, persist_items),
PayloadCount = payload_xmlelements(Payload), PayloadCount = payload_xmlelements(Payload),
PayloadSize = size(term_to_binary(Payload)), PayloadSize = size(term_to_binary(Payload)),
PayloadMaxSize = get_option(Options, max_payload_size), PayloadMaxSize = get_option(Options, max_payload_size),
@ -1510,11 +1512,11 @@ publish_item(Host, ServerHost, Node, Publisher, ItemId, Payload) ->
Payload == "" -> Payload == "" ->
%% Publisher attempts to publish to payload node with no payload %% Publisher attempts to publish to payload node with no payload
{error, extended_error(?ERR_BAD_REQUEST, "payload-required")}; {error, extended_error(?ERR_BAD_REQUEST, "payload-required")};
(MaxItems == 0) and (PayloadSize > 0) -> (DeliverPayloads == 0) and (PersistItems == 0) and (PayloadSize > 0) ->
% Publisher attempts to publish to transient notification node with item %% Publisher attempts to publish to transient notification node with item
{error, extended_error(?ERR_BAD_REQUEST, "item-forbidden")}; {error, extended_error(?ERR_BAD_REQUEST, "item-forbidden")};
(MaxItems > 0) and (PayloadSize == 0) -> ((DeliverPayloads == 1) or (PersistItems == 1)) and (PayloadSize == 0) ->
% Publisher attempts to publish to persistent node with no item %% Publisher attempts to publish to persistent node with no item
{error, extended_error(?ERR_BAD_REQUEST, "item-required")}; {error, extended_error(?ERR_BAD_REQUEST, "item-required")};
true -> true ->
node_call(Type, publish_item, [Host, Node, Publisher, PublishModel, MaxItems, ItemId, Payload]) node_call(Type, publish_item, [Host, Node, Publisher, PublishModel, MaxItems, ItemId, Payload])