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,6 +77,9 @@ apply_if_found_kolab(0) -> true; apply_if_found_kolab(_) -> false. +possibly_append_newline(<<>>) -> <<>> ; +possibly_append_newline(Response) -> <> . + filter_folders(<<>>, State) -> { <<>>, State#state{ active = true } }; filter_folders(Buffer, #state{ last_chunk = LeftOvers } = State) -> @@ -85,7 +88,7 @@ ListResponses = binary:split(FullLinesBuffer, <<"\r\n">>, [ global ]), { Response, More } = filter_folders(State, ListResponses, { <<>>, true }), %io:format("Filtered ... ~p~n", [Response]), - { <>, State#state { active = More, last_chunk = LastChunk } }. + { 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