IRCv3: Use Ibis.Client.is_channel instead of our old version

Wed, 21 Aug 2024 02:14:09 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Wed, 21 Aug 2024 02:14:09 -0500
changeset 42896
5c8f4a455d3c
parent 42895
e3d235276361
child 42897
1e762ac785a2

IRCv3: Use Ibis.Client.is_channel instead of our old version

The ibis version uses the CHANTYPES feature from RPL_ISUPPORT to determine if
a target is a channel.

Testing Done:
Called in the turtles.

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

protocols/ircv3/purpleircv3connection.c file | annotate | diff | comparison | revisions
protocols/ircv3/purpleircv3connection.h file | annotate | diff | comparison | revisions
protocols/ircv3/purpleircv3messagehandlers.c file | annotate | diff | comparison | revisions
--- a/protocols/ircv3/purpleircv3connection.c	Wed Aug 21 02:11:34 2024 -0500
+++ b/protocols/ircv3/purpleircv3connection.c	Wed Aug 21 02:14:09 2024 -0500
@@ -844,16 +844,6 @@
 	g_clear_object(&message);
 }
 
-gboolean
-purple_ircv3_connection_is_channel(PurpleIRCv3Connection *connection,
-                                   const char *id)
-{
-	g_return_val_if_fail(PURPLE_IRCV3_IS_CONNECTION(connection), FALSE);
-	g_return_val_if_fail(id != NULL, FALSE);
-
-	return (id[0] == '#');
-}
-
 PurpleConversation *
 purple_ircv3_connection_find_or_create_conversation(PurpleIRCv3Connection *connection,
                                                     const char *id)
@@ -873,7 +863,7 @@
 	if(!PURPLE_IS_CONVERSATION(conversation)) {
 		PurpleConversationType type = PURPLE_CONVERSATION_TYPE_DM;
 
-		if(purple_ircv3_connection_is_channel(connection, id)) {
+		if(ibis_client_is_channel(connection->client, id)) {
 			type = PURPLE_CONVERSATION_TYPE_CHANNEL;
 		}
 
--- a/protocols/ircv3/purpleircv3connection.h	Wed Aug 21 02:11:34 2024 -0500
+++ b/protocols/ircv3/purpleircv3connection.h	Wed Aug 21 02:14:09 2024 -0500
@@ -97,23 +97,6 @@
 void purple_ircv3_connection_add_status_message(PurpleIRCv3Connection *connection, IbisMessage *message);
 
 /**
- * purple_ircv3_connection_is_channel:
- * @connection: The instance.
- * @id: The id to check.
- *
- * Checks if @id is a channel.
- *
- * Right now this just checks if @id starts with a `#` but in the future this
- * will be updated to check all channel prefixes that the connection supports.
- *
- * Returns: %TRUE if @id is a channel otherwise %FALSE.
- *
- * Since: 3.0
- */
-PURPLE_IRCV3_AVAILABLE_IN_ALL
-gboolean purple_ircv3_connection_is_channel(PurpleIRCv3Connection *connection, const char *id);
-
-/**
  * purple_ircv3_connection_find_or_create_conversation:
  * @connection: The instance.
  * @id: The id of the conversation.
--- a/protocols/ircv3/purpleircv3messagehandlers.c	Wed Aug 21 02:11:34 2024 -0500
+++ b/protocols/ircv3/purpleircv3messagehandlers.c	Wed Aug 21 02:14:09 2024 -0500
@@ -149,7 +149,7 @@
 }
 
 gboolean
-purple_ircv3_message_handler_tagmsg(G_GNUC_UNUSED IbisClient *client,
+purple_ircv3_message_handler_tagmsg(IbisClient *client,
                                     G_GNUC_UNUSED const char *command,
                                     IbisMessage *ibis_message, gpointer data)
 {
@@ -184,7 +184,7 @@
 
 	/* Find or create the conversation. */
 	target = params[0];
-	if(!purple_ircv3_connection_is_channel(connection, target)) {
+	if(!ibis_client_is_channel(client, target)) {
 		target = purple_contact_info_get_id(PURPLE_CONTACT_INFO(contact));
 	}
 
@@ -220,8 +220,7 @@
 }
 
 gboolean
-purple_ircv3_message_handler_privmsg(G_GNUC_UNUSED IbisClient *client,
-                                     const char *command,
+purple_ircv3_message_handler_privmsg(IbisClient *client, const char *command,
                                      IbisMessage *ibis_message, gpointer data)
 {
 	PurpleIRCv3Connection *connection = data;
@@ -257,7 +256,7 @@
 
 	/* Find or create the conversation. */
 	target = params[0];
-	if(!purple_ircv3_connection_is_channel(connection, target)) {
+	if(!ibis_client_is_channel(client, target)) {
 		target = purple_contact_info_get_id(PURPLE_CONTACT_INFO(contact));
 	}
 

mercurial