Closed thommey closed 4 months ago
On join the bot stores the unixtime for the joiner (and itself): https://github.com/eggheads/eggdrop/blob/39a582cda2e587d2aa6f95028d078ab4f739ecbe/src/mod/irc.mod/chan.c#L2069
but if the joiner is the bot itself, then it will additionally call reset_chan_info()
to do the WHO and MODE stuff:
https://github.com/eggheads/eggdrop/blob/39a582cda2e587d2aa6f95028d078ab4f739ecbe/src/mod/irc.mod/chan.c#L2116
reset_chan_info()
will throw away the memberlist with all its join-time information. This is where the bot forgets its own join time. The memberlist will be recreated from scratch by the WHO-reply from the server in got352or4(), but that doest supply join times.
This problem extends to any chan reset and any user preset in the chan while resetting and can be observed with command .reset
Eggdrop currently lacks the facility to save join times (or any other stored channel member information) for a channel reset. Not trivial to fix for its more like a feature add than a bug fix.
Also i wonder, if we could/should skip the memberlist reset, or at least the reset of the bot member, when eggdrop joins the channel. Or could we run into any sync issues? Looks like currently the channel reset is used dual purpose: for a full reset and for a join and could be a better adapted to the join case.
See also clear_channel()
and init_channel()
, where init_channel()
finally clears the memberlist
Still figuring this out / thinking out loud.: Could we use the WHO_SYNCED
flag to not loose the joined-times between init_channel()
when called for channel reset and got352()
/ got352or4()
? That flag is, to my understanding, currently not used correctly and it might have been intended for this purpose from the start? my idea is to now throw away the members in init_channel when called for channel reset, but to toggle the WHO_SYNCED flag. Then later, when the who reply is received and the member-list is re-created from scratch in the got352 func, that func would be able to copy joined-times (or other data) from the old members to the new ones before throwing away the old ones.
Expect it to be the unixtime the bot noticed its own join from the server
Found by: Empus