Changeset View
Changeset View
Standalone View
Standalone View
apps/kolab_guam/src/rules/kolab_guam_rule_filter_groupware.erl
Show All 24 Lines | |||||
applies(_ConnectionDetails, Buffer, State) -> | applies(_ConnectionDetails, Buffer, State) -> | ||||
{ _Tag, Command, Data } = eimap_utils:split_command_into_components(Buffer), | { _Tag, Command, Data } = eimap_utils:split_command_into_components(Buffer), | ||||
%lager:debug("********** Checking ...~n Command: ~s ~s", [Command, Data]), | %lager:debug("********** Checking ...~n Command: ~s ~s", [Command, Data]), | ||||
{ apply_if_id_matches(Command, Data), State }. | { apply_if_id_matches(Command, Data), State }. | ||||
apply_to_client_message(ImapSession, Buffer, State) -> | apply_to_client_message(ImapSession, Buffer, State) -> | ||||
{ Tag, Command, Data } = eimap_utils:split_command_into_components(Buffer), | { Tag, Command, Data } = eimap_utils:split_command_into_components(Buffer), | ||||
{ Active, StateTag }= | { Active, StateTag } = | ||||
if Command =:= <<"LIST">>; | if Command =:= <<"LIST">>; | ||||
Command =:= <<"list">>; | Command =:= <<"list">>; | ||||
Command =:= <<"XLIST">>; | Command =:= <<"XLIST">>; | ||||
Command =:= <<"xlist">>; | Command =:= <<"xlist">>; | ||||
Command =:= <<"LSUB">>; | Command =:= <<"LSUB">>; | ||||
Command =:= <<"lsub">> -> | Command =:= <<"lsub">> -> | ||||
case binary:match(Data, <<"*">>) of | case {binary:match(Data, <<"*">>),binary:match(Data, <<"%">>)} of | ||||
seigo: this will actually return a tuple of the form { first, second } (e.g. { nomatch, nomatch })… | |||||
nomatch -> { false, <<>> }; | nomatch -> { false, <<>> }; | ||||
_ -> | _ -> | ||||
fetch_metadata(ImapSession, State), | fetch_metadata(ImapSession, State), | ||||
{ true, Tag } | { true, Tag } | ||||
end; | end; | ||||
true -> { false, <<>> } | true -> { false, <<>> } | ||||
end, | end, | ||||
%lager:info("Client sent: ~s ~s ~p", [Command, Data, Active]), | %lager:info("Client sent: ~s ~s ~p", [Command, Data, Active]), | ||||
{ Buffer, State#state{ active = Active, tag = StateTag }}. | { Buffer, State#state{ active = Active, tag = StateTag }}. | ||||
apply_to_server_message(_ImapSession, Buffer, #state{ active = true } = State) -> | apply_to_server_message(_ImapSession, Buffer, #state{ active = true } = State) -> | ||||
filter_folders(Buffer, State); | filter_folders(Buffer, State); | ||||
apply_to_server_message(_ImapSession, Buffer, State) -> { Buffer, State }. | apply_to_server_message(_ImapSession, Buffer, State) -> { Buffer, State }. | ||||
imap_data(blacklist, Response, State) -> | imap_data(blacklist, Response, State) -> | ||||
▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines |
this will actually return a tuple of the form { first, second } (e.g. { nomatch, nomatch }), which means the nomatch branch will never be selected, and metadata will always be fetched.