-module(ac).
-behaviour(gen_server).
%% API
-export([start_link/3]).
%% Gen Server callbacks
-export([init/1,handle_call/3,handle_cast/2,handle_info/2]).
-export([code_change/3,terminate/2]).
-define(SERVER(ChannelId), list_to_atom("channel@" ++ integer_to_list(ChannelId))).
start_link(User, Host, ChannelId) -> error_logger:info_msg("start link: ~p, ~p, ~p", [User,Host,ChannelId]),
gen_server:start_link({local, ?SERVER(ChannelId)}, ?MODULE, [User,Host],[]),
ok.
%% Gen Server callbacks
init([User, Host]) ->
error_logger:info_msg("init: ~p, ~p~n", [User,Host]),
{ok, [User,Host]}.
handle_call(Request, _From, State) ->
error_logger:info_msg(": ~p", [Request]),
{reply, none, State}.
handle_info(Info, State) ->
error_logger:info_msg(": ~p", [Info]),
{noreply, State}.
handle_cast(Request, State) ->
error_logger:info_msg(": ~p", [Request]),
{noreply, State}.
code_change(_OldVsn, State, _Extra) ->
{ok, State}.
terminate(Reason, State) ->
io:format("Reason: ~p~n", Reason),
terminated.