From: Matt Mullins Date: Mon, 14 Jan 2013 06:47:16 +0000 (-0800) Subject: Bump IRC app versions, disallow code_change. X-Git-Tag: v8 X-Git-Url: http://git.mmlx.us/?a=commitdiff_plain;h=9e55d721fff387a3f913a32af7ac0a5b2850fde8;p=erlbot.git Bump IRC app versions, disallow code_change. I am not planning to support upgrading/downgrading past this epoch. It's possible, but the existing IRC bot died for unrelated reasons, so there's no real point in supporting it. I'll just run with the new version. --- diff --git a/bot.rel b/bot.rel index 14e3e23..7eb47d2 100644 --- a/bot.rel +++ b/bot.rel @@ -1,4 +1,4 @@ -{release, {"erlbot", "7"}, +{release, {"erlbot", "8"}, {erts, "5.8.3"}, [{kernel, "2.14.5"}, {stdlib, "1.17.5"}, @@ -7,5 +7,5 @@ {amqp_client, "0.0.0"}, {core, "2"}, {amqp, "1"}, - {irc, "6"}] + {irc, "7"}] }. diff --git a/irc/irc.app b/irc/irc.app index 25720a8..816571f 100644 --- a/irc/irc.app +++ b/irc/irc.app @@ -1,6 +1,6 @@ {application, irc, [{description, "IRC protocol application"}, - {vsn, "6"}, + {vsn, "7"}, {modules, [irc_util, irc_app, irc_sup, irc_net_sup, irc_conn, irc_object_sup, irc_amqp_listener, irc_command]}, {registered, [irc_sup, irc_dummy]}, diff --git a/irc/irc.appup b/irc/irc.appup index aaee95e..8fa9f5c 100644 --- a/irc/irc.appup +++ b/irc/irc.appup @@ -1,11 +1,4 @@ -{"6", - [{"5", [{update, irc_command}, - {update, irc_conn}, - {update, irc_net_sup} - ]}], - - [{"5", [{update, irc_command}, - {update, irc_conn}, - {update, irc_net_sup} - ]}] +{"7", + [], + [] }. diff --git a/irc/irc_amqp_listener.erl b/irc/irc_amqp_listener.erl index 125c3be..0ed84a7 100644 --- a/irc/irc_amqp_listener.erl +++ b/irc/irc_amqp_listener.erl @@ -2,7 +2,7 @@ %% as PRIVMSG to a particular destination -module(irc_amqp_listener). -behavior(gen_server). --vsn(1). +-vsn(2). -export([ start_link/2, diff --git a/irc/irc_conn.erl b/irc/irc_conn.erl index 9b983c6..3628fc1 100644 --- a/irc/irc_conn.erl +++ b/irc/irc_conn.erl @@ -1,6 +1,6 @@ -module(irc_conn). -behavior(gen_server). --vsn(2). +-vsn(3). -define(RECONNECT_TIME, 30000). @@ -144,50 +144,8 @@ do_privmsg(_Command = #irc_command{middles = Middles, trailing = Text}) -> terminate(_Reason, _State) -> ok. -code_change(1, {irc_state, Instance, Config, Joined, Socket, Buffer} = State, _Extra) -> - error_logger:info_msg("Converting from version 1 to version 2.~nOld state is~p~n", - [State]), - - [Supervisor|_] = get('$ancestors'), - [TableId|_] = [Tab || Tab <- ets:all(), Supervisor == ets:info(Tab, owner)], - {ok, ObjectSupPid} = irc_net_sup:create_object_sup(Instance, Supervisor, TableId), - - NewState = {irc_state, Instance, - Config, - Joined, - Socket, - Buffer, - Supervisor, - TableId, - ObjectSupPid}, - - error_logger:info_msg("State transition is done.~nNew state is ~p~n", - [NewState]), - - {_, _, _, _, Channels} = Config, - lists:foreach(fun (Channel) -> add_amqp_listener(Channel, NewState) end, Channels), - - error_logger:info_msg("All done starting new version"), - - {ok, NewState}; - -code_change({down, 1}, State, _Extra) -> - error_logger:info_msg("Converting version 2 to version 1.~nOld state is ~p~n", - [State]), - - #irc_state{instance = Instance, - config = Config, - joined = Joined, - socket = Socket, - buffer = Buffer, - supervisor = Supervisor} = State, - - irc_net_sup:remove_object_sup(Supervisor), - - NewState = {irc_state, Instance, Config, Joined, Socket, Buffer}, - error_logger:info_msg("New state is ~p~n", [NewState]), - - {ok, NewState}. +code_change(_OldVsn, _State, _Extra) -> + {error, unsupported}. send_command(Command) -> gen_server:cast(self(), {send_command, Command}).