summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Kramlich <grim@reaperworld.com>2022-11-18 00:56:22 -0600
committerGary Kramlich <grim@reaperworld.com>2022-11-18 00:56:22 -0600
commit6b2ccc99e155ab3dba1febddf993d94cd60c6a41 (patch)
tree0ad66cd5f7aaa35a97e43a09464959b4d40eec71
parent2211a7fe3e5b4eb445ae78e7b9d72932e354d460 (diff)
downloadpidgin-6b2ccc99e155ab3dba1febddf993d94cd60c6a41.tar.gz
Inline purple_serv_get_info and purple_serv_set_info
Testing Done: Compiled Reviewed at https://reviews.imfreedom.org/r/2071/
-rw-r--r--ChangeLog.API2
-rw-r--r--finch/gntblist.c15
-rw-r--r--libpurple/account.c11
-rw-r--r--libpurple/protocols/jabber/buddy.c7
-rw-r--r--libpurple/server.c25
-rw-r--r--libpurple/server.h18
-rw-r--r--pidgin/gtkutils.c27
7 files changed, 45 insertions, 60 deletions
diff --git a/ChangeLog.API b/ChangeLog.API
index c2095f9f84..c415f30005 100644
--- a/ChangeLog.API
+++ b/ChangeLog.API
@@ -675,8 +675,10 @@ version 3.0.0 (??/??/????):
* purple_running_osx
* purple_serv_add_deny
* purple_serv_add_permit
+ * purple_serv_get_info
* purple_serv_remove_deny
* purple_serv_remove_permit
+ * purple_serv_set_info
* purple_serv_set_permit_deny
* PurpleSetPublicAliasFailureCallback
* PurpleSetPublicAliasSuccessCallback
diff --git a/finch/gntblist.c b/finch/gntblist.c
index e6b6c0f300..488f34d0e3 100644
--- a/finch/gntblist.c
+++ b/finch/gntblist.c
@@ -1105,13 +1105,24 @@ create_group_menu(GntMenu *menu, PurpleGroup *group)
gpointer finch_retrieve_user_info(PurpleConnection *conn, const char *name)
{
- PurpleNotifyUserInfo *info = purple_notify_user_info_new();
+ PurpleProtocol *protocol = NULL;
+ PurpleNotifyUserInfo *info = NULL;
gpointer uihandle;
+
+ protocol = purple_connection_get_protocol(conn);
+
+ if(!PURPLE_IS_PROTOCOL_SERVER(protocol)) {
+ return;
+ }
+
+ purple_protocol_server_get_info(PURPLE_PROTOCOL_SERVER(protocol), conn,
+ name);
+
+ info = purple_notify_user_info_new();
purple_notify_user_info_add_pair_plaintext(info, _("Information"), _("Retrieving..."));
uihandle = purple_notify_userinfo(conn, name, info, NULL, NULL);
purple_notify_user_info_destroy(info);
- purple_serv_get_info(conn, name);
return uihandle;
}
diff --git a/libpurple/account.c b/libpurple/account.c
index 19470260d6..af99e5c388 100644
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -335,11 +335,16 @@ no_password_cb(gpointer data) {
static void
set_user_info_cb(PurpleAccount *account, const char *user_info)
{
- PurpleConnection *gc;
+ PurpleProtocol *protocol = NULL;
purple_account_set_user_info(account, user_info);
- gc = purple_account_get_connection(account);
- purple_serv_set_info(gc, user_info);
+
+ protocol = purple_account_get_protocol(account);
+ if(PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER, set_info)) {
+ PurpleConnection *connection = purple_account_get_connection(account);
+ purple_protocol_server_set_info(PURPLE_PROTOCOL_SERVER(protocol),
+ connection, user_info);
+ }
}
static void
diff --git a/libpurple/protocols/jabber/buddy.c b/libpurple/protocols/jabber/buddy.c
index dfbb6ebafe..c5ad15df65 100644
--- a/libpurple/protocols/jabber/buddy.c
+++ b/libpurple/protocols/jabber/buddy.c
@@ -559,6 +559,7 @@ jabber_format_info(PurpleConnection *gc, PurpleRequestFields *fields)
{
PurpleXmlNode *vc_node;
PurpleRequestField *field;
+ PurpleProtocol *protocol = NULL;
const char *text;
char *p;
const struct vcard_template *vc_tp;
@@ -594,7 +595,11 @@ jabber_format_info(PurpleConnection *gc, PurpleRequestFields *fields)
purple_xmlnode_free(vc_node);
purple_account_set_user_info(purple_connection_get_account(gc), p);
- purple_serv_set_info(gc, p);
+ protocol = purple_connection_get_protocol(gc);
+ if(PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER, set_info)) {
+ purple_protocol_server_set_info(PURPLE_PROTOCOL_SERVER(protocol),
+ gc, p);
+ }
g_free(p);
}
diff --git a/libpurple/server.c b/libpurple/server.c
index 7d719fcf28..783f6ca55c 100644
--- a/libpurple/server.c
+++ b/libpurple/server.c
@@ -96,31 +96,6 @@ int purple_serv_send_im(PurpleConnection *gc, PurpleMessage *msg)
return val;
}
-void purple_serv_get_info(PurpleConnection *gc, const char *name)
-{
- PurpleProtocol *protocol;
-
- if (gc) {
- protocol = purple_connection_get_protocol(gc);
- purple_protocol_server_get_info(PURPLE_PROTOCOL_SERVER(protocol), gc,
- name);
- }
-}
-
-void purple_serv_set_info(PurpleConnection *gc, const char *info)
-{
- PurpleProtocol *protocol;
-
- if (gc) {
- protocol = purple_connection_get_protocol(gc);
-
- if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, SERVER, set_info)) {
- purple_protocol_server_set_info(PURPLE_PROTOCOL_SERVER(protocol),
- gc, info);
- }
- }
-}
-
/*
* Set buddy's alias on server roster/list
*/
diff --git a/libpurple/server.h b/libpurple/server.h
index 3a03b6360c..78a7be7fad 100644
--- a/libpurple/server.h
+++ b/libpurple/server.h
@@ -76,24 +76,6 @@ void purple_serv_move_buddy(PurpleBuddy *buddy, PurpleGroup *orig, PurpleGroup *
*/
int purple_serv_send_im(PurpleConnection *gc, PurpleMessage *msg);
-/**
- * purple_serv_get_info:
- * @gc: The connection over which to send the typing notification.
- * @name: The name of the buddy we were asking information from.
- *
- * Request user information from the server.
- */
-void purple_serv_get_info(PurpleConnection *gc, const char *name);
-
-/**
- * purple_serv_set_info:
- * @gc: The connection over which to send the typing notification.
- * @info: Information text to be sent to the server.
- *
- * Set user account information on the server.
- */
-void purple_serv_set_info(PurpleConnection *gc, const char *info);
-
/******************************************************************************
* Chat Interface
*****************************************************************************/
diff --git a/pidgin/gtkutils.c b/pidgin/gtkutils.c
index 14e60b6e92..220735420b 100644
--- a/pidgin/gtkutils.c
+++ b/pidgin/gtkutils.c
@@ -139,21 +139,26 @@ aop_option_menu_select_by_data(GtkWidget *optmenu, gpointer data)
}
}
-static void
-show_retrieveing_info(PurpleConnection *conn, const char *name)
-{
- PurpleNotifyUserInfo *info = purple_notify_user_info_new();
- purple_notify_user_info_add_pair_plaintext(info, _("Information"), _("Retrieving..."));
+void
+pidgin_retrieve_user_info(PurpleConnection *conn, const char *name) {
+ PurpleNotifyUserInfo *info = NULL;
+ PurpleProtocol *protocol = NULL;
+
+ protocol = purple_connection_get_protocol(conn);
+ if(!PURPLE_IS_PROTOCOL_SERVER(protocol)) {
+ return;
+ }
+
+ purple_protocol_server_get_info(PURPLE_PROTOCOL_SERVER(protocol), conn,
+ name);
+
+ info = purple_notify_user_info_new();
+ purple_notify_user_info_add_pair_plaintext(info, _("Information"),
+ _("Retrieving..."));
purple_notify_userinfo(conn, name, info, NULL, NULL);
purple_notify_user_info_destroy(info);
}
-void pidgin_retrieve_user_info(PurpleConnection *conn, const char *name)
-{
- show_retrieveing_info(conn, name);
- purple_serv_get_info(conn, name);
-}
-
void pidgin_retrieve_user_info_in_chat(PurpleConnection *conn, const char *name, int chat)
{
char *who = NULL;