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

Fix: syncing channel does not trigger event handlers #1773

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

michaelortmann
Copy link
Member

@michaelortmann michaelortmann commented Feb 9, 2025

Found by: wilkowy
Patch by: michaelortmann
Fixes: #599

One-line summary:
Fix: syncing channel does not trigger event handlers

Additional description (if needed):
When the bot joins a chan, gotjoin() creates a member for the channel member list and then it resets the chan with flags CHAN_RESETALL, removing that member again. This PR unsets flag CHAN_RESETWHO for this very case, when the member list contains 1 member, which is the bot itself that just got created.

Test cases demonstrating functionality (if applicable):
scripts/599.tcl :

proc wilktest:user_kick {nick uhost hand chan whom why} {
	putlog "#DEBUG# user_kick $nick $uhost $hand $chan $whom $why"
	if {[isbotnick $whom]} {
		putlog "#DEBUG# user_kick - me"
		return
	}
	return
}

proc wilktest:chan_mode {nick uhost hand chan mode whom} {
	putlog "#DEBUG# chan_mode $nick $uhost $hand $chan $mode $whom / [isbotnick $whom] [botisop $chan] [wasop $whom $chan] [isop $whom $chan]"
	return
}

bind kick - * wilktest:user_kick
bind mode - *+o* wilktest:chan_mode

eggdrop.conf:
source scripts/599.tcl
start eggdrop and .+chan #testchan and let it join a server
on another irc client, join #testchan before the bot and as soon as the bot joins the channel op it
Before:
The bot will see the op, but not trigger tcl:
[12:59:22] [@] :testuser!~michael@localhost MODE #testchan +o BotA
After:

[13:00:50] #testchan: mode change '+o BotA' by testuser!~michael@localhost
[13:00:50] triggering bind wilktest:chan_mode
[13:00:50] #DEBUG# chan_mode testuser ~michael@localhost * #testchan +o BotA / 1 1 0 1

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

Successfully merging this pull request may close these issues.

[1.8.3] syncing channel does not trigger event handlers
1 participant