IRCv3: Fix a bug where part messages were not being parsed correctly

Fri, 27 Sep 2024 01:49:39 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 27 Sep 2024 01:49:39 -0500
changeset 42982
310d3d474f8c
parent 42981
c512d4a3eda0
child 42983
c65fa958d972

IRCv3: Fix a bug where part messages were not being parsed correctly

Testing Done:
Verified this with an in progress review request to add event messages for joins/parts.

Reviewed at https://reviews.imfreedom.org/r/3538/

protocols/ircv3/purpleircv3messagehandlers.c file | annotate | diff | comparison | revisions
--- a/protocols/ircv3/purpleircv3messagehandlers.c	Fri Sep 27 01:44:31 2024 -0500
+++ b/protocols/ircv3/purpleircv3messagehandlers.c	Fri Sep 27 01:49:39 2024 -0500
@@ -60,17 +60,15 @@
 	PurpleContact *contact = NULL;
 	PurpleConversation *conversation = NULL;
 	GStrv params = NULL;
-	guint n_params = 0;
 	const char *conversation_name = NULL;
 
 	contact = purple_ircv3_connection_find_or_create_contact(connection,
 	                                                         message);
 
 	params = ibis_message_get_params(message);
-	n_params = g_strv_length(params);
 
 	/* A normal join command has the channel as the only parameter. */
-	if(n_params == 1) {
+	if(g_strv_length(params) == 1) {
 		conversation_name = params[0];
 	} else {
 		/* TODO: write this to join to the status window saying we didn't know
@@ -105,7 +103,8 @@
 	const char *conversation_name = NULL;
 
 	params = ibis_message_get_params(message);
-	if(g_strv_length(params) == 0) {
+	n_params = g_strv_length(params);
+	if(n_params == 0) {
 		/* TODO: mention unparsable message in the status window. */
 		return TRUE;
 	}

mercurial