Support servers that reply error on any command before registration (thanks to Gelraen)

This makes mod_irc actually work with servers that reply with error
on any command before the registration procedure is completed.
Such servers, after NICK/USER they send PING and wait for client response.
In such situation they reply with message 451 to CODEPAGE command,
and mod_irc thinks that connection failed.

Example IRC server that works thanks to the patch: irc.mibbit.com
This commit is contained in:
Badlop 2011-06-28 23:04:12 +02:00
parent f112df2cfc
commit d673ff5fad
1 changed files with 2 additions and 2 deletions

View File

@ -132,8 +132,6 @@ open_socket(init, StateData) ->
StateData#state.nick,
StateData#state.host,
StateData#state.nick])),
send_text(NewStateData,
io_lib:format("CODEPAGE ~s\r\n", [StateData#state.encoding])),
{next_state, wait_for_registration,
NewStateData};
{error, Reason} ->
@ -498,6 +496,8 @@ handle_info({ircstring, [$: | String]}, wait_for_registration, StateData) ->
{NewState, NewStateData} =
case Words of
[_, "001" | _] ->
send_text(StateData,
io_lib:format("CODEPAGE ~s\r\n", [StateData#state.encoding])),
{stream_established, StateData};
[_, "433" | _] ->
{error,