From: Matt Mullins Date: Sun, 5 May 2013 06:57:57 +0000 (-0700) Subject: Split out routing key creation into a new function X-Git-Tag: v10~5 X-Git-Url: http://git.mmlx.us/?a=commitdiff_plain;h=68ab8bc18d92eea19600e584755b911f74987b7e;p=erlbot.git Split out routing key creation into a new function --- diff --git a/irc/irc_conn.erl b/irc/irc_conn.erl index 3d4ba62..05eff3c 100644 --- a/irc/irc_conn.erl +++ b/irc/irc_conn.erl @@ -168,11 +168,13 @@ join_channel(Channel, State) -> Command = #irc_command{command = "JOIN", middles = [Channel]}, send_command(Command). -add_amqp_listener(Instance, ObjectSup) -> +get_routing_key(Instance) -> InstanceKey = irc_amqp_listener:encode_routing_key(atom_to_list(Instance)), - RoutingKey = InstanceKey ++ ".output.*", + InstanceKey ++ ".output.*". + +add_amqp_listener(Instance, ObjectSup) -> {ok, _ChildPid} = irc_object_sup:add_amqp_listener( - ObjectSup, self(), RoutingKey). + ObjectSup, self(), get_routing_key(Instance)). %% @doc Splits a buffer into full lines, keeping whatever is left over %% Returns either {ok, [Line], Remaining} or none.