pidgin/pidgin

Remove xfer signals for status changes.

14 months ago, Elliott Sales de Andrade
09402b6a28cf
Parents 7f38c3cc5c91
Children 42922708e18e
Remove xfer signals for status changes.

It can be monitored by connecting to notify::status on an individual
PurpleXfer instead.
--- a/ChangeLog.API Sat Dec 21 03:12:10 2019 -0500
+++ b/ChangeLog.API Sat Dec 21 20:14:34 2019 -0500
@@ -325,6 +325,10 @@
* _PurpleSoundEventID
* _XMLNodeType
* account-authorization-requested-with-message 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
+ notify::status on #PurpleXfer objects instead.
* network-configuration-changed signal
* PurpleAccount->ui_data
* PurpleAccountPrefsUiOps
--- a/doc/reference/libpurple/signals_xfer.xml Sat Dec 21 03:12:10 2019 -0500
+++ b/doc/reference/libpurple/signals_xfer.xml Sat Dec 21 20:14:34 2019 -0500
@@ -8,105 +8,13 @@
<refsect1 id="xfers.signals" role="signal_proto">
<title role="signal_proto.title">List of signals</title>
<synopsis>
- &quot;<link linkend="xfers-file-recv-accept">file-recv-accept</link>&quot;
- &quot;<link linkend="xfers-file-recv-start">file-recv-start</link>&quot;
- &quot;<link linkend="xfers-file-recv-cancel">file-recv-cancel</link>&quot;
- &quot;<link linkend="xfers-file-recv-complete">file-recv-complete</link>&quot;
&quot;<link linkend="xfers-file-recv-request">file-recv-request</link>&quot;
- &quot;<link linkend="xfers-file-send-accept">file-send-accept</link>&quot;
- &quot;<link linkend="xfers-file-send-start">file-send-start</link>&quot;
- &quot;<link linkend="xfers-file-send-cancel">file-send-cancel</link>&quot;
- &quot;<link linkend="xfers-file-send-complete">file-send-complete</link>&quot;
</synopsis>
</refsect1>
<refsect1 id="xfers.signal-details" role="signals">
<title role="signals.title">Signal details</title>
-<refsect2 id="xfers-file-recv-accept" role="signal">
- <title>The <literal>&quot;file-recv-accept&quot;</literal> signal</title>
-<programlisting>
-void user_function (PurpleXfer *xfer,
- gpointer data)
-</programlisting>
- <para>
-Emitted when an incoming file transfer has been accepted.
- </para>
- <variablelist role="params">
- <varlistentry>
- <term><parameter>xfer</parameter>&#160;:</term>
- <listitem><simpara>The file transfer.</simpara></listitem>
- </varlistentry>
- <varlistentry>
- <term><parameter>data</parameter>&#160;:</term>
- <listitem><simpara>User data.</simpara></listitem>
- </varlistentry>
- </variablelist>
-</refsect2>
-
-<refsect2 id="xfers-file-recv-start" role="signal">
- <title>The <literal>&quot;file-recv-start&quot;</literal> signal</title>
-<programlisting>
-void user_function (PurpleXfer *xfer,
- gpointer data)
-</programlisting>
- <para>
-Emitted when an incoming file transfer has been started.
- </para>
- <variablelist role="params">
- <varlistentry>
- <term><parameter>xfer</parameter>&#160;:</term>
- <listitem><simpara>The file transfer.</simpara></listitem>
- </varlistentry>
- <varlistentry>
- <term><parameter>data</parameter>&#160;:</term>
- <listitem><simpara>User data.</simpara></listitem>
- </varlistentry>
- </variablelist>
-</refsect2>
-
-<refsect2 id="xfers-file-recv-cancel" role="signal">
- <title>The <literal>&quot;file-recv-cancel&quot;</literal> signal</title>
-<programlisting>
-void user_function (PurpleXfer *xfer,
- gpointer data)
-</programlisting>
- <para>
-Emitted when an incoming file transfer has been canceled.
- </para>
- <variablelist role="params">
- <varlistentry>
- <term><parameter>xfer</parameter>&#160;:</term>
- <listitem><simpara>The file transfer.</simpara></listitem>
- </varlistentry>
- <varlistentry>
- <term><parameter>data</parameter>&#160;:</term>
- <listitem><simpara>User data.</simpara></listitem>
- </varlistentry>
- </variablelist>
-</refsect2>
-
-<refsect2 id="xfers-file-recv-complete" role="signal">
- <title>The <literal>&quot;file-recv-complete&quot;</literal> signal</title>
-<programlisting>
-void user_function (PurpleXfer *xfer,
- gpointer data)
-</programlisting>
- <para>
-Emitted when an incoming file transfer has been completed.
- </para>
- <variablelist role="params">
- <varlistentry>
- <term><parameter>xfer</parameter>&#160;:</term>
- <listitem><simpara>The file transfer.</simpara></listitem>
- </varlistentry>
- <varlistentry>
- <term><parameter>data</parameter>&#160;:</term>
- <listitem><simpara>User data.</simpara></listitem>
- </varlistentry>
- </variablelist>
-</refsect2>
-
<refsect2 id="xfers-file-recv-request" role="signal">
<title>The <literal>&quot;file-recv-request&quot;</literal> signal</title>
<programlisting>
@@ -128,90 +36,6 @@
</variablelist>
</refsect2>
-<refsect2 id="xfers-file-send-accept" role="signal">
- <title>The <literal>&quot;file-send-accept&quot;</literal> signal</title>
-<programlisting>
-void user_function (PurpleXfer *xfer,
- gpointer data)
-</programlisting>
- <para>
-Emitted when an outgoing file transfer has been accepted.
- </para>
- <variablelist role="params">
- <varlistentry>
- <term><parameter>xfer</parameter>&#160;:</term>
- <listitem><simpara>The file transfer.</simpara></listitem>
- </varlistentry>
- <varlistentry>
- <term><parameter>data</parameter>&#160;:</term>
- <listitem><simpara>User data.</simpara></listitem>
- </varlistentry>
- </variablelist>
-</refsect2>
-
-<refsect2 id="xfers-file-send-start" role="signal">
- <title>The <literal>&quot;file-send-start&quot;</literal> signal</title>
-<programlisting>
-void user_function (PurpleXfer *xfer,
- gpointer data)
-</programlisting>
- <para>
-Emitted when an outgoing file transfer has started.
- </para>
- <variablelist role="params">
- <varlistentry>
- <term><parameter>xfer</parameter>&#160;:</term>
- <listitem><simpara>The file transfer.</simpara></listitem>
- </varlistentry>
- <varlistentry>
- <term><parameter>data</parameter>&#160;:</term>
- <listitem><simpara>User data.</simpara></listitem>
- </varlistentry>
- </variablelist>
-</refsect2>
-
-<refsect2 id="xfers-file-send-cancel" role="signal">
- <title>The <literal>&quot;file-send-cancel&quot;</literal> signal</title>
-<programlisting>
-void user_function (PurpleXfer *xfer,
- gpointer data)
-</programlisting>
- <para>
-Emitted when an outgoing file transfer has been canceled.
- </para>
- <variablelist role="params">
- <varlistentry>
- <term><parameter>xfer</parameter>&#160;:</term>
- <listitem><simpara>The file transfer.</simpara></listitem>
- </varlistentry>
- <varlistentry>
- <term><parameter>data</parameter>&#160;:</term>
- <listitem><simpara>User data.</simpara></listitem>
- </varlistentry>
- </variablelist>
-</refsect2>
-
-<refsect2 id="xfers-file-send-complete" role="signal">
- <title>The <literal>&quot;file-send-complete&quot;</literal> signal</title>
-<programlisting>
-void user_function (PurpleXfer *xfer,
- gpointer data)
-</programlisting>
- <para>
-Emitted when an outgoing file transfer has been completed.
- </para>
- <variablelist role="params">
- <varlistentry>
- <term><parameter>xfer</parameter>&#160;:</term>
- <listitem><simpara>The file transfer.</simpara></listitem>
- </varlistentry>
- <varlistentry>
- <term><parameter>data</parameter>&#160;:</term>
- <listitem><simpara>User data.</simpara></listitem>
- </varlistentry>
- </variablelist>
-</refsect2>
-
</refsect1>
</chapter>
--- a/libpurple/plugins/autoaccept.c Sat Dec 21 03:12:10 2019 -0500
+++ b/libpurple/plugins/autoaccept.c Sat Dec 21 20:14:34 2019 -0500
@@ -63,11 +63,17 @@
}
static void
-auto_accept_complete_cb(PurpleXfer *xfer, PurpleXfer *my)
+auto_accept_complete_cb(PurpleXfer *xfer, G_GNUC_UNUSED GParamSpec *pspec,
+ G_GNUC_UNUSED gpointer data)
{
- if (xfer == my && purple_prefs_get_bool(PREF_NOTIFY) &&
- !purple_conversations_find_im_with_account(purple_xfer_get_remote_user(xfer), purple_xfer_get_account(xfer)))
- {
+ if (purple_xfer_get_status(xfer) != PURPLE_XFER_STATUS_DONE) {
+ return;
+ }
+
+ if (purple_prefs_get_bool(PREF_NOTIFY) &&
+ !purple_conversations_find_im_with_account(
+ purple_xfer_get_remote_user(xfer),
+ purple_xfer_get_account(xfer))) {
char *message = g_strdup_printf(_("Autoaccepted file transfer of \"%s\" from \"%s\" completed."),
purple_xfer_get_filename(xfer), purple_xfer_get_remote_user(xfer));
purple_notify_info(NULL, _("Autoaccept complete"), message,
@@ -168,8 +174,8 @@
g_free(filename);
}
- purple_signal_connect(purple_xfers_get_handle(), "file-recv-complete", handle,
- PURPLE_CALLBACK(auto_accept_complete_cb), xfer);
+ g_signal_connect(xfer, "notify::status",
+ G_CALLBACK(auto_accept_complete_cb), NULL);
break;
case FT_REJECT:
purple_xfer_set_status(xfer, PURPLE_XFER_STATUS_CANCEL_LOCAL);
--- a/libpurple/plugins/signals-test.c Sat Dec 21 03:12:10 2019 -0500
+++ b/libpurple/plugins/signals-test.c Sat Dec 21 20:14:34 2019 -0500
@@ -543,49 +543,6 @@
}
/**************************************************************************
- * File transfer signal callbacks
- **************************************************************************/
-static void
-ft_recv_accept_cb(PurpleXfer *xfer, gpointer data) {
- purple_debug_misc("signals test", "file receive accepted\n");
-}
-
-static void
-ft_send_accept_cb(PurpleXfer *xfer, gpointer data) {
- purple_debug_misc("signals test", "file send accepted\n");
-}
-
-static void
-ft_recv_start_cb(PurpleXfer *xfer, gpointer data) {
- purple_debug_misc("signals test", "file receive started\n");
-}
-
-static void
-ft_send_start_cb(PurpleXfer *xfer, gpointer data) {
- purple_debug_misc("signals test", "file send started\n");
-}
-
-static void
-ft_recv_cancel_cb(PurpleXfer *xfer, gpointer data) {
- purple_debug_misc("signals test", "file receive cancelled\n");
-}
-
-static void
-ft_send_cancel_cb(PurpleXfer *xfer, gpointer data) {
- purple_debug_misc("signals test", "file send cancelled\n");
-}
-
-static void
-ft_recv_complete_cb(PurpleXfer *xfer, gpointer data) {
- purple_debug_misc("signals test", "file receive completed\n");
-}
-
-static void
-ft_send_complete_cb(PurpleXfer *xfer, gpointer data) {
- purple_debug_misc("signals test", "file send completed\n");
-}
-
-/**************************************************************************
* Sound signal callbacks
**************************************************************************/
static int
@@ -716,7 +673,6 @@
void *conn_handle = purple_connections_get_handle();
void *conv_handle = purple_conversations_get_handle();
void *accounts_handle = purple_accounts_get_handle();
- void *ft_handle = purple_xfers_get_handle();
void *sound_handle = purple_sounds_get_handle();
void *notify_handle = purple_notify_get_handle();
void *jabber_handle = purple_protocols_find("prpl-jabber");
@@ -833,24 +789,6 @@
purple_signal_connect(core_handle, "uri-handler",
plugin, PURPLE_CALLBACK(uri_handler), NULL);
- /* File transfer signals */
- purple_signal_connect(ft_handle, "file-recv-accept",
- plugin, PURPLE_CALLBACK(ft_recv_accept_cb), NULL);
- purple_signal_connect(ft_handle, "file-recv-start",
- plugin, PURPLE_CALLBACK(ft_recv_start_cb), NULL);
- purple_signal_connect(ft_handle, "file-recv-cancel",
- plugin, PURPLE_CALLBACK(ft_recv_cancel_cb), NULL);
- purple_signal_connect(ft_handle, "file-recv-complete",
- plugin, PURPLE_CALLBACK(ft_recv_complete_cb), NULL);
- purple_signal_connect(ft_handle, "file-send-accept",
- plugin, PURPLE_CALLBACK(ft_send_accept_cb), NULL);
- purple_signal_connect(ft_handle, "file-send-start",
- plugin, PURPLE_CALLBACK(ft_send_start_cb), NULL);
- purple_signal_connect(ft_handle, "file-send-cancel",
- plugin, PURPLE_CALLBACK(ft_send_cancel_cb), NULL);
- purple_signal_connect(ft_handle, "file-send-complete",
- plugin, PURPLE_CALLBACK(ft_send_complete_cb), NULL);
-
/* Sound signals */
purple_signal_connect(sound_handle, "playing-sound-event", plugin,
PURPLE_CALLBACK(sound_playing_event_cb), NULL);
--- a/libpurple/xfer.c Sat Dec 21 03:12:10 2019 -0500
+++ b/libpurple/xfer.c Sat Dec 21 20:14:34 2019 -0500
@@ -181,44 +181,6 @@
priv->status = status;
g_object_notify_by_pspec(G_OBJECT(xfer), properties[PROP_STATUS]);
-
- if(priv->type == PURPLE_XFER_TYPE_SEND) {
- switch(status) {
- case PURPLE_XFER_STATUS_ACCEPTED:
- purple_signal_emit(purple_xfers_get_handle(), "file-send-accept", xfer);
- break;
- case PURPLE_XFER_STATUS_STARTED:
- purple_signal_emit(purple_xfers_get_handle(), "file-send-start", xfer);
- break;
- case PURPLE_XFER_STATUS_DONE:
- purple_signal_emit(purple_xfers_get_handle(), "file-send-complete", xfer);
- break;
- case PURPLE_XFER_STATUS_CANCEL_LOCAL:
- case PURPLE_XFER_STATUS_CANCEL_REMOTE:
- purple_signal_emit(purple_xfers_get_handle(), "file-send-cancel", xfer);
- break;
- default:
- break;
- }
- } else if(priv->type == PURPLE_XFER_TYPE_RECEIVE) {
- switch(status) {
- case PURPLE_XFER_STATUS_ACCEPTED:
- purple_signal_emit(purple_xfers_get_handle(), "file-recv-accept", xfer);
- break;
- case PURPLE_XFER_STATUS_STARTED:
- purple_signal_emit(purple_xfers_get_handle(), "file-recv-start", xfer);
- break;
- case PURPLE_XFER_STATUS_DONE:
- purple_signal_emit(purple_xfers_get_handle(), "file-recv-complete", xfer);
- break;
- case PURPLE_XFER_STATUS_CANCEL_LOCAL:
- case PURPLE_XFER_STATUS_CANCEL_REMOTE:
- purple_signal_emit(purple_xfers_get_handle(), "file-recv-cancel", xfer);
- break;
- default:
- break;
- }
- }
}
static void
@@ -2497,30 +2459,6 @@
void *handle = purple_xfers_get_handle();
/* register signals */
- purple_signal_register(handle, "file-recv-accept",
- purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
- PURPLE_TYPE_XFER);
- purple_signal_register(handle, "file-send-accept",
- purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
- PURPLE_TYPE_XFER);
- purple_signal_register(handle, "file-recv-start",
- purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
- PURPLE_TYPE_XFER);
- purple_signal_register(handle, "file-send-start",
- purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
- PURPLE_TYPE_XFER);
- purple_signal_register(handle, "file-send-cancel",
- purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
- PURPLE_TYPE_XFER);
- purple_signal_register(handle, "file-recv-cancel",
- purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
- PURPLE_TYPE_XFER);
- purple_signal_register(handle, "file-send-complete",
- purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
- PURPLE_TYPE_XFER);
- purple_signal_register(handle, "file-recv-complete",
- purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
- PURPLE_TYPE_XFER);
purple_signal_register(handle, "file-recv-request",
purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
PURPLE_TYPE_XFER);