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

OnJoin not reliable? #28

Closed
bstahly opened this issue Nov 11, 2014 · 2 comments
Closed

OnJoin not reliable? #28

bstahly opened this issue Nov 11, 2014 · 2 comments

Comments

@bstahly
Copy link

bstahly commented Nov 11, 2014

I'm trying to build a bot that keeps a list of logged in user nicks. I'd like to create an initial list when the room is first entered, then keep the list up to date anytime a new user joins. I tried OnChannelActiveSynced and OnChannelPassiveSynced, but when I call GetChannel, only the bot shows up in the "users" property.
I noticed that sometimes when the bot joins, OnJoin will be called for each currently logged in user so I wrote the below code to build the "useList" one nick at a time. Other times though, OnJoin is only called once for the bot and isn't called for each logged in user. Why would the behavior change?

Is it possible the channel I'm connecting to has different sync rules/settings? Maybe my bot is rejoining too quickly so it's not actually resyncing the room correctly?
I can't think of what else might be causing this unreliable behavior.

Please let me know if there is a better place to post and thanks for any help!


irc.OnJoin += new JoinEventHandler(OnJoin);

private void OnJoin(object sender, IrcEventArgs e)
{
  if (!irc.IsMe(e.Data.Nick))
  {
    if (!userList.Contains(e.Data.Nick))
    {
      userList.Add(e.Data.Nick);
    }
  }
}
@meebey
Copy link
Owner

meebey commented Jul 5, 2015

You should turn on the debug logging via log4net, I believe what you see is that JOIN is simply the confirmation of the IRC server that someone joined a channel. It can be your own join or a join of someone else. Using OnChannelActiveSynced should be reliable though, it will only be raised when you join a channel and all users were retrieved, this is close to OnNames, but NAMES has other oddities on IRC :-D like it can be raised multiple times since the message limit of 512 chars.

@meebey
Copy link
Owner

meebey commented Sep 24, 2024

I am closing this inactive issue. If the problem remains, feel free to re-open.

@meebey meebey closed this as completed Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants