Page MenuHomePhorge

D429.1775687644.diff
No OneTemporary

Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None

D429.1775687644.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
@@ -77,15 +77,22 @@
apply_if_found_kolab(0) -> true;
apply_if_found_kolab(_) -> false.
+possibly_append_newline(<<>>) -> <<>> ;
+possibly_append_newline(Response) -> <<Response/binary, "\r\n">> .
+
filter_folders(<<>>, State) ->
{ <<>>, State#state{ active = true } };
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 } }.
+ %Note that the last list item does not contain \r\n, so that needs to be added unless we filtered the complete content.
+ { possibly_append_newline(Response), State#state { active = More, last_chunk = LastChunk } }.
filter_folders(_State, [], Return) -> Return;
filter_folders(_State, _Folders, { Acc, false }) -> { Acc, false };
diff --git a/apps/kolab_guam/test/kolab_guam_rules_SUITE.erl b/apps/kolab_guam/test/kolab_guam_rules_SUITE.erl
--- a/apps/kolab_guam/test/kolab_guam_rules_SUITE.erl
+++ b/apps/kolab_guam/test/kolab_guam_rules_SUITE.erl
@@ -113,6 +113,17 @@
<<"\"/\" Notes\r\n* LIST (\\Subscribed) \"/\" Sent\r\n* LIST (\\Subscribed) \"/\" Spam\r\n* LIST (\\Subscribed) \"/\" Tasks\r\n* LIST (\\Subscribed) \"/\" Trash\r\n7 OK Completed (0.000 secs 15 calls)\r\n">>
],
<<"* LIST (\\Noinferiors \\Subscribed) \"/\" INBOX\r\n* LIST (\\Subscribed) \"/\" Archive\r\n* LIST (\\Subscribed) \"/\" Drafts\r\n* LIST (\\Subscribed) \"/\" Sent\r\n* LIST (\\Subscribed) \"/\" Spam\r\n* LIST (\\Subscribed) \"/\" Trash\r\n7 OK Completed (0.000 secs 15 calls)\r\n">>
+ },
+ %Filter complete packet
+ {
+ [
+ {<<"Calendar">>, <<"Calendar/">>}
+ ],
+ [
+ <<"* LIST (\\Subscribed \\HasChildren) \"/\" Calendar\r\n">>,
+ <<"7 OK Completed (0.000 secs 15 calls)\r\n">>
+ ],
+ <<"7 OK Completed (0.000 secs 15 calls)\r\n">>
}
],
%% setup boilerplate

File Metadata

Mime Type
text/plain
Expires
Wed, Apr 8, 10:34 PM (1 d, 23 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18831414
Default Alt Text
D429.1775687644.diff (2 KB)

Event Timeline