Projects
Kolab:16
guam
0011-switch-to-triggering-on-any-list-where-the...
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0011-switch-to-triggering-on-any-list-where-the-last-two-.patch of Package guam (Revision 9)
Currently displaying revision
9
,
Show latest
From 7a96caca1d8f8db6f6d7bd625867d5eb292694f0 Mon Sep 17 00:00:00 2001 From: Aaron Seigo <aseigo@kde.org> Date: Mon, 4 Jul 2016 09:47:46 +0200 Subject: [PATCH 11/11] switch to triggering on any list where the last two bytes are not "" if the suffix of the command is "" that means "this is not really a LIST command, rather I am wanting the root and separator" .. otherwise known as IMAP's poorly considered attempt at a poor man's NAMESPACE command --- .../src/rules/kolab_guam_rule_filter_groupware.erl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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 index a383ad9..49211aa 100644 --- a/apps/kolab_guam/src/rules/kolab_guam_rule_filter_groupware.erl +++ b/apps/kolab_guam/src/rules/kolab_guam_rule_filter_groupware.erl @@ -27,14 +27,12 @@ new(_Config) -> #state { blacklist = undefined }. applies(_ConnectionDetails, Buffer, State) -> { _Tag, Command, Data } = eimap_utils:split_command_into_components(Buffer), %lager:debug("********** Checking ...~n Command: ~s ~s", [Command, Data]), - { apply_if_id_matches(Command, Data, State#state.trigger_commands), State }. + { apply_if_id_matches(Command, Data, State), State }. apply_to_client_message(ImapSession, Buffer, State) -> { Tag, Command, Data } = eimap_utils:split_command_into_components(Buffer), { Active, StateTag }= - case lists:any(fun(T) -> (Command =:= T) andalso - ((binary:match(Data, <<"*">>) =/= nomatch) orelse (binary:match(Data, <<"%">>) =/= nomatch)) end, - State#state.trigger_commands) of + case is_triggering_command(Command, Data, State) of true -> fetch_metadata(ImapSession, State), { true, Tag }; _ -> { false, <<>> } end, @@ -55,16 +53,20 @@ imap_data(blacklist, Response, State) -> State#state{ blacklist = Blacklist }. %%PRIVATE +is_triggering_command(Command, Data, #state{ trigger_commands = TriggerCommands }) -> + lists:any(fun(T) -> (Command =:= T) andalso (binary:longest_common_suffix([Data, <<"\"\"">>]) =:= 2) end, + TriggerCommands). + fetch_metadata(none, #state{ blacklist = undefined }) -> ok; fetch_metadata(ImapSession, #state{ blacklist = undefined }) -> eimap:get_folder_metadata(ImapSession, self(), { rule_data, ?MODULE, blacklist }, "*", ["/shared/vendor/kolab/folder-type"]); fetch_metadata(_ImapSession, _State) -> ok. -apply_if_id_matches(<<"ID">>, Data, _TriggerCommands) -> +apply_if_id_matches(<<"ID">>, Data, _State) -> apply_if_found_kolab(binary:match(Data, <<"/Kolab">>)); -apply_if_id_matches(Command, _Data, TriggerCommands) -> - case lists:any(fun(T) -> Command =:= T end, TriggerCommands) of +apply_if_id_matches(Command, Data, State) -> + case is_triggering_command(Command, Data, State) of true -> true; _ -> notyet end. -- 2.5.5
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.