pidgin/pidgin

f886f74847b0
Parents f555f11df057
Children 268ffbddb677
Remove PurpleIMConversation and PurpleProtocolIM

Both of these have been replaced and needed to be removed.

Testing Done:
Checked in with our turtle buddies.

Reviewed at https://reviews.imfreedom.org/r/3113/
--- a/ChangeLog.API Sat Apr 13 21:08:59 2024 -0500
+++ b/ChangeLog.API Sat Apr 13 21:21:59 2024 -0500
@@ -248,7 +248,11 @@
instead.
* account-setting-info, account-set-info signals
* account-status-changing signal.
+ * blocked-img-msg signal.
* buddy-status-changed signal.
+ * buddy-typed signal.
+ * buddy-typing signal.
+ * buddy-typing-stopped signal.
* chat-invite-blocked signal.
* chat-invited signal.
* chat-invited-user signal.
@@ -893,9 +897,13 @@
* purple_xfers_uninit
* quitting signal
* received-chat-msg signal
+ * received-im-msg signal
+ * receiving-chat-msg signal
* receiving-chat-msg signal
* sending-chat-msg signal
+ * sending-im-msg signal
* sent-chat-msg signal
+ * sent-im-msg signal
* serv_got_attention
* serv_send_attention
* struct _PurpleAttentionType
@@ -918,7 +926,9 @@
* struct PurpleNotifySearchColumn
* wpurple_g_access
* writing-chat-msg signal
+ * writing-im-msg signal
* wrote-chat-msg signal
+ * wrote-im-msg signal
* xmlnode_set_attrib_with_namespace
* xmlnode_set_attrib_with_prefix
--- a/doc/reference/libpurple/signals_conversation.md Sat Apr 13 21:08:59 2024 -0500
+++ b/doc/reference/libpurple/signals_conversation.md Sat Apr 13 21:21:59 2024 -0500
@@ -5,266 +5,14 @@
### Signal List
-* [writing-im-msg](#writing-im-msg)
-* [wrote-im-msg](#wrote-im-msg)
-* [sending-im-msg](#sending-im-msg)
-* [sent-im-msg](#sent-im-msg)
-* [receiving-im-msg](#receiving-im-msg)
-* [received-im-msg](#received-im-msg)
-* [blocked-im-msg](#blocked-im-msg)
* [conversation-created](#conversation-created)
* [conversation-updated](#conversation-updated)
* [deleting-conversation](#deleting-conversation)
-* [buddy-typing](#buddy-typing)
-* [buddy-typing-stopped](#buddy-typing-stopped)
* [cleared-message-history](#cleared-message-history)
* [conversation-extended-menu](#conversation-extended-menu)
### Signal Details
-#### writing-im-msg
-
-```c
-gboolean user_function(PurpleAccount *account,
- const gchar *who,
- gchar **message,
- PurpleIMConversation *im,
- PurpleMessageFlags flags,
- gpointer user_data);
-```
-
-Emitted before a message is written in an IM conversation. If the message is changed, then the changed message is displayed and logged instead of the original message.
-
-> Make sure to free `*message` before you replace it.
-
-**Parameters:**
-
-**account**
-: The account.
-
-**who**
-: The name of the user.
-
-**message**
-: A pointer to the message.
-
-**im**
-: The IM conversation.
-
-**flags**
-: Flags for this message.
-
-**user_data**
-: user data set when the signal handler was connected.
-
-**Returns:**
-`TRUE` if the message should be canceled, or `FALSE` otherwise.
-
-----
-
-#### wrote-im-msg
-
-```c
-void user_function(PurpleAccount *account,
- const gchar *who,
- gchar *message,
- PurpleIMConversation *im,
- PurpleMessageFlags flags,
- gpointer user_data);
-```
-
-Emitted after a message is written and possibly displayed in a conversation.
-
-**Parameters:**
-
-**account**
-: The account.
-
-**who**
-: The name of the user.
-
-**message**
-: The message.
-
-**im**
-: The IM conversation.
-
-**flags**
-: Flags for this message.
-
-**user_data**
-: user data set when the signal handler was connected.
-
-----
-
-#### sending-im-msg
-
-```c
-void user_function(PurpleAccount *account,
- const gchar *receiver,
- gchar **message,
- gpointer user_data);
-```
-
-Emitted before sending an IM to a user. `message` is a pointer to the message
-string, so the plugin can replace the message before being sent.
-
-> Make sure to free `*message` before you replace it!
-
-**Parameters:**
-
-**account**
-: The account the message is being sent on.
-
-**receiver**
-: The username of the receiver.
-
-**message**
-: A pointer to the outgoing message. This can be modified.
-
-**user_data**
-: user data set when the signal handler was connected.
-
-----
-
-#### sent-im-msg
-
-```c
-void user_function(PurpleAccount *account,
- const gchar *receiver,
- const gchar *message,
- gpointer user_data);
-```
-
-Emitted after sending an IM to a user.
-
-**Parameters:**
-
-**account**
-: The account the message was sent on.
-
-**receiver**
-: The username of the receiver.
-
-**message**
-: The message that was sent.
-
-**user_data**
-: user data set when the signal handler was connected.
-
-----
-
-#### receiving-im-msg
-
-```c
-gboolean user_function(PurpleAccount *account,
- gchar **sender,
- gchar **message,
- PurpleIMConversation *im,
- PurpleMessageFlags *flags,
- gpointer user_data)
-```
-
-Emitted when an IM is received. The callback can replace the name of the sender, the message, or the flags by modifying the pointer to the strings and integer. This can also be used to cancel a message by returning `TRUE`.
-
-> Make sure to free `*sender` and `*message` before you replace them!
-
-**Parameters:**
-
-**account**
-: The account the message was received on.
-
-**sender**
-: A pointer to the username of the sender.
-
-**message**
-: A pointer to the message that was sent.
-
-**im**
-: The IM conversation.
-
-**flags**
-: A pointer to the IM message flags.
-
-**user_data**
-: user data set when the signal handler was connected.
-
-**Returns:**
-
-`TRUE` if the message should be canceled, or `FALSE` otherwise.
-
-----
-
-#### received-im-msg
-
-```c
-void user_function(PurpleAccount *account,
- gchar *sender,
- gchar *message,
- PurpleIMConversation *im,
- PurpleMessageFlags flags,
- gpointer user_data);
-```
-
-Emitted after an IM is received.
-
-**Parameters:**
-
-**account**
-: The account the message was received on.
-
-**sender**
-: The username of the sender.
-
-**message**
-: The message that was sent.
-
-**im**
-: The IM conversation.
-
-**flags**
-: The IM message flags.
-
-**user_data**
-: user data set when the signal handler was connected.
-
-----
-
-#### blocked-im-msg
-
-```c
-void user_function(PurpleAccount *account,
- const gchar *sender,
- const gchar *message,
- PurpleMessageFlags flags,
- time_t when,
- gpointer user_data);
-```
-
-Emitted after an IM is blocked due to privacy settings.
-
-**Parameters:**
-
-**account**
-: The account the message was received on.
-
-**sender**
-: The username of the sender.
-
-**message**
-: The message that was blocked.
-
-**flags**
-: The IM message flags.
-
-**when**
-: The time the message was sent.
-
-**user_data**
-: user data set when the signal handler was connected.
-
-----
-
#### conversation-created
```c
--- a/libpurple/buddy.c Sat Apr 13 21:08:59 2024 -0500
+++ b/libpurple/buddy.c Sat Apr 13 21:21:59 2024 -0500
@@ -25,7 +25,6 @@
#include "debug.h"
#include "purplecontactmanager.h"
#include "purpleconversationmanager.h"
-#include "purpleimconversation.h"
#include "purpleprotocolclient.h"
#include "util.h"
@@ -561,8 +560,6 @@
purple_buddy_set_local_alias(PurpleBuddy *buddy, const gchar *alias) {
PurpleBuddyList *blist = NULL;
PurpleBuddyPrivate *priv = NULL;
- PurpleConversation *im = NULL;
- PurpleConversationManager *manager = NULL;
gchar *old_alias = NULL, *new_alias = NULL;
g_return_if_fail(PURPLE_IS_BUDDY(buddy));
@@ -593,13 +590,6 @@
purple_blist_save_node(blist, PURPLE_BLIST_NODE(buddy));
purple_blist_update_node(blist, PURPLE_BLIST_NODE(buddy));
- manager = purple_conversation_manager_get_default();
- im = purple_conversation_manager_find_im(manager, priv->account,
- priv->name);
- if(PURPLE_IS_IM_CONVERSATION(im)) {
- purple_conversation_autoset_title(im);
- }
-
purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", buddy,
old_alias);
g_free(old_alias);
@@ -620,8 +610,6 @@
purple_buddy_set_server_alias(PurpleBuddy *buddy, const gchar *alias) {
PurpleBuddyList *blist = NULL;
PurpleBuddyPrivate *priv = NULL;
- PurpleConversation *im = NULL;
- PurpleConversationManager *manager = NULL;
gchar *old_alias = NULL, *new_alias = NULL;
g_return_if_fail(PURPLE_IS_BUDDY(buddy));
@@ -654,13 +642,6 @@
purple_blist_save_node(blist, PURPLE_BLIST_NODE(buddy));
purple_blist_update_node(blist, PURPLE_BLIST_NODE(buddy));
- manager = purple_conversation_manager_get_default();
- im = purple_conversation_manager_find_im(manager, priv->account,
- priv->name);
- if(PURPLE_IS_IM_CONVERSATION(im)) {
- purple_conversation_autoset_title(im);
- }
-
purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased", buddy,
old_alias);
g_free(old_alias);
--- a/libpurple/buddyicon.c Sat Apr 13 21:08:59 2024 -0500
+++ b/libpurple/buddyicon.c Sat Apr 13 21:21:59 2024 -0500
@@ -26,7 +26,6 @@
#include "purpleaccountmanager.h"
#include "purpleconversation.h"
#include "purpleconversationmanager.h"
-#include "purpleimconversation.h"
#include "purplepath.h"
#include "purpleprivate.h"
#include "purpleprotocolserver.h"
@@ -873,7 +872,6 @@
guchar *icon_data, size_t icon_len)
{
char *old_icon;
- PurpleConversationManager *manager = NULL;
PurpleImage *old_img;
PurpleImage *img = NULL;
@@ -909,30 +907,12 @@
else
g_hash_table_remove(pointer_icon_cache, node);
- manager = purple_conversation_manager_get_default();
-
if (PURPLE_IS_META_CONTACT(node)) {
PurpleBlistNode *child;
for (child = purple_blist_node_get_first_child(node);
child;
child = purple_blist_node_get_sibling_next(child))
{
- PurpleBuddy *buddy;
- PurpleConversation *im;
-
- if(!PURPLE_IS_BUDDY(child)) {
- continue;
- }
-
- buddy = PURPLE_BUDDY(child);
-
- im = purple_conversation_manager_find_im(manager,
- purple_buddy_get_account(buddy),
- purple_buddy_get_name(buddy));
- if(PURPLE_IS_IM_CONVERSATION(im)) {
- purple_conversation_update(im, PURPLE_CONVERSATION_UPDATE_ICON);
- }
-
/* Is this call necessary anymore? Can the buddies
* themselves need updating when the custom buddy
* icon changes? */
--- a/libpurple/cmds.c Sat Apr 13 21:08:59 2024 -0500
+++ b/libpurple/cmds.c Sat Apr 13 21:21:59 2024 -0500
@@ -22,7 +22,6 @@
#include "cmds.h"
#include "purpleaccount.h"
-#include "purpleimconversation.h"
#include "purplemarkup.h"
static GList *cmds = NULL;
@@ -197,9 +196,10 @@
}
static gboolean
-is_right_type(PurpleCmd *cmd, PurpleConversation *conv)
+is_right_type(G_GNUC_UNUSED PurpleCmd *cmd,
+ G_GNUC_UNUSED PurpleConversation *conv)
{
- return (PURPLE_IS_IM_CONVERSATION(conv) && (cmd->flags & PURPLE_CMD_FLAG_IM));
+ return FALSE;
}
static gboolean
--- a/libpurple/contact.c Sat Apr 13 21:08:59 2024 -0500
+++ b/libpurple/contact.c Sat Apr 13 21:21:59 2024 -0500
@@ -23,7 +23,6 @@
#include "contact.h"
#include "prefs.h"
#include "purpleconversationmanager.h"
-#include "purpleimconversation.h"
#include "purpleprivate.h"
#include "util.h"
@@ -105,8 +104,6 @@
purple_meta_contact_set_alias(PurpleMetaContact *contact, const char *alias)
{
PurpleMetaContactPrivate *priv = NULL;
- PurpleConversationManager *manager = NULL;
- PurpleBlistNode *bnode;
char *old_alias;
char *new_alias = NULL;
@@ -137,21 +134,6 @@
purple_blist_update_node(purple_blist_get_default(),
PURPLE_BLIST_NODE(contact));
- manager = purple_conversation_manager_get_default();
-
- for(bnode = PURPLE_BLIST_NODE(contact)->child; bnode != NULL; bnode = bnode->next)
- {
- PurpleBuddy *buddy = PURPLE_BUDDY(bnode);
- PurpleConversation *im;
-
- im = purple_conversation_manager_find_im(manager,
- purple_buddy_get_account(buddy),
- purple_buddy_get_name(buddy));
- if(PURPLE_IS_IM_CONVERSATION(im)) {
- purple_conversation_autoset_title(im);
- }
- }
-
purple_signal_emit(purple_blist_get_handle(), "blist-node-aliased",
contact, old_alias);
g_free(old_alias);
--- a/libpurple/conversations.c Sat Apr 13 21:08:59 2024 -0500
+++ b/libpurple/conversations.c Sat Apr 13 21:21:59 2024 -0500
@@ -24,7 +24,6 @@
#include "prefs.h"
#include "purpleprivate.h"
-#include "purpleimconversation.h"
#include "purpleconversationmanager.h"
void *
@@ -59,40 +58,6 @@
/**********************************************************************
* Register signals
**********************************************************************/
- purple_signal_register(handle, "writing-im-msg",
- purple_marshal_BOOLEAN__POINTER_POINTER, G_TYPE_BOOLEAN, 2,
- PURPLE_TYPE_IM_CONVERSATION, PURPLE_TYPE_MESSAGE);
-
- purple_signal_register(handle, "wrote-im-msg",
- purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2,
- PURPLE_TYPE_IM_CONVERSATION, PURPLE_TYPE_MESSAGE);
-
- purple_signal_register(handle, "sending-im-msg",
- purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE,
- 2, PURPLE_TYPE_ACCOUNT, PURPLE_TYPE_MESSAGE);
-
- purple_signal_register(handle, "sent-im-msg",
- purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE,
- 2, PURPLE_TYPE_ACCOUNT, PURPLE_TYPE_MESSAGE);
-
- purple_signal_register(handle, "receiving-im-msg",
- purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER,
- G_TYPE_BOOLEAN, 5, PURPLE_TYPE_ACCOUNT,
- G_TYPE_POINTER, /* pointer to a string */
- G_TYPE_POINTER, /* pointer to a string */
- PURPLE_TYPE_IM_CONVERSATION,
- G_TYPE_POINTER); /* pointer to a string */
-
- purple_signal_register(handle, "received-im-msg",
- purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT,
- G_TYPE_NONE, 5, PURPLE_TYPE_ACCOUNT, G_TYPE_STRING,
- G_TYPE_STRING, PURPLE_TYPE_IM_CONVERSATION, G_TYPE_UINT);
-
- purple_signal_register(handle, "blocked-im-msg",
- purple_marshal_VOID__POINTER_POINTER_POINTER_UINT_UINT,
- G_TYPE_NONE, 5, PURPLE_TYPE_ACCOUNT, G_TYPE_STRING,
- G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT);
-
purple_signal_register(handle, "conversation-created",
purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
PURPLE_TYPE_CONVERSATION);
@@ -105,18 +70,6 @@
purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
PURPLE_TYPE_CONVERSATION);
- purple_signal_register(handle, "buddy-typing",
- purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2,
- PURPLE_TYPE_ACCOUNT, G_TYPE_STRING);
-
- purple_signal_register(handle, "buddy-typed",
- purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2,
- PURPLE_TYPE_ACCOUNT, G_TYPE_STRING);
-
- purple_signal_register(handle, "buddy-typing-stopped",
- purple_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2,
- PURPLE_TYPE_ACCOUNT, G_TYPE_STRING);
-
purple_signal_register(handle, "cleared-message-history",
purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
PURPLE_TYPE_CONVERSATION);
--- a/libpurple/meson.build Sat Apr 13 21:08:59 2024 -0500
+++ b/libpurple/meson.build Sat Apr 13 21:21:59 2024 -0500
@@ -55,7 +55,6 @@
'purplehistoryadapter.c',
'purplehistorymanager.c',
'purpleidlemanager.c',
- 'purpleimconversation.c',
'purplekeyvaluepair.c',
'purplemarkup.c',
'purplemenu.c',
@@ -76,7 +75,6 @@
'purpleprotocolcontacts.c',
'purpleprotocolconversation.c',
'purpleprotocolfiletransfer.c',
- 'purpleprotocolim.c',
'purpleprotocolmanager.c',
'purpleprotocolmedia.c',
'purpleprotocolroomlist.c',
@@ -168,7 +166,6 @@
'purplehistoryadapter.h',
'purplehistorymanager.h',
'purpleidlemanager.h',
- 'purpleimconversation.h',
'purpleattachment.h',
'purplekeyvaluepair.h',
'purplemarkup.h',
@@ -190,7 +187,6 @@
'purpleprotocolcontacts.h',
'purpleprotocolconversation.h',
'purpleprotocolfiletransfer.h',
- 'purpleprotocolim.h',
'purpleprotocolmedia.h',
'purpleprotocolmanager.h',
'purpleprotocolroomlist.h',
@@ -292,7 +288,6 @@
'purplecontactinfo.h',
'purpleconversation.h',
'purplefiletransfer.h',
- 'purpleimconversation.h',
'purplemessage.h',
'purplenotification.h',
'purpleplugininfo.h',
--- a/libpurple/purpleconversation.c Sat Apr 13 21:08:59 2024 -0500
+++ b/libpurple/purpleconversation.c Sat Apr 13 21:21:59 2024 -0500
@@ -223,7 +223,6 @@
gchar *displayed = NULL;
const gchar *sent, *me;
gint err = 0;
- gpointer handle = NULL;
if(*message == '\0') {
return;
@@ -261,8 +260,6 @@
msgflags |= PURPLE_MESSAGE_SEND;
- handle = purple_conversations_get_handle();
-
if(PURPLE_IS_PROTOCOL_CONVERSATION(protocol)) {
PurpleMessage *msg = NULL;
PurpleProtocolConversation *protocol_conversation = NULL;
@@ -276,28 +273,6 @@
msg);
g_clear_pointer(&displayed, g_free);
- } else if(PURPLE_IS_IM_CONVERSATION(conv)) {
- const gchar *name = NULL;
- PurpleMessage *msg = NULL;
-
- name = purple_conversation_get_name(conv);
- msg = purple_message_new_outgoing(me, name, sent, msgflags);
-
- purple_signal_emit(handle, "sending-im-msg", account, msg);
-
- if(!purple_message_is_empty(msg)) {
- err = purple_serv_send_im(gc, msg);
-
- if((err > 0) && (displayed != NULL)) {
- /* revert the contents in case sending-im-msg changed it */
- purple_message_set_contents(msg, displayed);
- purple_conversation_write_message(conv, msg);
- }
-
- purple_signal_emit(handle, "sent-im-msg", account, msg);
- }
-
- g_object_unref(msg);
}
if(err < 0) {
@@ -1175,26 +1150,13 @@
void
purple_conversation_autoset_title(PurpleConversation *conv) {
- PurpleAccount *account;
- PurpleBuddy *b;
- const gchar *text = NULL, *name;
+ const gchar *name = NULL;
g_return_if_fail(PURPLE_IS_CONVERSATION(conv));
- account = purple_conversation_get_account(conv);
name = purple_conversation_get_name(conv);
- if(PURPLE_IS_IM_CONVERSATION(conv)) {
- if(account && ((b = purple_blist_find_buddy(account, name)) != NULL)) {
- text = purple_buddy_get_contact_alias(b);
- }
- }
-
- if(text == NULL) {
- text = name;
- }
-
- purple_conversation_set_title(conv, text);
+ purple_conversation_set_title(conv, name);
}
void
@@ -1228,68 +1190,17 @@
_purple_conversation_write_common(PurpleConversation *conv,
PurpleMessage *pmsg)
{
- PurpleProtocol *protocol = NULL;
PurpleConversationPrivate *priv = NULL;
- PurpleAccount *account;
- PurpleBuddy *b;
- gint plugin_return;
- /* int logging_font_options = 0; */
g_return_if_fail(PURPLE_IS_CONVERSATION(conv));
g_return_if_fail(pmsg != NULL);
priv = purple_conversation_get_instance_private(conv);
- account = purple_conversation_get_account(conv);
-
- if(PURPLE_IS_IM_CONVERSATION(conv)) {
- PurpleConversationManager *manager = NULL;
-
- manager = purple_conversation_manager_get_default();
- if(!purple_conversation_manager_is_registered(manager, conv)) {
- return;
- }
- }
-
- plugin_return = GPOINTER_TO_INT(purple_signal_emit_return_1(
- purple_conversations_get_handle(),
- "writing-im-msg",
- conv, pmsg));
-
if(purple_message_is_empty(pmsg)) {
return;
}
- if(plugin_return) {
- return;
- }
-
- if(account != NULL) {
- protocol = purple_account_get_protocol(account);
-
- if(PURPLE_IS_IM_CONVERSATION(conv) ||
- !(protocol != NULL && purple_protocol_get_options(protocol) & OPT_PROTO_UNIQUE_CHATNAME))
- {
- if(purple_message_get_flags(pmsg) & PURPLE_MESSAGE_SEND) {
- PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
- const gchar *alias;
-
- alias = purple_contact_info_get_name_for_display(info);
-
- purple_message_set_author_alias(pmsg, alias);
- } else if (purple_message_get_flags(pmsg) & PURPLE_MESSAGE_RECV) {
- /* TODO: PurpleDude - folks not on the buddy list */
- b = purple_blist_find_buddy(account,
- purple_message_get_author(pmsg));
-
- if(b != NULL) {
- purple_message_set_author_alias(pmsg,
- purple_buddy_get_contact_alias(b));
- }
- }
- }
- }
-
if(!(purple_message_get_flags(pmsg) & PURPLE_MESSAGE_NO_LOG))
{
GError *error = NULL;
@@ -1307,10 +1218,6 @@
}
g_list_store_append(priv->messages, pmsg);
-
- purple_signal_emit(purple_conversations_get_handle(),
- "wrote-im-msg",
- conv, pmsg);
}
void
--- a/libpurple/purpleconversationmanager.c Sat Apr 13 21:08:59 2024 -0500
+++ b/libpurple/purpleconversationmanager.c Sat Apr 13 21:21:59 2024 -0500
@@ -23,7 +23,6 @@
#include "purpleconversationmanager.h"
#include "purplecontact.h"
-#include "purpleimconversation.h"
#include "purpleprivate.h"
enum {
@@ -51,13 +50,6 @@
* Helpers
*****************************************************************************/
static gboolean
-purple_conversation_is_im(PurpleConversation *conversation,
- G_GNUC_UNUSED gpointer userdata)
-{
- return PURPLE_IS_IM_CONVERSATION(conversation);
-}
-
-static gboolean
purple_conversation_has_id(PurpleConversation *conversation, gpointer data) {
const char *needle = data;
const char *haystack = NULL;
@@ -349,19 +341,6 @@
}
PurpleConversation *
-purple_conversation_manager_find_im(PurpleConversationManager *manager,
- PurpleAccount *account, const gchar *name)
-{
- g_return_val_if_fail(PURPLE_IS_CONVERSATION_MANAGER(manager), NULL);
- g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
- g_return_val_if_fail(name != NULL, NULL);
-
- return purple_conversation_manager_find_internal(manager, account, name,
- purple_conversation_is_im,
- NULL);
-}
-
-PurpleConversation *
purple_conversation_manager_find_dm(PurpleConversationManager *manager,
PurpleContact *contact)
{
--- a/libpurple/purpleconversationmanager.h Sat Apr 13 21:08:59 2024 -0500
+++ b/libpurple/purpleconversationmanager.h Sat Apr 13 21:21:59 2024 -0500
@@ -162,22 +162,6 @@
PurpleConversation *purple_conversation_manager_find(PurpleConversationManager *manager, PurpleAccount *account, const gchar *name);
/**
- * purple_conversation_manager_find_im:
- * @manager: The #PurpleConversationManager instance.
- * @account: The #PurpleAccount instance whose conversation to find.
- * @name: The name of the conversation.
- *
- * Looks for a registered im conversation belonging to @account and named
- * @name.
- *
- * Returns: (transfer none): The #PurpleConversation if found, otherwise %NULL.
- *
- * Since: 3.0
- */
-PURPLE_DEPRECATED_FOR(purple_conversation_manager_find_dm)
-PurpleConversation *purple_conversation_manager_find_im(PurpleConversationManager *manager, PurpleAccount *account, const gchar *name);
-
-/**
* purple_conversation_manager_find_dm:
* @manager: The instance.
* @contact: The contact.
--- a/libpurple/purpleimconversation.c Sat Apr 13 21:08:59 2024 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,356 +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 "purpleimconversation.h"
-
-#include "debug.h"
-#include "conversations.h"
-#include "prefs.h"
-#include "purpleconversationmanager.h"
-#include "purpleenums.h"
-#include "purpleprivate.h"
-#include "purpleprotocolclient.h"
-
-#include "server.h"
-
-struct _PurpleIMConversation {
- PurpleConversation parent;
-
- PurpleIMTypingState typing_state;
- guint typing_timeout;
- time_t type_again;
- guint send_typed_timeout;
-};
-
-enum {
- PROP_0 = 0,
- PROP_TYPING_STATE,
- N_PROPERTIES,
-};
-static GParamSpec *properties[N_PROPERTIES] = {NULL, };
-
-#define SEND_TYPED_TIMEOUT_SECONDS 5
-
-/******************************************************************************
- * Callbacks
- *****************************************************************************/
-static gboolean
-purple_im_conversation_reset_typing_cb(gpointer data)
-{
- PurpleIMConversation *im = PURPLE_IM_CONVERSATION(data);
-
- purple_im_conversation_set_typing_state(im, PURPLE_IM_NOT_TYPING);
- purple_im_conversation_stop_typing_timeout(im);
-
- return FALSE;
-}
-
-static gboolean
-purple_im_conversation_send_typed_cb(gpointer data)
-{
- PurpleIMConversation *im = PURPLE_IM_CONVERSATION(data);
- PurpleConnection *pc = NULL;
- const gchar *name;
-
- g_return_val_if_fail(im != NULL, FALSE);
-
- pc = purple_conversation_get_connection(PURPLE_CONVERSATION(im));
- name = purple_conversation_get_name(PURPLE_CONVERSATION(im));
-
- if(pc != NULL && name != NULL) {
- /* We set this to 1 so that PURPLE_IM_TYPING will be sent if the Purple
- * user types anything else.
- */
- purple_im_conversation_set_type_again(im, 1);
-
- purple_serv_send_typing(pc, name, PURPLE_IM_TYPED);
-
- purple_debug_misc("purple-im-conversation", "typed...");
- }
-
- return FALSE;
-}
-
-/******************************************************************************
- * PurpleConversation Implementation
- *****************************************************************************/
-static void
-im_conversation_write_message(PurpleConversation *conv, PurpleMessage *msg) {
- PurpleIMConversation *im = PURPLE_IM_CONVERSATION(conv);
- gboolean is_recv = FALSE;
-
- g_return_if_fail(im != NULL);
- g_return_if_fail(msg != NULL);
-
- is_recv = (purple_message_get_flags(msg) & PURPLE_MESSAGE_RECV);
-
- if(is_recv) {
- purple_im_conversation_set_typing_state(im, PURPLE_IM_NOT_TYPING);
- }
-
- _purple_conversation_write_common(conv, msg);
-}
-
-/******************************************************************************
- * GObject Implementation
- *****************************************************************************/
-G_DEFINE_TYPE(PurpleIMConversation, purple_im_conversation,
- PURPLE_TYPE_CONVERSATION);
-
-static void
-purple_im_conversation_get_property(GObject *obj, guint param_id, GValue *value,
- GParamSpec *pspec)
-{
- PurpleIMConversation *im = PURPLE_IM_CONVERSATION(obj);
-
- switch (param_id) {
- case PROP_TYPING_STATE:
- g_value_set_enum(value,
- purple_im_conversation_get_typing_state(im));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
- break;
- }
-}
-
-static void
-purple_im_conversation_set_property(GObject *obj, guint param_id,
- const GValue *value, GParamSpec *pspec)
-{
- PurpleIMConversation *im = PURPLE_IM_CONVERSATION(obj);
-
- switch (param_id) {
- case PROP_TYPING_STATE:
- purple_im_conversation_set_typing_state(im,
- g_value_get_enum(value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, pspec);
- break;
- }
-}
-
-static void
-purple_im_conversation_init(G_GNUC_UNUSED PurpleIMConversation *im) {
-}
-
-static void
-purple_im_conversation_finalize(GObject *obj) {
- PurpleIMConversation *im = PURPLE_IM_CONVERSATION(obj);
- PurpleConnection *pc = purple_conversation_get_connection(PURPLE_CONVERSATION(im));
- PurpleProtocol *protocol = NULL;
- const gchar *name = purple_conversation_get_name(PURPLE_CONVERSATION(im));
-
- if(pc != NULL) {
- /* Still connected */
- protocol = purple_connection_get_protocol(pc);
-
- if(purple_prefs_get_bool("/purple/conversations/im/send_typing")) {
- purple_serv_send_typing(pc, name, PURPLE_IM_NOT_TYPING);
- }
-
- if(PURPLE_IS_PROTOCOL_CLIENT(protocol)) {
- purple_protocol_client_convo_closed(PURPLE_PROTOCOL_CLIENT(protocol),
- pc, name);
- }
- }
-
- purple_im_conversation_stop_typing_timeout(im);
- purple_im_conversation_stop_send_typed_timeout(im);
-
- G_OBJECT_CLASS(purple_im_conversation_parent_class)->finalize(obj);
-}
-
-static void
-purple_im_conversation_class_init(PurpleIMConversationClass *klass) {
- GObjectClass *obj_class = G_OBJECT_CLASS(klass);
- PurpleConversationClass *conv_class = PURPLE_CONVERSATION_CLASS(klass);
-
- obj_class->get_property = purple_im_conversation_get_property;
- obj_class->set_property = purple_im_conversation_set_property;
- obj_class->finalize = purple_im_conversation_finalize;
-
- conv_class->write_message = im_conversation_write_message;
-
- /**
- * PurpleIMConversation:typing-state:
- *
- * The typing state of the remote user.
- *
- * Since: 3.0
- */
- properties[PROP_TYPING_STATE] = g_param_spec_enum(
- "typing-state", "Typing state",
- "Status of the user's typing of a message.",
- PURPLE_TYPE_IM_TYPING_STATE, PURPLE_IM_NOT_TYPING,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- g_object_class_install_properties(obj_class, N_PROPERTIES, properties);
-}
-
-/******************************************************************************
- * Public API
- *****************************************************************************/
-PurpleConversation *
-purple_im_conversation_new(PurpleAccount *account, const char *name)
-{
- PurpleConversation *im = NULL;
- PurpleConversationManager *manager = NULL;
-
- g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL);
- g_return_val_if_fail(name != NULL, NULL);
-
- /* Check if this conversation already exists. */
- manager = purple_conversation_manager_get_default();
- im = purple_conversation_manager_find_im(manager, account, name);
- if(PURPLE_IS_IM_CONVERSATION(im)) {
- return g_object_ref(im);
- }
-
- im = g_object_new(PURPLE_TYPE_IM_CONVERSATION,
- "account", account,
- "name", name,
- "title", name,
- NULL);
-
- return im;
-}
-
-void
-purple_im_conversation_set_typing_state(PurpleIMConversation *im,
- PurpleIMTypingState state)
-{
- PurpleAccount *account = NULL;
- const gchar *name = NULL;
-
- g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
-
- name = purple_conversation_get_name(PURPLE_CONVERSATION(im));
- account = purple_conversation_get_account(PURPLE_CONVERSATION(im));
-
- if(im->typing_state != state) {
- im->typing_state = state;
-
- g_object_notify_by_pspec(G_OBJECT(im), properties[PROP_TYPING_STATE]);
-
- switch (state) {
- case PURPLE_IM_TYPING:
- purple_signal_emit(purple_conversations_get_handle(),
- "buddy-typing", account, name);
- break;
- case PURPLE_IM_TYPED:
- purple_signal_emit(purple_conversations_get_handle(),
- "buddy-typed", account, name);
- break;
- case PURPLE_IM_NOT_TYPING:
- purple_signal_emit(purple_conversations_get_handle(),
- "buddy-typing-stopped", account, name);
- break;
- }
-
- purple_im_conversation_update_typing(im);
- }
-}
-
-PurpleIMTypingState
-purple_im_conversation_get_typing_state(PurpleIMConversation *im) {
- g_return_val_if_fail(PURPLE_IS_IM_CONVERSATION(im), 0);
-
- return im->typing_state;
-}
-
-void
-purple_im_conversation_start_typing_timeout(PurpleIMConversation *im,
- gint timeout)
-{
- g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
-
- purple_im_conversation_stop_typing_timeout(im);
- im->typing_timeout =
- g_timeout_add_seconds(timeout, purple_im_conversation_reset_typing_cb,
- im);
-}
-
-void
-purple_im_conversation_stop_typing_timeout(PurpleIMConversation *im) {
- g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
-
- g_clear_handle_id(&im->typing_timeout, g_source_remove);
-}
-
-guint
-purple_im_conversation_get_typing_timeout(PurpleIMConversation *im) {
- g_return_val_if_fail(PURPLE_IS_IM_CONVERSATION(im), 0);
-
- return im->typing_timeout;
-}
-
-void
-purple_im_conversation_set_type_again(PurpleIMConversation *im, guint val) {
- g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
-
- if(val == 0) {
- im->type_again = 0;
- } else {
- im->type_again = time(NULL) + val;
- }
-}
-
-time_t
-purple_im_conversation_get_type_again(PurpleIMConversation *im) {
- g_return_val_if_fail(PURPLE_IS_IM_CONVERSATION(im), 0);
-
- return im->type_again;
-}
-
-void
-purple_im_conversation_start_send_typed_timeout(PurpleIMConversation *im) {
- g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
-
- purple_im_conversation_stop_send_typed_timeout(im);
- im->send_typed_timeout =
- g_timeout_add_seconds(SEND_TYPED_TIMEOUT_SECONDS,
- purple_im_conversation_send_typed_cb, im);
-}
-
-void
-purple_im_conversation_stop_send_typed_timeout(PurpleIMConversation *im) {
- g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
-
- g_clear_handle_id(&im->typing_timeout, g_source_remove);
-}
-
-guint
-purple_im_conversation_get_send_typed_timeout(PurpleIMConversation *im) {
- g_return_val_if_fail(PURPLE_IS_IM_CONVERSATION(im), 0);
-
- return im->send_typed_timeout;
-}
-
-void
-purple_im_conversation_update_typing(PurpleIMConversation *im) {
- g_return_if_fail(PURPLE_IS_IM_CONVERSATION(im));
-
- purple_conversation_update(PURPLE_CONVERSATION(im),
- PURPLE_CONVERSATION_UPDATE_TYPING);
-}
--- a/libpurple/purpleimconversation.h Sat Apr 13 21:08:59 2024 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,249 +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_IM_CONVERSATION_H
-#define PURPLE_IM_CONVERSATION_H
-
-#include <glib.h>
-#include <glib-object.h>
-
-/**
- * PurpleIMTypingState:
- * @PURPLE_IM_NOT_TYPING: Not typing.
- * @PURPLE_IM_TYPING: Currently typing.
- * @PURPLE_IM_TYPED: Stopped typing momentarily.
- *
- * The typing state of a user.
- */
-typedef enum
-{
- PURPLE_IM_NOT_TYPING = 0,
- PURPLE_IM_TYPING,
- PURPLE_IM_TYPED
-
-} PurpleIMTypingState;
-
-#define PURPLE_TYPE_IM_CONVERSATION (purple_im_conversation_get_type())
-#define PURPLE_IM_CONVERSATION(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PURPLE_TYPE_IM_CONVERSATION, PurpleIMConversation))
-#define PURPLE_IM_CONVERSATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PURPLE_TYPE_IM_CONVERSATION, PurpleIMConversationClass))
-#define PURPLE_IS_IM_CONVERSATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PURPLE_TYPE_IM_CONVERSATION))
-#define PURPLE_IS_IM_CONVERSATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_IM_CONVERSATION))
-#define PURPLE_IM_CONVERSATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_IM_CONVERSATION, PurpleIMConversationClass))
-
-typedef struct _PurpleIMConversation PurpleIMConversation;
-typedef struct _PurpleIMConversationClass PurpleIMConversationClass;
-
-#include "purpleaccount.h"
-#include "purpleconversation.h"
-#include "purpleversion.h"
-
-/**
- * PurpleIMConversation:
- *
- * Structure representing an IM conversation instance.
- */
-
-/**
- * PurpleIMConversationClass:
- *
- * Base class for all #PurpleIMConversation's
- */
-struct _PurpleIMConversationClass {
- PurpleConversationClass parent_class;
-
- /*< private >*/
- gpointer _purple_reserved[4];
-};
-
-G_BEGIN_DECLS
-
-/**
- * purple_im_conversation_get_type:
- *
- * Returns: The #GType for the IMConversation object.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-GType purple_im_conversation_get_type(void);
-
-/**
- * purple_im_conversation_new:
- * @account: The account opening the conversation window on the purple user's
- * end.
- * @name: Name of the buddy.
- *
- * Creates a new IM conversation.
- *
- * Returns: The new conversation.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-PurpleConversation *purple_im_conversation_new(PurpleAccount *account, const gchar *name);
-
-/**
- * purple_im_conversation_set_typing_state:
- * @im: The IM.
- * @state: The typing state.
- *
- * Sets the IM's typing state.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-void purple_im_conversation_set_typing_state(PurpleIMConversation *im, PurpleIMTypingState state);
-
-/**
- * purple_im_conversation_get_typing_state:
- * @im: The IM.
- *
- * Returns the IM's typing state.
- *
- * Returns: The IM's typing state.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-PurpleIMTypingState purple_im_conversation_get_typing_state(PurpleIMConversation *im);
-
-/**
- * purple_im_conversation_start_typing_timeout:
- * @im: The IM.
- * @timeout: How long in seconds to wait before setting the typing state to
- * PURPLE_IM_NOT_TYPING.
- *
- * Starts the IM's typing timeout.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-void purple_im_conversation_start_typing_timeout(PurpleIMConversation *im, int timeout);
-
-/**
- * purple_im_conversation_stop_typing_timeout:
- * @im: The IM.
- *
- * Stops the IM's typing timeout.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-void purple_im_conversation_stop_typing_timeout(PurpleIMConversation *im);
-
-/**
- * purple_im_conversation_get_typing_timeout:
- * @im: The IM.
- *
- * Returns the IM's typing timeout.
- *
- * Returns: The timeout.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-guint purple_im_conversation_get_typing_timeout(PurpleIMConversation *im);
-
-/**
- * purple_im_conversation_set_type_again:
- * @im: The IM.
- * @val: The number of seconds to wait before allowing another #PURPLE_IM_TYPING
- * message to be sent to the user. Or 0 to not send another
- * #PURPLE_IM_TYPING message.
- *
- * Sets the quiet-time when no #PURPLE_IM_TYPING messages will be sent.
- * Few protocols need this (maybe only MSN). If the user is still
- * typing after this quiet-period, then another #PURPLE_IM_TYPING message
- * will be sent.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-void purple_im_conversation_set_type_again(PurpleIMConversation *im, guint val);
-
-/**
- * purple_im_conversation_get_type_again:
- * @im: The IM.
- *
- * Returns the time after which another PURPLE_IM_TYPING message should be sent.
- *
- * Returns: The time in seconds since the epoch. Or 0 if no additional
- * PURPLE_IM_TYPING message should be sent.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-time_t purple_im_conversation_get_type_again(PurpleIMConversation *im);
-
-/**
- * purple_im_conversation_start_send_typed_timeout:
- * @im: The IM.
- *
- * Starts the IM's type again timeout.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-void purple_im_conversation_start_send_typed_timeout(PurpleIMConversation *im);
-
-/**
- * purple_im_conversation_stop_send_typed_timeout:
- * @im: The IM.
- *
- * Stops the IM's type again timeout.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-void purple_im_conversation_stop_send_typed_timeout(PurpleIMConversation *im);
-
-/**
- * purple_im_conversation_get_send_typed_timeout:
- * @im: The IM.
- *
- * Returns the IM's type again timeout interval.
- *
- * Returns: The type again timeout interval.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-guint purple_im_conversation_get_send_typed_timeout(PurpleIMConversation *im);
-
-/**
- * purple_im_conversation_update_typing:
- * @im: The IM.
- *
- * Updates the visual typing notification for an IM conversation.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-void purple_im_conversation_update_typing(PurpleIMConversation *im);
-
-G_END_DECLS
-
-#endif /* PURPLE_IM_CONVERSATION_H */
--- a/libpurple/purpleprotocolim.c Sat Apr 13 21:08:59 2024 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +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 "purpleprotocolim.h"
-
-/******************************************************************************
- * GObject Implementation
- *****************************************************************************/
-G_DEFINE_INTERFACE(PurpleProtocolIM, purple_protocol_im, PURPLE_TYPE_PROTOCOL)
-
-static void
-purple_protocol_im_default_init(G_GNUC_UNUSED PurpleProtocolIMInterface *iface)
-{
-}
-
-/******************************************************************************
- * Public API
- *****************************************************************************/
-gint
-purple_protocol_im_send(PurpleProtocolIM *im, PurpleConnection *gc,
- PurpleConversation *conversation, PurpleMessage *msg)
-{
- PurpleProtocolIMInterface *iface = NULL;
-
- g_return_val_if_fail(PURPLE_IS_PROTOCOL_IM(im), -1);
-
- iface = PURPLE_PROTOCOL_IM_GET_IFACE(im);
- if(iface && iface->send) {
- return iface->send(im, gc, conversation, msg);
- }
-
- return -1;
-}
-
-guint
-purple_protocol_im_send_typing(PurpleProtocolIM *im, PurpleConnection *gc,
- const gchar *name, PurpleIMTypingState state)
-{
- PurpleProtocolIMInterface *iface = NULL;
-
- g_return_val_if_fail(PURPLE_IS_PROTOCOL_IM(im), 0);
-
- iface = PURPLE_PROTOCOL_IM_GET_IFACE(im);
- if(iface && iface->send_typing) {
- return iface->send_typing(im, gc, name, state);
- }
-
- return 0;
-}
-
--- a/libpurple/purpleprotocolim.h Sat Apr 13 21:08:59 2024 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +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_PROTOCOL_IM_H
-#define PURPLE_PROTOCOL_IM_H
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include "purpleprotocol.h"
-#include "purpleversion.h"
-
-#define PURPLE_TYPE_PROTOCOL_IM (purple_protocol_im_get_type())
-
-/**
- * PurpleProtocolIM:
- *
- * #PurpleProtocolIM describes the API that protocols need to implement for
- * handling one on one conversations.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-G_DECLARE_INTERFACE(PurpleProtocolIM, purple_protocol_im, PURPLE, PROTOCOL_IM,
- PurpleProtocol)
-
-#include "connection.h"
-#include "purpleconversation.h"
-#include "purpleimconversation.h"
-
-struct _PurpleProtocolIMInterface {
- /*< private >*/
- GTypeInterface parent;
-
- /*< public >*/
- gint (*send)(PurpleProtocolIM *im, PurpleConnection *connection,
- PurpleConversation *conversation, PurpleMessage *msg);
-
- guint (*send_typing)(PurpleProtocolIM *im, PurpleConnection *connection,
- const gchar *name, PurpleIMTypingState state);
-
- /*< private >*/
- gpointer reserved[4];
-};
-
-G_BEGIN_DECLS
-
-/**
- * purple_protocol_im_send:
- * @im: The #PurpleProtocolIM instance.
- * @connection: The #PurpleConnection to use.
- * @conversation: The [class@Conversation] this message is for.
- * @msg: The #PurpleMessage to send.
- *
- * Sends @msg out over @connection.
- *
- * Returns: >= 0 on success, or < 0 on error. If 0 is returned the message
- * should not be output locally.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-gint purple_protocol_im_send(PurpleProtocolIM *im,
- PurpleConnection *connection,
- PurpleConversation *conversation,
- PurpleMessage *msg);
-
-/**
- * purple_protocol_im_send_typing:
- * @im: The #PurpleProtocolIM instance.
- * @connection: The #PurpleConversation to use.
- * @name: The name of the user to send a typing notification to.
- * @state: The #PurpleIMTypingState Value.
- *
- * If this protocol requires the #PURPLE_IM_TYPING message to be sent
- * repeatedly to signify that the user is still typing, then the protocol
- * should return the number of seconds to wait before sending a subsequent
- * notification. Otherwise the protocol should return 0.
- *
- * Returns: A quiet-period, specified in seconds, where Purple will not send
- * any additional typing notification messages. Most protocols should
- * return 0, which means that no additional #PURPLE_IM_TYPING messages
- * need to be sent. If this is 5, for example, then Purple will wait
- * five seconds, and if the Purple user is still typing then Purple
- * will send another #PURPLE_IM_TYPING message.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-guint purple_protocol_im_send_typing(PurpleProtocolIM *im,
- PurpleConnection *connection,
- const gchar *name,
- PurpleIMTypingState state);
-
-G_END_DECLS
-
-#endif /* PURPLE_PROTOCOL_IM_H */
-
--- a/libpurple/server.c Sat Apr 13 21:08:59 2024 -0500
+++ b/libpurple/server.c Sat Apr 13 21:21:59 2024 -0500
@@ -34,65 +34,12 @@
#include "purpleprivate.h"
#include "purpleprotocol.h"
#include "purpleprotocolchat.h"
-#include "purpleprotocolim.h"
#include "purpleprotocolserver.h"
#include "request.h"
#include "signals.h"
#include "server.h"
#include "util.h"
-unsigned int
-purple_serv_send_typing(PurpleConnection *gc, const char *name, PurpleIMTypingState state)
-{
- if(gc) {
- PurpleProtocol *protocol = purple_connection_get_protocol(gc);
- PurpleProtocolIM *im = PURPLE_PROTOCOL_IM(protocol);
-
- return purple_protocol_im_send_typing(im, gc, name, state);
- }
-
- return 0;
-}
-
-int purple_serv_send_im(PurpleConnection *gc, PurpleMessage *msg)
-{
- PurpleAccount *account = NULL;
- PurpleConversation *im = NULL;
- PurpleConversationManager *manager = NULL;
- PurpleProtocol *protocol = NULL;
- int val = -EINVAL;
- const gchar *recipient;
-
- g_return_val_if_fail(gc != NULL, val);
- g_return_val_if_fail(msg != NULL, val);
-
- protocol = purple_connection_get_protocol(gc);
-
- g_return_val_if_fail(protocol != NULL, val);
- g_return_val_if_fail(PURPLE_IS_PROTOCOL_IM(protocol), val);
-
- account = purple_connection_get_account(gc);
- recipient = purple_message_get_recipient(msg);
-
- manager = purple_conversation_manager_get_default();
- im = purple_conversation_manager_find_im(manager, account, recipient);
-
- /* we probably shouldn't be here if the protocol doesn't know how to send
- * im's... but there was a similar check here before so I just reproduced
- * it until we can reevaluate this function.
- */
- if(PURPLE_IS_PROTOCOL_IM(protocol)) {
- PurpleProtocolIM *pim = PURPLE_PROTOCOL_IM(protocol);
-
- val = purple_protocol_im_send(pim, gc, im, msg);
- }
-
- if(im && purple_im_conversation_get_send_typed_timeout(PURPLE_IM_CONVERSATION(im)))
- purple_im_conversation_stop_send_typed_timeout(PURPLE_IM_CONVERSATION(im));
-
- return val;
-}
-
/*
* Move a buddy from one group to another on server.
*
@@ -131,84 +78,3 @@
purple_protocol_chat_join(PURPLE_PROTOCOL_CHAT(protocol), gc, data);
}
}
-
-/*
- * woo. i'm actually going to comment this function. isn't that fun. make
- * sure to follow along, kids
- */
-void purple_serv_got_im(PurpleConnection *gc, const char *who, const char *msg,
- PurpleMessageFlags flags, time_t mtime)
-{
- PurpleAccount *account;
- PurpleConversation *im;
- PurpleConversationManager *manager;
- char *message, *name;
- char *angel, *buffy;
- int plugin_return;
- PurpleMessage *pmsg;
-
- g_return_if_fail(msg != NULL);
-
- account = purple_connection_get_account(gc);
-
- if (mtime < 0) {
- purple_debug_error("server",
- "purple_serv_got_im ignoring negative timestamp\n");
- /* TODO: Would be more appropriate to use a value that indicates
- that the timestamp is unknown, and surface that in the UI. */
- mtime = time(NULL);
- }
-
- /*
- * XXX: Should we be setting this here, or relying on protocols to set it?
- */
- flags |= PURPLE_MESSAGE_RECV;
-
- manager = purple_conversation_manager_get_default();
-
- /*
- * We should update the conversation window buttons and menu,
- * if it exists.
- */
- im = purple_conversation_manager_find_im(manager, account, who);
-
- /*
- * Make copies of the message and the sender in case plugins want
- * to free these strings and replace them with a modified version.
- */
- buffy = g_strdup(msg);
- angel = g_strdup(who);
-
- plugin_return = GPOINTER_TO_INT(
- purple_signal_emit_return_1(purple_conversations_get_handle(),
- "receiving-im-msg", account,
- &angel, &buffy, im, &flags));
-
- if (!buffy || !angel || plugin_return) {
- g_free(buffy);
- g_free(angel);
- return;
- }
-
- name = angel;
- message = buffy;
-
- purple_signal_emit(purple_conversations_get_handle(), "received-im-msg",
- account, name, message, im, flags);
-
- /* search for conversation again in case it was created by received-im-msg handler */
- if(im == NULL) {
- im = purple_conversation_manager_find_im(manager, account, name);
- }
-
- if(im == NULL) {
- im = purple_im_conversation_new(account, name);
- }
-
- pmsg = purple_message_new_incoming(name, message, flags, mtime);
- purple_conversation_write_message(im, pmsg);
- g_free(message);
- g_object_unref(pmsg);
-
- g_free(name);
-}
--- a/libpurple/server.h Sat Apr 13 21:08:59 2024 -0500
+++ b/libpurple/server.h Sat Apr 13 21:21:59 2024 -0500
@@ -29,35 +29,12 @@
#include "buddy.h"
#include "group.h"
-#include "purpleimconversation.h"
#include "purplemessage.h"
#include "purpleversion.h"
G_BEGIN_DECLS
/**
- * purple_serv_send_typing:
- * @gc: The connection over which to send the typing notification.
- * @name: The user to send the typing notification to.
- * @state: One of PURPLE_IM_TYPING, PURPLE_IM_TYPED, or PURPLE_IM_NOT_TYPING.
- *
- * Send a typing message to a given user over a given connection.
- *
- * Returns: A quiet-period, specified in seconds, where Purple will not
- * send any additional typing notification messages. Most
- * protocols should return 0, which means that no additional
- * PURPLE_IM_TYPING messages need to be sent. If this is 5, for
- * example, then Purple will wait five seconds, and if the Purple
- * user is still typing then Purple will send another PURPLE_IM_TYPING
- * message.
- *
- * Since: 3.0
- */
-/* TODO Could probably move this into the conversation API. */
-PURPLE_AVAILABLE_IN_3_0
-unsigned int purple_serv_send_typing(PurpleConnection *gc, const char *name, PurpleIMTypingState state);
-
-/**
* purple_serv_move_buddy:
* @buddy: The Buddy.
* @orig: Original group.
@@ -70,41 +47,11 @@
PURPLE_AVAILABLE_IN_3_0
void purple_serv_move_buddy(PurpleBuddy *buddy, PurpleGroup *orig, PurpleGroup *dest);
-/**
- * purple_serv_send_im:
- * @gc: The connection over which to send the typing notification.
- * @msg: The message.
- *
- * Sends the message to the user through the required protocol.
- *
- * Returns: The error value returned from the protocol interface function.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-int purple_serv_send_im(PurpleConnection *gc, PurpleMessage *msg);
-
/******************************************************************************
* Server Interface
*****************************************************************************/
/**
- * purple_serv_got_im:
- * @gc: The connection on which the typing message was received.
- * @who: The username of the buddy that sent the message.
- * @msg: The actual message received.
- * @flags: The flags applicable to this message.
- * @mtime: The timestamp of the message.
- *
- * This function is called by the protocol when it receives an IM message.
- *
- * Since: 3.0
- */
-PURPLE_AVAILABLE_IN_3_0
-void purple_serv_got_im(PurpleConnection *gc, const char *who, const char *msg,
- PurpleMessageFlags flags, time_t mtime);
-
-/**
* purple_serv_join_chat:
* @gc: The #PurpleConnection
* @data: The hash function should be g_str_hash() and the equal
--- a/libpurple/tests/test_history_adapter.c Sat Apr 13 21:08:59 2024 -0500
+++ b/libpurple/tests/test_history_adapter.c Sat Apr 13 21:21:59 2024 -0500
@@ -245,9 +245,10 @@
message = g_object_new(PURPLE_TYPE_MESSAGE, NULL);
account = purple_account_new("test", "test");
- conversation = g_object_new(PURPLE_TYPE_IM_CONVERSATION,
+ conversation = g_object_new(PURPLE_TYPE_CONVERSATION,
"account", account,
"name", "pidgy",
+ "type", PURPLE_CONVERSATION_TYPE_DM,
NULL);
result = purple_history_adapter_write(adapter, conversation, message,
&error);
--- a/libpurple/tests/test_history_manager.c Sat Apr 13 21:08:59 2024 -0500
+++ b/libpurple/tests/test_history_manager.c Sat Apr 13 21:21:59 2024 -0500
@@ -325,9 +325,10 @@
message = g_object_new(PURPLE_TYPE_MESSAGE, NULL);
account = purple_account_new("test", "test");
- conversation = g_object_new(PURPLE_TYPE_IM_CONVERSATION,
+ conversation = g_object_new(PURPLE_TYPE_CONVERSATION,
"account", account,
"name", "pidgy",
+ "type", PURPLE_CONVERSATION_TYPE_DM,
NULL);
result = purple_history_manager_write(manager, conversation, message,
@@ -456,9 +457,10 @@
message = g_object_new(PURPLE_TYPE_MESSAGE, NULL);
account = purple_account_new("test", "test");
- conversation = g_object_new(PURPLE_TYPE_IM_CONVERSATION,
+ conversation = g_object_new(PURPLE_TYPE_CONVERSATION,
"account", account,
"name", "pidgy",
+ "type", PURPLE_CONVERSATION_TYPE_DM,
NULL);
result = purple_history_manager_write(manager, conversation, message,
&error);
--- a/po/POTFILES.in Sat Apr 13 21:08:59 2024 -0500
+++ b/po/POTFILES.in Sat Apr 13 21:21:59 2024 -0500
@@ -53,7 +53,6 @@
libpurple/purplegio.c
libpurple/purplehistoryadapter.c
libpurple/purplehistorymanager.c
-libpurple/purpleimconversation.c
libpurple/purplekeyvaluepair.c
libpurple/purplemarkup.c
libpurple/purplemessage.c
@@ -67,7 +66,6 @@
libpurple/purpleprotocol.c
libpurple/purpleprotocolchat.c
libpurple/purpleprotocolclient.c
-libpurple/purpleprotocolim.c
libpurple/purpleprotocolmanager.c
libpurple/purpleprotocolmedia.c
libpurple/purpleprotocolroomlist.c