Add a message queue to prevent flooding#17
Add a message queue to prevent flooding#17ShadowNinja wants to merge 1 commit intoJakobOvrum:masterfrom
Conversation
|
This functionality is intentionally not in LuaIRC. I think it belongs in a higher level of abstraction. Adding this to LuaIRC reduces the generality of the library by forcing the user to use a message queue, and it also forces the user to use this specific kind of message queue. I suppose it could be added as an optional adapter object, but even then its exact approach to queueing should be well documented (and probably customizable). As a side note, delaying |
|
This is not forced, |
|
What I think would help is if you make something like a meta:queueEnabled functon, sets and gets if the queue is enabled. For example: meta:queueEnabled(true) would enable it, meta:queueEnabled() returns if it's enabled or not. |
There's no reason for it to be an integral part of the IRC object. It can just exist as a separate object that operates on an IRC object. Only clients that need the queue functionality would need the separate queue object. |
|
We could also have it as another branch. |
|
Maintaining two separate branches is a maintenance nightmare. I don't see what advantages it has over just having a separate queue object. |
|
So something like this would be good? local conn = irc.new([...])
conn = irc.Queue(conn)
conn:connect([...])
conn:send("TEST")
conn:queue("TEST2")Unfourtunately getting connect() to use the queue will be difficult this way... |
|
I don't see why edit: But yes, I think that would be really good! :) |
|
Sorry for not responding for so long, but I came up with a solution. Example: require("irc")
require("irc.queue")
local conn = irc.new([...])
conn:connect([...])
conn:send("TEST") -- Sent instantly
conn:queue("TEST2") -- Sent at the next think() |
|
Silently altering the behaviour of the |
|
Importing |
Most users of LuaIRC have to implement their own queue, so I added one to the library.