Tatskaari / EarlTheIRCbot

An IRC bot written in erlang.
GNU Lesser General Public License v3.0
4 stars 2 forks source link

Make Earl multi-server #13

Open graymalkin opened 10 years ago

graymalkin commented 10 years ago

Requires decoupling a bunch of things and adding a "server" tag to the message records which are passed about (perhaps)

graymalkin commented 9 years ago

@egelmex @Tatskaari I'd like to work on this, this weekend - if I can get a working linux install on my desktop :dizzy_face:

What are your thoughts on how to go about this? I'm thinking it's something I can do deep down in the message router - I'd like to avoid changes which mean a lot of percolating things up the call structure of the program. (e.g. if I added a network to all records for rcv and send)

graymalkin commented 9 years ago

Aha, I suppose that to make Earl multiserver, passing chatnets about in the FROM part of event tuples might do the trick.

e.g.

handle_event(#privmsg{from={Name,Server}, admin=true, message="#n " ++ Nick}, State) ->
  ok.
egelmex commented 9 years ago

Sounds sane to me.

On Thu, Oct 9, 2014 at 9:51 AM, Simon Cooksey notifications@github.com wrote:

Aha, I suppose that to make Earl multiserver, passing chatnets about in the FROM part of event tuples might do the trick.

e.g.

handle_event(#privmsg{from={Name,Server}, admin=true, message="#n " ++ Nick}, State) -> ok.

— Reply to this email directly or view it on GitHub https://github.com/Tatskaari/EarlTheIRCbot/issues/13#issuecomment-58480259 .

graymalkin commented 9 years ago

It will mean making this occur everywhere, including in things like PING - but I think that's probably manageable compared to some alternatives.

graymalkin commented 9 years ago

The other way I thought of dealing with it was removing the registered PID sendPID and replacing that with a non-registered one, then when modules get started they're hooked up to the correct sendPID for their network.

This is potentially much better as far as settings go, and keeping things self contained and separate.

init(Args) ->
    [{server, Server}] = proplist:get_value(server, Args),
    State = [{server, Server}],
    {ok, State}.

handle_event(#privmsg{admin=true, message="#n " ++ Nick}, State) ->
    [{server, Server}] = proplist:get_value(server, State),
    Server ! #nick{nick=Nick},
    {ok, State}.
graymalkin commented 9 years ago

Turns out, cyclic dependencies are a bitch.

We suck.