Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117373977
D435.1774819183.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D435.1774819183.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D435: Avoid empty lines in the responses to IMAP clients.
Attached
Detach File
Event Timeline