From 26cf78047684362220bd2b9e0ebb26aa5fbb2968 Mon Sep 17 00:00:00 2001 From: Christophe Romain Date: Fri, 17 Oct 2008 00:42:20 +0000 Subject: [PATCH] does not write item when max_items set to 0 (solves EJAB-768) SVN Revision: 1660 --- ChangeLog | 3 +++ src/mod_pubsub/node_default.erl | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1cf4c836c..291fe828d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,9 @@ * src/mod_pubsub/mod_pubsub.erl: fix remove_user not unsubscribing user (EJAB-684) + * src/mod_pubsub/node_default.erl: does not write item when max_items + set to 0 (solves EJAB-768) + 2008-10-13 Jerome Sautret * src/odbc/ejabberd_odbc.erl: log MySQL driver messages. diff --git a/src/mod_pubsub/node_default.erl b/src/mod_pubsub/node_default.erl index 02a75e989..dca41d4ac 100644 --- a/src/mod_pubsub/node_default.erl +++ b/src/mod_pubsub/node_default.erl @@ -452,10 +452,12 @@ publish_item(Host, Node, Publisher, PublishModel, MaxItems, ItemId, Payload) -> OldItem#pubsub_item{modification = PubId, payload = Payload} end, - Items = [ItemId | State#pubsub_state.items], + Items = [ItemId | State#pubsub_state.items--[ItemId]], {result, {NI, OI}} = remove_extra_items( Host, Node, MaxItems, Items), - set_item(Item), + if MaxItems > 0 -> set_item(Item); + true -> ok + end, set_state(State#pubsub_state{items = NI}), {result, {default, broadcast, OI}} end.