Refactored the way commands are sent from the AMQP listener to the irc_conn
authorMatt Mullins <mmullins@mmlx.us>
Thu, 1 Sep 2011 20:31:49 +0000 (15:31 -0500)
committerMatt Mullins <mmullins@mmlx.us>
Thu, 1 Sep 2011 20:31:49 +0000 (15:31 -0500)
irc/irc_amqp_listener.erl
irc/irc_conn.erl

index b8c02a2..2218955 100644 (file)
@@ -35,5 +35,5 @@ handle_info(
     Command = #irc_command{ command = "PRIVMSG",
                             middles = [ Destination ],
                             trailing = Content },
-    gen_server:cast(ConnectionPid, {send_command, Command}),
+    irc_conn:send_command(ConnectionPid, Command),
     {noreply, State}.
index d8d3d5e..6d79256 100644 (file)
@@ -3,7 +3,8 @@
 -vsn(2).
 
 -export([
-          start_link/3
+          start_link/3,
+          send_command/2
         ]).
 
 -export([
@@ -31,6 +32,9 @@ start_link(Instance, Supervisor, TableId) ->
     gen_server:start_link(?MODULE,
         {Instance, Supervisor, TableId}, []).
 
+send_command(Pid, Command) ->
+    gen_server:cast(Pid, {send_command, Command}).
+
 init({Instance, Supervisor, TableId}) ->
     ets:insert(TableId, {irc_conn_pid, self()}), % record the connection PID in the table