Open Zarthus opened 7 years ago
What about a method that returns if the client is in all intended channels?
In Client.java:
boolean isInIntendedChannels();
Returns true if list of channels submitted to join are all channels the client is currently present in.
Could be called upon RequestedChannelJoinCompleteEvent
if interested in such info.
Why not both?
I think an event would be better so I can assign variables to it on sync and not worry too much about it, whereas with a method I would have to constantly check. With the last bit of your suggestion you would also have to subscribe to ChannelPartCompleteEvent, or whatever its name is.
I'm currently already subscribing to those events and doing an equals check.
When would this magical event be fired? Once per connection? Every time you go from <intendedChannelCount
to ==intendedChannelCount
?
The idea is whenever the connection is established and KICL thinks it is finished synchronizing with the server.
irssi has something like this where it waits on channel join and tells the user when it received all data, I want the same thing, but for just in general, not a single channel. (although both are welcome)
So only once per connection (and if you disconnect, once again on reconnect), after that, KICL is synced and any changes (parts, kicks, etc.) that are sensitive to your command are for the programmer to account for.
Whether you want to throw the event when if (channelCount == intendedChannelCount && whoPollingCompleted && !notTriggeredBefore) {}
or with some extra conditions is up to you, but ultimately the idea is that I can expect that my methods like finding an user and getting a channel should yield non-empty-optional results. (and while that still may not be the case, it certainly isn't as I just joined the channel or started the connection)
What happens when addChannel
is called after the event is fired? The conditions are being newly met again, without having parted and rejoined.
can have an irssi-style channel sync event if you want, and once all of them are synced from the builder throw the one connectionsync event. then always keep providing channelsync events.
My main usecase is that I'm building from a configuration with certain expectations, if I later add a channel, that's not going to affect my configuration. It might matter to a project like korobi where topic information and user lists are useful to have, but not for me.
An event for when KICL is fully synced with the server (join queue empty, ideally identification detection but that's hard) for every time it has (connected|reconnected) would be nice for running some not-too-time-sensitive commands that rely on getting channels or users without specifically WHOISing them or listening to the Join/Part event and seeing if the channel matches our target channel.