Page MenuHomePhorge

D435.1774819183.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D435.1774819183.diff

diff --git a/apps/kolab_guam/src/rules/kolab_guam_rule_filter_groupware.erl b/apps/kolab_guam/src/rules/kolab_guam_rule_filter_groupware.erl
--- a/apps/kolab_guam/src/rules/kolab_guam_rule_filter_groupware.erl
+++ b/apps/kolab_guam/src/rules/kolab_guam_rule_filter_groupware.erl
@@ -78,15 +78,37 @@
apply_if_found_kolab(0) -> true;
apply_if_found_kolab(_) -> false.
+% Filter out a would-be empty list of folders, should the list of folders
+% consist of only groupware folders.
+filter_folders(<<>>, State, _, LastChunk) ->
+ { <<>>, State#state{ active = true, last_chunk = LastChunk } };
+
+% Send the response to the client. Note that the last list item is not
+% imploded \r\n in to, so that needs to be added.
+filter_folders(Response, State, More, LastChunk) ->
+ {
+ <<Response/binary, "\r\n">>,
+ State#state { active = More, last_chunk = LastChunk }
+ }.
+
+% The buffer is empty
filter_folders(<<>>, State) ->
{ <<>>, State#state{ active = true } };
+
+% Parse folders from the buffer, potentially leaving some cruft behind -- the
+% start of the next, incomplete server response line.
filter_folders(Buffer, #state{ last_chunk = LeftOvers } = State) ->
+ % Add the left overs from the previous buffer to the current buffer
FullBuffer = <<LeftOvers/binary, Buffer/binary>>,
+ % From that buffer, only take the complete lines and save off the
+ % remainder.
{ FullLinesBuffer, LastChunk } = eimap_utils:only_full_lines(FullBuffer),
+ % Create a list so we can filter the individual folders
ListResponses = binary:split(FullLinesBuffer, <<"\r\n">>, [ global ]),
{ Response, More } = filter_folders(State, ListResponses, { <<>>, true }),
%io:format("Filtered ... ~p~n", [Response]),
- { <<Response/binary, "\r\n">>, State#state { active = More, last_chunk = LastChunk } }.
+ % To send or not to send?
+ filter_folders(Response, State, More, LastChunk).
filter_folders(_State, [], Return) -> Return;
filter_folders(_State, _Folders, { Acc, false }) -> { Acc, false };

File Metadata

Mime Type
text/plain
Expires
Sun, Mar 29, 9:19 PM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18732195
Default Alt Text
D435.1774819183.diff (2 KB)

Event Timeline