Open RX14 opened 6 years ago
Ok thanks :)
I think you could build the parameters of the message from a Enum(String)
instead of Array(String)
.
@Nephos I assume you mean Enumberable
.
Maybe, but currently the way to serialize an IRC message is to create a new Message
struct then call to_s
. It would be ugly and inefficient to make the instance variable for args an Enumberable
, but converting it to an array silently in the constructor would be a bit off too.
Perhaps extracting generating IRC from Message#to_s
to a more generic method that took generic Enumerable
would be a better solution, but perhaps a bit ugly to use. I think i'll do it though:
FastIRC.serialize(command : String, params : Enumberable(String) = Tuple.new) : String
FastIRC.serialize(command : String, *, params : Enumberable(String) = Tuple.new, source : String, user : String? = nil, host : String? = nil) : String
FastIRC.serialize(io : IO, command : String, params : Enumberable(String) = Tuple.new) : Nil
FastIRC.serialize(io : IO, command : String, *, params : Enumberable(String) = Tuple.new, source : String, user : String? = nil, host : String? = nil) : Nil
is probably how i'd do the interface
I see though that your way of representing IRC is quite different to the RFC's:
NOTES:
1) After extracting the parameter list, all parameters are equal
whether matched by <middle> or <trailing>. <trailing> is just a
syntactic trick to allow SPACE within the parameter.
whereas you always treat the trailing "message" parameter differently.
The RFC is more what you call guidelines, than actual rules :) I'm looking for using fast_irc in the hooking system, it might require some time to change the current implementation.
@Nephos sure, but I think the protocol part of the RFC is fairly well agreed on.
(that was a reference to Pirate of C.) Well you must be right. I'll see
@Nephos I feel stupid for missing that reference haha
I've a lot of work these days, so I don't think I'll do it before at least 30 more days. Too much stuff to handle at once, you know what it is ;)
@Nephos that's fine, it was just an interesting suggestion.
See https://github.com/veelenga/awesome-crystal/pull/240.
Better to keep the communication here and away from the awesome-crystal repo.