Skip to content
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

An event that is ran each time KICL thinks it is synced with the channel. #169

Open
Zarthus opened this issue Dec 18, 2016 · 6 comments
Open

Comments

@Zarthus
Copy link
Member

Zarthus commented Dec 18, 2016

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.

@mbax mbax modified the milestone: 3.1.0 Dec 29, 2016
@mbax
Copy link
Member

mbax commented Jan 25, 2017

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.

@Zarthus
Copy link
Member Author

Zarthus commented Jan 25, 2017

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.

@mbax
Copy link
Member

mbax commented Jan 25, 2017

When would this magical event be fired? Once per connection? Every time you go from <intendedChannelCount to ==intendedChannelCount?

@Zarthus
Copy link
Member Author

Zarthus commented Jan 25, 2017

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)

@mbax
Copy link
Member

mbax commented Jan 25, 2017

What happens when addChannel is called after the event is fired? The conditions are being newly met again, without having parted and rejoined.

@Zarthus
Copy link
Member Author

Zarthus commented Jan 25, 2017

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.

@mbax mbax modified the milestones: Future!, 3.1.0 May 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants