Browse files

Fixed bug, now QUIT command does not exit the client process

  • Loading branch information...
1 parent a3fca5a commit d9136af00943a2120c13fc36384965375a617140 @mazenharake committed May 2, 2011
Showing with 7 additions and 5 deletions.
  1. +1 −1 include/eirc.hrl
  2. +6 −4 src/eirc_cl.erl
View
2 include/eirc.hrl
@@ -25,7 +25,7 @@
%% Records
-record(eirc_state, {
event_handlers = [], server, port, socket, nick, pass, user, name,
- logged_on, autoping, chprefix, network, usrprefix, login_time,
+ logged_on = false, autoping, chprefix, network, usrprefix, login_time,
botsup, channels, debug
}).
View
10 src/eirc_cl.erl
@@ -226,7 +226,12 @@ handle_cast({remove_handler, Pid}, State) ->
{noreply, State#eirc_state{ event_handlers = NHandlers }}.
handle_info({tcp_closed, _Socket}, State) ->
- {stop, normal, State};
+ io:format("Connection closed!~n"),
+ {noreply, #eirc_state{ autoping = State#eirc_state.autoping,
+ debug = State#eirc_state.debug,
+ event_handlers = State#eirc_state.event_handlers,
+ botsup = State#eirc_state.botsup,
+ channels = eirc_chan:init() }};
handle_info({tcp_error, Socket}, State) ->
{stop, {tcp_error, Socket}, State};
@@ -345,9 +350,6 @@ handle_data(#ircmsg{ cmd = "PING" } = Msg, #eirc_state{ autoping = true } = Stat
end,
{noreply, State};
-handle_data(#ircmsg{ cmd = "ERROR", args = ["Closing Link"++_] }, State) ->
- {stop, normal, State};
-
%% "catch-all", period. (DEV)
handle_data(_Msg, State) ->
{noreply, State}.

0 comments on commit d9136af

Please sign in to comment.