So, to connect one client, you can do something like:
ExIrc.start! {:ok, client} = ExIrc.Client.start_link {:ok, handler} = ExampleHandler.start_link(nil) ExIrc.Client.add_handler(client, handler) ExIrc.Client.connect!(client, "chat.freenode.net", 6667)
I use ExampleHandler in the same way as README suggests. Now, if you do something like:
pass = "" nick = "my_nick" ExIrc.Client.logon(client, pass, nick, nick, nick) ExIrc.Client.join(client, "#elixir-lang")
You will begin to look at the messages from #elixir-lang that will be displayed on the console - as ExampleHandler is implemented, you will probably implement something else in its place.
Now nothing is stopping you from doing this a second time:
{:ok, client2} = ExIrc.Client.start_link {:ok, handler2} = ExampleHandler.start_link(nil)
To create a client2 client that is connected to the same or different server. To achieve what you want, you just need to write a handler that responds to messages from the client by calling ExIrc.Client.msg(client2, ...) to publish to another client.
source share