Wed, 21 Aug 2024 02:14:09 -0500
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/
--- 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)); }