Changeset View
Changeset View
Standalone View
Standalone View
src/eimap.erl
Show First 20 Lines • Show All 289 Lines • ▼ Show 20 Lines | case TLS of | ||||
% explicitly | % explicitly | ||||
ok; | ok; | ||||
_ -> | _ -> | ||||
%lager:debug("Connected, capabilities are: ~s; ServerID is ~s", [Capabilities, ServerID]), | %lager:debug("Connected, capabilities are: ~s; ServerID is ~s", [Capabilities, ServerID]), | ||||
send_hello_string(Capabilities, ServerID, Receiver, ResponseToken, Passthrough, PassthroughReceiver) | send_hello_string(Capabilities, ServerID, Receiver, ResponseToken, Passthrough, PassthroughReceiver) | ||||
end, | end, | ||||
{ next_state, idle, State#state{ current_command = undefined, server_id = ServerID } }; | { next_state, idle, State#state{ current_command = undefined, server_id = ServerID } }; | ||||
handle_info({ { posttls_capabilities, Receiver, ResponseToken }, [Capabilities] }, _StateName, #state{ server_id = ServerID, passthrough = Passthrough, passthrough_recv = PassthroughReceiver } = State) -> | handle_info({ { posttls_capabilities, Receiver, ResponseToken }, [Capabilities] }, _StateName, #state{ server_id = ServerID, passthrough = Passthrough, passthrough_recv = PassthroughReceiver } = State) -> | ||||
OurCapabilities = | send_hello_string(Capabilities, ServerID, Receiver, ResponseToken, Passthrough, PassthroughReceiver), | ||||
case binary:match(Capabilities, <<"STARTTLS">>) of | |||||
nomatch -> <<Capabilities/binary, " STARTTLS">>; | |||||
_ -> Capabilities | |||||
end, | |||||
send_hello_string(OurCapabilities, ServerID, Receiver, ResponseToken, Passthrough, PassthroughReceiver), | |||||
{ next_state, idle, State#state{ current_command = none } }; | { next_state, idle, State#state{ current_command = none } }; | ||||
handle_info({ { selected, MBox }, ok }, StateName, State) -> | handle_info({ { selected, MBox }, ok }, StateName, State) -> | ||||
%%lager:info("~p Selected mbox ~p", [self(), MBox]), | %%lager:info("~p Selected mbox ~p", [self(), MBox]), | ||||
{ next_state, StateName, State#state{ current_mbox = MBox } }; | { next_state, StateName, State#state{ current_mbox = MBox } }; | ||||
handle_info({ { selected, MBox }, { error, Reason } }, StateName, State) -> | handle_info({ { selected, MBox }, { error, Reason } }, StateName, State) -> | ||||
lager:info("Failed to select mbox ~p: ~p", [MBox, Reason]), | lager:info("Failed to select mbox ~p: ~p", [MBox, Reason]), | ||||
NewQueue = queue:filter(fun(Command) -> notify_of_mbox_failure_during_filter(Command, Command#command.mbox =:= MBox) end, State#state.command_queue), | NewQueue = queue:filter(fun(Command) -> notify_of_mbox_failure_during_filter(Command, Command#command.mbox =:= MBox) end, State#state.command_queue), | ||||
{ next_state, StateName, State#state{ command_queue = NewQueue } }; | { next_state, StateName, State#state{ command_queue = NewQueue } }; | ||||
▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines |