Remove PurpleProtocolServer.add_buddies

Mon, 04 Sep 2023 22:13:57 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Mon, 04 Sep 2023 22:13:57 -0500
changeset 42300
baa7adb7a495
parent 42299
2dce52f93848
child 42301
d3930fe5505c

Remove PurpleProtocolServer.add_buddies

Nothing was really using this, so I reworked what was so we could remove it.

Testing Done:
Added an XMPP account via the add buddy dialog and verified the remote side saw the invite.

Reviewed at https://reviews.imfreedom.org/r/2604/

libpurple/account.c file | annotate | diff | comparison | revisions
libpurple/purpleprotocolserver.c file | annotate | diff | comparison | revisions
libpurple/purpleprotocolserver.h file | annotate | diff | comparison | revisions
--- a/libpurple/account.c	Tue Aug 29 02:11:27 2023 -0500
+++ b/libpurple/account.c	Mon Sep 04 22:13:57 2023 -0500
@@ -1826,23 +1826,20 @@
 	PurpleProtocol *protocol = NULL;
 	PurpleConnection *gc = purple_account_get_connection(account);
 
-	if (gc != NULL)
+	if(gc != NULL) {
 		protocol = purple_connection_get_protocol(gc);
+	}
 
-	if (protocol) {
-		GList *groups;
+	if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
+		PurpleProtocolServer *server = PURPLE_PROTOCOL_SERVER(protocol);
 
-		/* Make a list of what group each buddy is in */
-		groups = g_list_copy_deep(buddies,
-		                          (GCopyFunc)(GCallback)purple_buddy_get_group,
-		                          NULL);
+		for(GList *b = buddies; b != NULL; b = b->next) {
+			PurpleBuddy *buddy = b->data;
 
-		if(PURPLE_IS_PROTOCOL_SERVER(protocol)) {
-			purple_protocol_server_add_buddies(PURPLE_PROTOCOL_SERVER(protocol),
-			                                   gc, buddies, groups, message);
+			purple_protocol_server_add_buddy(server, gc, buddy,
+			                                 purple_buddy_get_group(buddy),
+			                                 message);
 		}
-
-		g_list_free(groups);
 	}
 }
 
--- a/libpurple/purpleprotocolserver.c	Tue Aug 29 02:11:27 2023 -0500
+++ b/libpurple/purpleprotocolserver.c	Mon Sep 04 22:13:57 2023 -0500
@@ -138,35 +138,6 @@
 }
 
 void
-purple_protocol_server_add_buddies(PurpleProtocolServer *protocol_server,
-                                   PurpleConnection *connection,
-                                   GList *buddies, GList *groups,
-                                   const gchar *message)
-{
-	PurpleProtocolServerInterface *iface = NULL;
-
-	g_return_if_fail(PURPLE_IS_PROTOCOL_SERVER(protocol_server));
-	g_return_if_fail(PURPLE_IS_CONNECTION(connection));
-	g_return_if_fail(g_list_length(buddies) != g_list_length(groups));
-
-	iface = PURPLE_PROTOCOL_SERVER_GET_IFACE(protocol_server);
-	if(iface != NULL && iface->add_buddies != NULL) {
-		iface->add_buddies(protocol_server, connection, buddies, groups,
-		                   message);
-	} else {
-		while(buddies != NULL && groups != NULL) {
-			purple_protocol_server_add_buddy(protocol_server, connection,
-			                                 PURPLE_BUDDY(buddies->data),
-			                                 PURPLE_GROUP(groups->data),
-			                                 message);
-
-			buddies = g_list_next(buddies);
-			groups = g_list_next(groups);
-		}
-	}
-}
-
-void
 purple_protocol_server_remove_buddy(PurpleProtocolServer *protocol_server,
                                     PurpleConnection *connection,
                                     PurpleBuddy *buddy, PurpleGroup *group)
--- a/libpurple/purpleprotocolserver.h	Tue Aug 29 02:11:27 2023 -0500
+++ b/libpurple/purpleprotocolserver.h	Mon Sep 04 22:13:57 2023 -0500
@@ -98,7 +98,6 @@
 	void (*change_passwd)(PurpleProtocolServer *protocol_server, PurpleConnection *connection, const gchar *old_pass, const gchar *new_pass);
 
 	void (*add_buddy)(PurpleProtocolServer *protocol_server, PurpleConnection *connection, PurpleBuddy *buddy, PurpleGroup *group, const gchar *message);
-	void (*add_buddies)(PurpleProtocolServer *protocol_server, PurpleConnection *connection, GList *buddies, GList *groups, const gchar *message);
 	void (*remove_buddy)(PurpleProtocolServer *protocol_server, PurpleConnection *connection, PurpleBuddy *buddy, PurpleGroup *group);
 	void (*remove_buddies)(PurpleProtocolServer *protocol_server, PurpleConnection *connection, GList *buddies, GList *groups);
 
@@ -202,24 +201,6 @@
 void purple_protocol_server_add_buddy(PurpleProtocolServer *protocol_server, PurpleConnection *connection, PurpleBuddy *buddy, PurpleGroup *group, const gchar *message);
 
 /**
- * purple_protocol_server_add_buddies:
- * @protocol_server: The #PurpleProtocolServer instance.
- * @connection: The #PurpleConnection instance.
- * @buddies: (element-type PurpleBuddy): A #GList of #PurpleBuddy's to add.
- * @groups: (element-type PurpleGroup): A #GList of #PurpleGroup's that
- *          correspond to the @buddies parameter.
- * @message: An optional invite message to send.
- *
- * Similar to purple_protocol_server_add_buddy() but can add multiple buddies
- * at a time. If @protocol_server does not implement this function, this will
- * call purple_protocol_server_add_buddy() for each buddy/group pair in
- * @buddies/@groups.
- *
- * Since: 3.0.0
- */
-void purple_protocol_server_add_buddies(PurpleProtocolServer *protocol_server, PurpleConnection *connection, GList *buddies, GList *groups, const gchar *message);
-
-/**
  * purple_protocol_server_remove_buddy:
  * @protocol_server: The #PurpleProtocolServer instance.
  * @connection: The #PurpleConnection instance.

mercurial