Split out routing key creation into a new function
authorMatt Mullins <mmullins@mmlx.us>
Sun, 5 May 2013 06:57:57 +0000 (23:57 -0700)
committerMatt Mullins <mmullins@mmlx.us>
Sun, 5 May 2013 07:30:36 +0000 (00:30 -0700)
irc/irc_conn.erl

index 3d4ba62..05eff3c 100644 (file)
@@ -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.