-
Notifications
You must be signed in to change notification settings - Fork 372
better account tracking #1250
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
better account tracking #1250
Conversation
@irssi/developers |
if disable extended-join, the chase account code runs into at least make sure the chase is run only 1 time per user |
e1d82c3
to
abccc4b
Compare
we're now only querying one user once even if they join multiple channels, but still: I get the 263 error for something like the common issue seems to be that the person (nick) has left already (QUIT the network or changed nick) |
now we purge the WHOs from the queue. hope that's good enough |
@irssi/developers |
here is a script that makes use of the account field http://anti.teamidiot.de/static/nei/*/Code/Irssi/account_expando.pl |
@irssi/developers |
"update clang-format to clang-format-11, fixes enum bug" what enum bug? |
clang-format < 11 will want to force-format enums like this, iirc:
|
src/irc/core/channels-query.c
Outdated
g_hash_table_foreach(rec->accountqueries, (GHFunc) g_free, NULL); | ||
g_hash_table_destroy(rec->accountqueries); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
void
(*GHFunc) (gpointer key,
gpointer value,
gpointer user_data);
So that foreach
does g_free(key)
? And doesn't touch the value
g_hash_table_new_full()
was called with g_free
as the destructor for keys, and nothing for value.
and g_hash_table_destroy()
calls the destructor, so it looks like it will double-free the keys.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch! double free here, I initially copied the code without a DestroyNotify!
but the values don't need to be freed here AFAIK (maybe you can double check for me) as we're using this table as a set only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed that foreach now
src/irc/core/channels-query.c
Outdated
|
||
GSList *queries[CHANNEL_QUERIES]; /* All queries that need to be asked from server */ | ||
} SERVER_QUERY_REC; | ||
#define WHO_Ps_PPtna_745 "WHO %s %%tna,745" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what even is this name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name is a direct copy of the string content... can you suggest a good name? The reason I have this as a constant is that the similar string is used in more than 1 place and this way when editing the code later on I will be sure to notice that the string must be changed in more than 1 place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oooh lol, P means percentage, now i get it. But okay, just add a comment next to it explaining what it means? WHOX is cryptic
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
now resolved by your suggestion below
if (g_ascii_strcasecmp(nick, server->nick) == 0) { | ||
/* You joined, no need to do anything here */ | ||
return; | ||
/* You joined, do not massjoin */ | ||
send_massjoin = FALSE; | ||
} else { | ||
send_massjoin = TRUE; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, can you explain this part? The return not being here means we call irc_nicklist_insert, which we previously didn't at this point. What is this for?
I think I understand the massjoin part but don't care much about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The goal is that we fill in our OWN account here as well, if we receive it. Otherwise we would need more special code for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should I expand the comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the comment is fine for the code, I'm just wondering about the diff. So it's fine to just do the irc_nicklist_insert here? I guess something else might do that later with fewer details and end up as a no-op?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
normally our own nick gets inserted only as part of event_names_list
in irc-nicklist.c when the NAMES are received after join (with a special case further down to insert our own nick in any case if it was NOT contained in NAMES). The code in massjoin.c handles all the JOINs that happen after we are joined to a channel.
When I relax that check, the (special?) self-JOIN that we get when joining a channel will also be fed through the JOIN code in massjoin.c, with the benefit that we can leech on the extended-account there.
As a consequence, I had to change irc-nicklist.c's NAMES handler to update our CHANNEL USER MODES from the NAMES.
I don't know if all of this is a very bad(tm) idea and if it would be better to do it in some other way.
What do you think? Can you follow my explanation?
signal_emit(rec->failure_signal, 1, server); | ||
signal_emit(rec->failure_signal, 3, server, rec->cmd->name, rec->arg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this safe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an API change, we add 2 more arguments to the failure signal. As far as I know existing code is also sloppy on arguments so this should not be more unsafe than what we have in other places.
(In general the whole signal emission system is a bit unsafe)
src/irc/core/irc-nicklist.c
Outdated
signal_add_first("event 354", (SIGNAL_FUNC) event_whox_743); | ||
signal_add("silent event who", (SIGNAL_FUNC) event_who); | ||
signal_add("silent event whox", (SIGNAL_FUNC) event_whox_743); | ||
signal_add("silent event whox useraccount", (SIGNAL_FUNC) event_whox_745); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do 743 and 745 mean here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! These are arbitrary 3-digit numerics that the client should choose for their WHOX queries. I threw dice to get them. Make them a constant? Choose different numbers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about encoding the selected fields in the number but 1000 numbers is not enough for all combinations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hahah dice, amazing.
How about this: Put both WHOX commands in some header, something like this
/* identifiers chosen by fair dice roll, guaranteed to be random */
#define WHOX_FULL_ID "743"
#define WHOX_USERACCOUNT_ID "745"
/* some explanation here about WHOX because it's a bullshit spec */
#define WHOX_FULL_CMD "WHO %s %%tcuhnfdar," WHOX_FULL_ID
#define WHOX_USERACCOUNT_CMD "WHO %s %%tna," WHOX_USERACCOUNT_ID
And rename the callbacks from event_whox_745 to event_whox_useraccount, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, I implemented your suggestion
@dequis friendly ping :-) |
No description provided.