-
Notifications
You must be signed in to change notification settings - Fork 6
Add MOTD module #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I was intending to have all state handled by the host program with IRCe just being a thin translation layer, although now I see that might not be the best idea in terms of ease-of-use. I'll have to think about this. This reminds me of channel name lists. I have a handler that inteprets As for multiple servers/MOTDs, you could check the message prefix (ie. |
|
I'm also not sure if raising errors in a handler is a good idea. |
|
Also, I wonder if it'd be better to keep state in the IRC object itself (like in EDIT: Actually maybe not, I don't really know. |
Handlers for RPL_NAMREPLY and RPL_ENDOFNAMES now keep an internal list of users in a channel and return it to the NAMES callback when RPL_ENDOFNAMES is received. Sort of relates to #6.
Much of IRC requires state: many results arrive over multiple lines.
Sounds good :)
What will happen? I assume it would propogate to where
I thought of that first; but it's not really extensible.... don't want to deal with clashes etc. One option would be that modules are passed a 'state' object they should use? |
Yeah. I guess the host program could
Local state sounds the best out of the options after all; that shall be what I'll use. Regarding your MOTD module, are you going to try sorting MOTDs by prefix to get around the possible multiple-server-interleaving issue? (I've tried to implement something like this in the NAMES list handler, but I'm not actually sure it's even necessary; it probably overcomplicates it.) |
I figured letting a broken server continue would be useless: raising to the
I don't know if sorting is the correct solution; I was more thinking about indexing by a compound key of irc object + server. |
Ah, makes sense.
I think I should have worded that better; in the NAMES handlers I've experimentally tried indexing like so: |
|
I've just updated this PR to use the "state" variable now passed to module functions. |
I wanted to have a play around with making a stateful module; MOTD seemed easy enough for a first try.
This code assumes each irc object can only have one MOTD in progress at a time.
==> If you query multiple servers; can they come in interleaved?