aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--src/mod_privacy.erl7
-rw-r--r--src/mod_privacy_odbc.erl7
3 files changed, 18 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 9bf47ea5c..774585bc2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-01-16 Badlop <badlop@process-one.net>
+
+ * src/mod_privacy.erl: Privacy list items must be processed in the
+ specified order (EJAB-848)
+ * src/mod_privacy_odbc.erl: Likewise
+
2009-01-13 Badlop <badlop@process-one.net>
* doc/release_notes_2.0.3.txt: Add release notes
diff --git a/src/mod_privacy.erl b/src/mod_privacy.erl
index a9da69090..5fd604511 100644
--- a/src/mod_privacy.erl
+++ b/src/mod_privacy.erl
@@ -414,7 +414,12 @@ parse_items(Els) ->
parse_items(Els, []).
parse_items([], Res) ->
- lists:reverse(Res);
+ %% Sort the items by their 'order' attribute
+ %% 5 is the position of 'order' attribute in a #listitem tuple
+ %% This integer can be calculated at runtime with:
+ %% 2 + length(lists:takewhile(fun(E) -> E =/= order end,
+ %% record_info(fields, listitem))),
+ lists:keysort(5, Res);
parse_items([{xmlelement, "item", Attrs, SubEls} | Els], Res) ->
Type = xml:get_attr("type", Attrs),
Value = xml:get_attr("value", Attrs),
diff --git a/src/mod_privacy_odbc.erl b/src/mod_privacy_odbc.erl
index 1fdf799d7..aac295528 100644
--- a/src/mod_privacy_odbc.erl
+++ b/src/mod_privacy_odbc.erl
@@ -414,7 +414,12 @@ parse_items(Els) ->
parse_items(Els, []).
parse_items([], Res) ->
- lists:reverse(Res);
+ %% Sort the items by their 'order' attribute
+ %% 5 is the position of 'order' attribute in a #listitem tuple
+ %% This integer can be calculated at runtime with:
+ %% 2 + length(lists:takewhile(fun(E) -> E =/= order end,
+ %% record_info(fields, listitem))),
+ lists:keysort(5, Res);
parse_items([{xmlelement, "item", Attrs, SubEls} | Els], Res) ->
Type = xml:get_attr("type", Attrs),
Value = xml:get_attr("value", Attrs),