pidgin/pidgin

Remove the old conversations API

2 weeks ago, Gary Kramlich
7c0d5898fa96
Parents c29c417539ff
Children fa0997afdc85
Remove the old conversations API

Everything has been migrated to PurpleConversationManager and only plugins that
needt to be ported were using the signals.

Testing Done:
Ran with the turtles.

Reviewed at https://reviews.imfreedom.org/r/3130/
--- a/ChangeLog.API Sun Apr 14 02:32:44 2024 -0500
+++ b/ChangeLog.API Sun Apr 14 02:52:19 2024 -0500
@@ -278,6 +278,11 @@
* chat-user-joining signal.
* chat-user-left signal.
* chat-user-leaving signal.
+ * cleared-message-history signal.
+ * conversation-created signal.
+ * conversation-extended-menu signal.
+ * conversation-updated signal.
+ * deleting-conversation signal.
* file-recv-accept, file-recv-cancel, file-recv-complete,
file-recv-start, file-send-accept, file-send-cancel,
file-send-complete, file-send-start signals. Use
@@ -483,6 +488,7 @@
* purple_conversation_clear_message_history
* purple_conversation_close_logs
* purple_conversation_do_command
+ * purple_conversation_get_extended_menu
* purple_conversation_get_max_message_size
* purple_conversation_get_message_history
* purple_conversation_get_remote_smileys
@@ -492,15 +498,18 @@
* purple_conversation_set_account
* purple_conversation_set_logging
* purple_conversation_set_ui_ops
+ * purple_conversation_update
* purple_conversations_add.
- * purple_conversations_get_all.
* purple_conversations_find_with_account.
* purple_conversations_find_im_with_account.
* purple_conversations_find_chat_with_account.
* purple_conversations_find_chat.
+ * purple_conversations_get_all.
+ * purple_conversations_get_handle.
* purple_conversations_get_ui_ops.
* purple_conversations_remove.
* purple_conversations_set_ui_ops.
+ * purple_conversations_uninit.
* purple_core_get_ui, use purple_core_get_ui_info instead.
* purple_core_ensure_single_instance. Check via GApplication
or whatever is appropriate for your UI.
--- a/libpurple/conversations.c Sun Apr 14 02:32:44 2024 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-/*
- * Purple - Internet Messaging Library
- * Copyright (C) Pidgin Developers <devel@pidgin.im>
- *
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this library; if not, see <https://www.gnu.org/licenses/>.
- */
-
-#include "conversations.h"
-
-#include "prefs.h"
-#include "purpleprivate.h"
-#include "purpleconversationmanager.h"
-#include "signals.h"
-
-void *
-purple_conversations_get_handle(void)
-{
- static int handle;
-
- return &handle;
-}
-
-void
-purple_conversations_init(void)
-{
- void *handle = purple_conversations_get_handle();
-
- /**********************************************************************
- * Register preferences
- **********************************************************************/
-
- /* Conversations */
- purple_prefs_add_none("/purple/conversations");
-
- /* Conversations -> Chat */
- purple_prefs_add_none("/purple/conversations/chat");
- purple_prefs_add_bool("/purple/conversations/chat/show_nick_change", TRUE);
-
- /* Conversations -> IM */
- purple_prefs_add_none("/purple/conversations/im");
- purple_prefs_add_bool("/purple/conversations/im/send_typing", TRUE);
-
-
- /**********************************************************************
- * Register signals
- **********************************************************************/
- purple_signal_register(handle, "conversation-created",
- purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
- PURPLE_TYPE_CONVERSATION);
-
- purple_signal_register(handle, "conversation-updated",
- purple_marshal_VOID__POINTER_UINT, G_TYPE_NONE, 2,
- PURPLE_TYPE_CONVERSATION, G_TYPE_UINT);
-
- purple_signal_register(handle, "deleting-conversation",
- purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
- PURPLE_TYPE_CONVERSATION);
-
- purple_signal_register(handle, "cleared-message-history",
- purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
- PURPLE_TYPE_CONVERSATION);
-
- purple_signal_register(handle, "conversation-extended-menu",
- purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2,
- PURPLE_TYPE_CONVERSATION,
- G_TYPE_POINTER); /* (GList **) */
-}
-
-void
-purple_conversations_uninit(void)
-{
- purple_signals_unregister_by_instance(purple_conversations_get_handle());
-}
--- a/libpurple/conversations.h Sun Apr 14 02:32:44 2024 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * Purple - Internet Messaging Library
- * Copyright (C) Pidgin Developers <devel@pidgin.im>
- *
- * Purple is the legal property of its developers, whose names are too numerous
- * to list here. Please refer to the COPYRIGHT file distributed with this
- * source distribution.
- *
- * This library is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
- *
- * This library is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this library; if not, see <https://www.gnu.org/licenses/>.
- */
-
-#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
-# error "only <purple.h> may be included directly"
-#endif
-
-#ifndef PURPLE_CONVERSATIONS_H
-#define PURPLE_CONVERSATIONS_H
-
-#include "purpleconversation.h"
-#include "purpleversion.h"
-
-G_BEGIN_DECLS
-
-/**************************************************************************/
-/* Conversations Subsystem */
-/**************************************************************************/
-
-/**
- * purple_conversations_get_handle:
- *
- * Returns the conversation subsystem handle.
- *
- * Returns: The conversation subsystem handle.
- *
- * Since: 2.0
- */
-PURPLE_AVAILABLE_IN_ALL
-void *purple_conversations_get_handle(void);
-
-/**
- * purple_conversations_init:
- *
- * Initializes the conversation subsystem.
- *
- * Since: 2.0
- */
-PURPLE_AVAILABLE_IN_ALL
-void purple_conversations_init(void);
-
-/**
- * purple_conversations_uninit:
- *
- * Uninitializes the conversation subsystem.
- *
- * Since: 2.0
- */
-PURPLE_AVAILABLE_IN_ALL
-void purple_conversations_uninit(void);
-
-G_END_DECLS
-
-#endif /* PURPLE_CONVERSATIONS_H */
--- a/libpurple/core.c Sun Apr 14 02:32:44 2024 -0500
+++ b/libpurple/core.c Sun Apr 14 02:52:19 2024 -0500
@@ -28,7 +28,6 @@
#include "cmds.h"
#include "connection.h"
-#include "conversations.h"
#include "core.h"
#include "debug.h"
#include "network.h"
@@ -154,7 +153,6 @@
purple_contact_manager_startup();
purple_presence_manager_startup();
purple_notify_init();
- purple_conversations_init();
purple_conversation_manager_startup();
purple_whiteboard_manager_startup();
@@ -223,7 +221,6 @@
purple_idle_manager_shutdown();
purple_whiteboard_manager_shutdown();
purple_conversation_manager_shutdown();
- purple_conversations_uninit();
purple_notify_uninit();
purple_connections_uninit();
purple_presence_manager_shutdown();
--- a/libpurple/meson.build Sun Apr 14 02:32:44 2024 -0500
+++ b/libpurple/meson.build Sun Apr 14 02:52:19 2024 -0500
@@ -4,7 +4,6 @@
'circularbuffer.c',
'cmds.c',
'connection.c',
- 'conversations.c',
'core.c',
'debug.c',
'image.c',
@@ -104,7 +103,6 @@
'circularbuffer.h',
'cmds.h',
'connection.h',
- 'conversations.h',
'core.h',
'debug.h',
'image.h',
--- a/libpurple/plugins/notification-sound/meson.build Sun Apr 14 02:32:44 2024 -0500
+++ b/libpurple/plugins/notification-sound/meson.build Sun Apr 14 02:52:19 2024 -0500
@@ -6,7 +6,9 @@
gnu_symbol_visibility : 'hidden',
dependencies : [libpurple_dep, glib, CANBERRA],
name_prefix : '',
- install : true, install_dir : PURPLE_PLUGINDIR)
+ install : true,
+ install_dir : PURPLE_PLUGINDIR,
+ build_by_default : false)
devenv.append('PURPLE_PLUGIN_PATH', meson.current_build_dir())
--- a/libpurple/purpleconversation.c Sun Apr 14 02:32:44 2024 -0500
+++ b/libpurple/purpleconversation.c Sun Apr 14 02:52:19 2024 -0500
@@ -24,7 +24,6 @@
#include "purpleconversation.h"
-#include "conversations.h"
#include "debug.h"
#include "notify.h"
#include "purpleconversationmanager.h"
@@ -155,8 +154,6 @@
conv, 0);
}
- purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_ACCOUNT);
-
g_object_notify_by_pspec(G_OBJECT(conv), properties[PROP_ACCOUNT]);
}
}
@@ -549,9 +546,6 @@
/* Auto-set the title. */
purple_conversation_autoset_title(conv);
- purple_signal_emit(purple_conversations_get_handle(),
- "conversation-created", conv);
-
g_object_unref(account);
}
@@ -568,9 +562,6 @@
purple_request_close_with_handle(conv);
- purple_signal_emit(purple_conversations_get_handle(),
- "deleting-conversation", conv);
-
g_clear_pointer(&priv->id, g_free);
g_clear_object(&priv->avatar);
g_clear_pointer(&priv->name, g_free);
@@ -1038,8 +1029,6 @@
priv->features = features;
g_object_notify_by_pspec(G_OBJECT(conv), properties[PROP_FEATURES]);
-
- purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_FEATURES);
}
PurpleConnectionFlags
@@ -1134,8 +1123,6 @@
if(!g_object_get_data(G_OBJECT(conv), "is-finalizing")) {
g_object_notify_by_pspec(G_OBJECT(conv), properties[PROP_TITLE]);
}
-
- purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_TITLE);
}
const gchar *
@@ -1173,7 +1160,6 @@
g_object_notify_by_pspec(G_OBJECT(conv), properties[PROP_NAME]);
purple_conversation_autoset_title(conv);
- purple_conversation_update(conv, PURPLE_CONVERSATION_UPDATE_NAME);
}
const gchar *
@@ -1273,22 +1259,6 @@
return ret;
}
-/*
- * TODO: Need to make sure calls to this function happen in the core
- * instead of the UI. That way UIs have less work to do, and the
- * core/UI split is cleaner. Also need to make sure this is called
- * when chats are added/removed from the blist.
- */
-void
-purple_conversation_update(PurpleConversation *conv,
- PurpleConversationUpdateType type)
-{
- g_return_if_fail(PURPLE_IS_CONVERSATION(conv));
-
- purple_signal_emit(purple_conversations_get_handle(),
- "conversation-updated", conv, type);
-}
-
gboolean
purple_conversation_present_error(const gchar *who, PurpleAccount *account,
const gchar *what)
@@ -1334,18 +1304,6 @@
G_CALLBACK(purple_conversation_send_confirm_cb), _("Cancel"), NULL);
}
-GList *
-purple_conversation_get_extended_menu(PurpleConversation *conv) {
- GList *menu = NULL;
-
- g_return_val_if_fail(PURPLE_IS_CONVERSATION(conv), NULL);
-
- purple_signal_emit(purple_conversations_get_handle(),
- "conversation-extended-menu", conv, &menu);
-
- return menu;
-}
-
gboolean
purple_conversation_get_age_restricted(PurpleConversation *conversation) {
PurpleConversationPrivate *priv = NULL;
--- a/libpurple/purpleconversation.h Sun Apr 14 02:32:44 2024 -0500
+++ b/libpurple/purpleconversation.h Sun Apr 14 02:52:19 2024 -0500
@@ -462,18 +462,6 @@
gboolean purple_conversation_has_focus(PurpleConversation *conv);
/**
- * purple_conversation_update:
- * @conv: The conversation.
- * @type: The update type.
- *
- * Updates the visual status and UI of a conversation.
- *
- * Since: 2.0
- */
-PURPLE_AVAILABLE_IN_ALL
-void purple_conversation_update(PurpleConversation *conv, PurpleConversationUpdateType type);
-
-/**
* purple_conversation_send_confirm:
* @conv: The conversation.
* @message: The message to send.
@@ -492,21 +480,6 @@
void purple_conversation_send_confirm(PurpleConversation *conv, const gchar *message);
/**
- * purple_conversation_get_extended_menu:
- * @conv: The conversation.
- *
- * Retrieves the extended menu items for the conversation.
- *
- * Returns: (element-type PurpleActionMenu) (transfer full): The extended menu
- * items for a conversation, as harvested by the chat-extended-menu
- * signal.
- *
- * Since: 2.1
- */
-PURPLE_AVAILABLE_IN_2_1
-GList * purple_conversation_get_extended_menu(PurpleConversation *conv);
-
-/**
* purple_conversation_present_error:
* @who: The user this error is about
* @account: The account this error is on
--- a/po/POTFILES.in Sun Apr 14 02:32:44 2024 -0500
+++ b/po/POTFILES.in Sun Apr 14 02:52:19 2024 -0500
@@ -3,7 +3,6 @@
libpurple/circularbuffer.c
libpurple/cmds.c
libpurple/connection.c
-libpurple/conversations.c
libpurple/core.c
libpurple/debug.c
libpurple/image.c