IRC correctness checks

Mark Doliner mark at kingant.net
Wed Jan 15 21:13:57 EST 2014


Ethan obviously knows way more than I do about our IRC PRPL, but I can
give answers so you have a second point of view.

On Wed, Jan 15, 2014 at 5:20 PM, Tomasz Wasilczyk <tomasz at wasilczyk.pl> wrote:
> Can I safely assume, that (gc != NULL) is required for *all* IRC messages,
> to get rid of these checks?

We're talking about incoming message parsing, right? It might make
sense to look through the code and verify that this is true, but,
yeah, that makes sense to me. I mean, how could you even receive an
incoming message if you don't have a gc? It seems impossible to me. If
you decide to bail out when gc==NULL, please g_return_if_fail (or if
that's not appropriate then purple_debug_error).

> Also, to simplify the code a bit, PurpleConnection object could be
> passed to the callback, just like irc_conn struct is.

This is for all the irc_msg_blah functions? Current parameter list is:
struct irc_conn *irc, const char *name, const char *from, char **args

That's not too bad. And it looks like maybe half the functions use gc.
I'm mildly in favor of passing it in. But whatever, doesn't matter
much either way.

> Moreover, I'm not sure if PURPLE_CONNECTION_IS_CONNECTED shouldn't be
> checked also.

If this check already exists in any of the irc_msg_blah functions then
it probably makes sense to leave it in place. I don't see a need to
add the check anywhere else. If the account is receiving incoming
messages then it seems like it's effectively connected. Might as well
carry on parsing the messages.


More information about the security mailing list