Changeset View
Changeset View
Standalone View
Standalone View
apps/kolab_guam/src/rules/kolab_guam_rule_filter_groupware.erl
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | |||||
fetch_metadata(none, #state{ blacklist = undefined }) -> ok; | fetch_metadata(none, #state{ blacklist = undefined }) -> ok; | ||||
fetch_metadata(ImapSession, #state{ blacklist = undefined }) -> | fetch_metadata(ImapSession, #state{ blacklist = undefined }) -> | ||||
eimap:get_folder_metadata(ImapSession, self(), { rule_data, ?MODULE, blacklist }, "*", ["/shared/vendor/kolab/folder-type"]); | eimap:get_folder_metadata(ImapSession, self(), { rule_data, ?MODULE, blacklist }, "*", ["/shared/vendor/kolab/folder-type"]); | ||||
fetch_metadata(_ImapSession, _State) -> ok. | fetch_metadata(_ImapSession, _State) -> ok. | ||||
apply_if_id_matches(<<"ID">>, Data, _State) -> | apply_if_id_matches(<<"ID">>, Data, _State) -> | ||||
apply_if_found_kolab(binary:match(Data, <<"/Kolab">>)); | apply_if_found_kolab(string:str(string:to_lower(binary_to_list(Data)), "/kolab")); | ||||
apply_if_id_matches(Command, Data, State) -> | apply_if_id_matches(Command, Data, State) -> | ||||
case is_triggering_command(Command, Data, State) of | case is_triggering_command(Command, Data, State) of | ||||
true -> true; | true -> true; | ||||
_ -> notyet | _ -> notyet | ||||
end. | end. | ||||
apply_if_found_kolab(nomatch) -> true; | apply_if_found_kolab(0) -> true; | ||||
apply_if_found_kolab(_) -> false. | apply_if_found_kolab(_) -> false. | ||||
filter_folders(<<>>, State) -> | filter_folders(<<>>, State) -> | ||||
{ <<>>, State#state{ active = true } }; | { <<>>, State#state{ active = true } }; | ||||
filter_folders(Buffer, #state{ last_chunk = LeftOvers } = State) -> | filter_folders(Buffer, #state{ last_chunk = LeftOvers } = State) -> | ||||
FullBuffer = <<LeftOvers/binary, Buffer/binary>>, | FullBuffer = <<LeftOvers/binary, Buffer/binary>>, | ||||
{ FullLinesBuffer, LastChunk } = eimap_utils:only_full_lines(FullBuffer), | { FullLinesBuffer, LastChunk } = eimap_utils:only_full_lines(FullBuffer), | ||||
ListResponses = binary:split(FullLinesBuffer, <<"\r\n">>, [ global ]), | ListResponses = binary:split(FullLinesBuffer, <<"\r\n">>, [ global ]), | ||||
▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines |