Skip to content

Conversation

ailin-nemui
Copy link
Contributor

No description provided.

@ailin-nemui
Copy link
Contributor Author

@irssi/developers

@ailin-nemui
Copy link
Contributor Author

@ailin-nemui
Copy link
Contributor Author

if disable extended-join, the chase account code runs into verne.freenode.net 263 Nei WHO :This command could not be completed because it has been used recently, and is rate-limited. on freenode

at least make sure the chase is run only 1 time per user

@ailin-nemui ailin-nemui force-pushed the whox branch 3 times, most recently from e1d82c3 to abccc4b Compare January 28, 2021 22:26
@ailin-nemui
Copy link
Contributor Author

we're now only querying one user once even if they join multiple channels, but still:

I get the 263 error for something like WHO losuler %tna

the common issue seems to be that the person (nick) has left already (QUIT the network or changed nick)
at the time my queued who command makes it through

@ailin-nemui
Copy link
Contributor Author

now we purge the WHOs from the queue. hope that's good enough

@ailin-nemui
Copy link
Contributor Author

@irssi/developers

@ailin-nemui
Copy link
Contributor Author

here is a script that makes use of the account field http://anti.teamidiot.de/static/nei/*/Code/Irssi/account_expando.pl

@ailin-nemui ailin-nemui added the auto-merge This PR is scheduled for merge if no further comments are opened label Feb 26, 2021
@ailin-nemui
Copy link
Contributor Author

@irssi/developers

@dequis
Copy link
Member

dequis commented Feb 27, 2021

"update clang-format to clang-format-11, fixes enum bug" what enum bug?

@ailin-nemui
Copy link
Contributor Author

clang-format < 11 will want to force-format enums like this, iirc:

enum {	CHANNEL_QUERY_MODE,
		CHANNEL_QUERY_WHO,
		CHANNEL_QUERY_BMODE,

		CHANNEL_QUERIES
};

Comment on lines 81 to 82
g_hash_table_foreach(rec->accountqueries, (GHFunc) g_free, NULL);
g_hash_table_destroy(rec->accountqueries);
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed that foreach now


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"
Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Member

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

Copy link
Contributor Author

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

Comment on lines 46 to 51
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;
}
Copy link
Member

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.

Copy link
Contributor Author

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

Copy link
Contributor Author

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?

Copy link
Member

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?

Copy link
Contributor Author

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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this safe?

Copy link
Contributor Author

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)

Comment on lines 604 to 607
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);
Copy link
Member

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?

Copy link
Contributor Author

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?

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Contributor Author

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

@ailin-nemui ailin-nemui removed the auto-merge This PR is scheduled for merge if no further comments are opened label Feb 27, 2021
@ailin-nemui
Copy link
Contributor Author

@dequis friendly ping :-)

@ailin-nemui ailin-nemui merged commit 437accd into irssi:master Apr 1, 2021
@ailin-nemui ailin-nemui deleted the whox branch April 1, 2021 19:27
@ailin-nemui ailin-nemui added this to the 1.3.0 milestone Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants