pidgin/pidgin

Remove PurpleProtocol->status_types

2 weeks ago, Gary Kramlich
f7e2506d8308
Parents 12b41aac2510
Children a82453779416
Remove PurpleProtocol->status_types

This also set us finally remove the last pieces of protocols.[ch].

Testing Done:
Leonardo led the way to a successful compliation.

Reviewed at https://reviews.imfreedom.org/r/3096/
--- a/libpurple/meson.build Thu Apr 11 22:51:21 2024 -0500
+++ b/libpurple/meson.build Thu Apr 11 23:12:12 2024 -0500
@@ -28,7 +28,6 @@
'plugins.c',
'prefs.c',
'proxy.c',
- 'protocols.c',
'purpleaccount.c',
'purpleaccountmanager.c',
'purpleaccountoption.c',
@@ -150,7 +149,6 @@
'plugins.h',
'prefs.h',
'proxy.h',
- 'protocols.h',
'purpleaccount.h',
'purpleaccountmanager.h',
'purpleaccountoption.h',
--- a/libpurple/protocols.c Thu Apr 11 22:51:21 2024 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +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 <glib/gi18n-lib.h>
-
-#include "protocols.h"
-
-#include "accounts.h"
-#include "debug.h"
-#include "network.h"
-#include "notify.h"
-#include "purpleaccountoption.h"
-#include "purpleconversation.h"
-#include "purpleconversationmanager.h"
-#include "purplecredentialmanager.h"
-#include "purpleprotocol.h"
-#include "purpleprotocolmanager.h"
-#include "purpleprotocolmedia.h"
-#include "purpleprotocolserver.h"
-#include "request.h"
-#include "server.h"
-#include "util.h"
-
-/**************************************************************************/
-/* Protocol API */
-/**************************************************************************/
-static void
-do_protocol_change_account_status(PurpleAccount *account,
- G_GNUC_UNUSED PurpleStatus *old_status,
- PurpleStatus *new_status)
-{
- PurpleProtocol *protocol;
- PurpleProtocolManager *manager;
-
- if (purple_status_is_online(new_status) &&
- purple_account_is_disconnected(account) &&
- purple_network_is_available())
- {
- purple_account_connect(account);
- return;
- }
-
- if (!purple_status_is_online(new_status))
- {
- if (!purple_account_is_disconnected(account))
- purple_account_disconnect(account);
- /* Clear out the unsaved password if we switch to offline status */
- if (!purple_account_get_remember_password(account)) {
- PurpleCredentialManager *manager = NULL;
-
- manager = purple_credential_manager_get_default();
-
- purple_credential_manager_clear_password_async(manager, account,
- NULL, NULL, NULL);
- }
-
- return;
- }
-
- if (purple_account_is_connecting(account))
- /*
- * We don't need to call the set_status protocol function because
- * the protocol will take care of setting its status during the
- * connection process.
- */
- return;
-
- manager = purple_protocol_manager_get_default();
- protocol = purple_protocol_manager_find(manager,
- purple_account_get_protocol_id(account));
-
- if (!PURPLE_IS_PROTOCOL_SERVER(protocol)) {
- return;
- }
-
- if(!purple_account_is_disconnected(account)) {
- purple_protocol_server_set_status(PURPLE_PROTOCOL_SERVER(protocol),
- account, new_status);
- }
-}
-
-void
-purple_protocol_change_account_status(PurpleAccount *account,
- PurpleStatus *old_status, PurpleStatus *new_status)
-{
- g_return_if_fail(account != NULL);
- g_return_if_fail(new_status != NULL);
- g_return_if_fail(!purple_status_is_exclusive(new_status) || old_status != NULL);
-
- do_protocol_change_account_status(account, old_status, new_status);
-
- purple_signal_emit(purple_accounts_get_handle(), "account-status-changed",
- account, old_status, new_status);
-}
-
-GList *
-purple_protocol_get_statuses(PurpleAccount *account, PurplePresence *presence)
-{
- g_return_val_if_fail(account != NULL, NULL);
- g_return_val_if_fail(presence != NULL, NULL);
-
- return g_list_copy_deep(purple_account_get_status_types(account),
- (GCopyFunc)purple_status_new, presence);
-}
--- a/libpurple/protocols.h Thu Apr 11 22:51:21 2024 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +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_PROTOCOLS_H
-#define PURPLE_PROTOCOLS_H
-
-/**************************************************************************/
-/* Basic Protocol Information */
-/**************************************************************************/
-
-#include "media.h"
-#include "purpleprotocol.h"
-#include "purpleversion.h"
-#include "status.h"
-
-G_BEGIN_DECLS
-
-/**************************************************************************/
-/* Protocol API */
-/**************************************************************************/
-
-/**
- * purple_protocol_change_account_status:
- * @account: The account the user is on.
- * @old_status: The previous status.
- * @new_status: The status that was activated, or deactivated
- * (in the case of independent statuses).
- *
- * Informs the server that our account's status changed.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-void purple_protocol_change_account_status(PurpleAccount *account,
- PurpleStatus *old_status,
- PurpleStatus *new_status);
-
-/**
- * purple_protocol_get_statuses:
- * @account: The account the user is on.
- * @presence: The presence for which we're going to get statuses
- *
- * Retrieves the list of stock status types from a protocol.
- *
- * Returns: (transfer full) (element-type PurpleStatus): List of statuses
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-GList *purple_protocol_get_statuses(PurpleAccount *account,
- PurplePresence *presence);
-
-G_END_DECLS
-
-#endif /* PURPLE_PROTOCOLS_H */
--- a/libpurple/purpleprotocol.c Thu Apr 11 22:51:21 2024 -0500
+++ b/libpurple/purpleprotocol.c Thu Apr 11 23:12:12 2024 -0500
@@ -590,20 +590,3 @@
return NULL;
}
-
-GList *
-purple_protocol_get_status_types(PurpleProtocol *protocol,
- PurpleAccount *account)
-{
- PurpleProtocolClass *klass = NULL;
-
- g_return_val_if_fail(PURPLE_IS_PROTOCOL(protocol), NULL);
- g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
-
- klass = PURPLE_PROTOCOL_GET_CLASS(protocol);
- if(klass != NULL && klass->status_types != NULL) {
- return klass->status_types(protocol, account);
- }
-
- return NULL;
-}
--- a/libpurple/purpleprotocol.h Thu Apr 11 22:51:21 2024 -0500
+++ b/libpurple/purpleprotocol.h Thu Apr 11 23:12:12 2024 -0500
@@ -147,8 +147,6 @@
PurpleConnection *(*create_connection)(PurpleProtocol *protocol, PurpleAccount *account, const char *password, GError **error);
- GList *(*status_types)(PurpleProtocol *protocol, PurpleAccount *account);
-
/*< private >*/
gpointer reserved[4];
};
@@ -337,21 +335,6 @@
PurpleConnection *purple_protocol_create_connection(PurpleProtocol *protocol, PurpleAccount *account, const char *password, GError **error);
/**
- * purple_protocol_get_status_types:
- * @protocol: The #PurpleProtocol instance.
- * @account: The #PurpleAccount instance.
- *
- * Gets all of the #PurpleStatusType's for @account which uses @protocol.
- *
- * Returns: (transfer full) (element-type PurpleStatusType): A list of the
- * available PurpleStatusType's for @account with @protocol.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-GList *purple_protocol_get_status_types(PurpleProtocol *protocol, PurpleAccount *account);
-
-/**
* purple_protocol_get_icon_name:
* @protocol: The #PurpleProtocol instance.
*
--- a/libpurple/status.c Thu Apr 11 22:51:21 2024 -0500
+++ b/libpurple/status.c Thu Apr 11 23:12:12 2024 -0500
@@ -29,7 +29,6 @@
#include "debug.h"
#include "notify.h"
#include "prefs.h"
-#include "protocols.h"
#include "status.h"
/*
--- a/po/POTFILES.in Thu Apr 11 22:51:21 2024 -0500
+++ b/po/POTFILES.in Thu Apr 11 23:12:12 2024 -0500
@@ -36,7 +36,6 @@
libpurple/plugins/statenotify/statenotify.c
libpurple/plugins/wincred/wincred.c
libpurple/prefs.c
-libpurple/protocols.c
libpurple/proxy.c
libpurple/purpleaccount.c
libpurple/purpleaccountmanager.c