pidgin: 6d187048: Add new functions for adding buddies wit...
qulogic at pidgin.im
qulogic at pidgin.im
Sun Mar 20 20:32:39 EDT 2011
----------------------------------------------------------------------
Revision: 6d1870482332a4133c2beee42c9953f54d57ab61
Parent: 624acee6261639cfd78ac1bfb5a8aaf75715728c
Author: qulogic at pidgin.im
Date: 03/19/11 20:02:55
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/6d1870482332a4133c2beee42c9953f54d57ab61
Changelog:
Add new functions for adding buddies with an invite message. If the
prpl implements this function, then it's preferred over the no-message
version.
Changes against parent 624acee6261639cfd78ac1bfb5a8aaf75715728c
patched ChangeLog.API
patched libpurple/account.c
patched libpurple/account.h
patched libpurple/prpl.h
-------------- next part --------------
============================================================
--- libpurple/prpl.h d9f1df37dc84c6b000e53cd72b6da2311d2d1b34
+++ libpurple/prpl.h eebe4698f961bd279636fb86f19b85cbe40f8097
@@ -333,6 +333,9 @@ struct _PurplePluginProtocolInfo
* already in the specified group. If the protocol supports
* authorization and the user is not already authorized to see the
* status of \a buddy, \a add_buddy should request authorization.
+ *
+ * @deprecated Since 2.8.0, add_buddy_with_invite is preferred.
+ * @see add_buddy_with_invite
*/
void (*add_buddy)(PurpleConnection *, PurpleBuddy *buddy, PurpleGroup *group);
void (*add_buddies)(PurpleConnection *, GList *buddies, GList *groups);
@@ -622,6 +625,21 @@ struct _PurplePluginProtocolInfo
void (*get_public_alias)(PurpleConnection *gc,
PurpleGetPublicAliasSuccessCallback success_cb,
PurpleGetPublicAliasFailureCallback failure_cb);
+
+ /**
+ * Add a buddy to a group on the server.
+ *
+ * This PRPL function may be called in situations in which the buddy is
+ * already in the specified group. If the protocol supports
+ * authorization and the user is not already authorized to see the
+ * status of \a buddy, \a add_buddy should request authorization.
+ *
+ * If authorization is required, then use the supplied invite message.
+ *
+ * @since 2.8.0
+ */
+ void (*add_buddy_with_invite)(PurpleConnection *pc, PurpleBuddy *buddy, PurpleGroup *group, const char *message);
+ void (*add_buddies_with_invite)(PurpleConnection *pc, GList *buddies, GList *groups, const char *message);
};
#define PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl, member) \
============================================================
--- libpurple/account.c ae1bbe60d7f44c53c7d2d37a4136cf40b3e340ee
+++ libpurple/account.c 444095e1f94ee7b6669e00a53beefdc7daf2eb16
@@ -2540,11 +2540,40 @@ purple_account_add_buddy(PurpleAccount *
if (prpl != NULL)
prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
- if (prpl_info != NULL && prpl_info->add_buddy != NULL)
- prpl_info->add_buddy(gc, buddy, purple_buddy_get_group(buddy));
+ if (prpl_info != NULL) {
+ if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy_with_invite))
+ prpl_info->add_buddy_with_invite(gc, buddy, purple_buddy_get_group(buddy), NULL);
+ else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy))
+ prpl_info->add_buddy(gc, buddy, purple_buddy_get_group(buddy));
+ }
}
void
+purple_account_add_buddy_with_invite(PurpleAccount *account, PurpleBuddy *buddy, const char *message)
+{
+ PurplePluginProtocolInfo *prpl_info = NULL;
+ PurpleConnection *gc;
+ PurplePlugin *prpl = NULL;
+
+ g_return_if_fail(account != NULL);
+ g_return_if_fail(buddy != NULL);
+
+ gc = purple_account_get_connection(account);
+ if (gc != NULL)
+ prpl = purple_connection_get_prpl(gc);
+
+ if (prpl != NULL)
+ prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+ if (prpl_info != NULL) {
+ if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy_with_invite))
+ prpl_info->add_buddy_with_invite(gc, buddy, purple_buddy_get_group(buddy), message);
+ else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy))
+ prpl_info->add_buddy(gc, buddy, purple_buddy_get_group(buddy));
+ }
+}
+
+void
purple_account_add_buddies(PurpleAccount *account, GList *buddies)
{
PurplePluginProtocolInfo *prpl_info = NULL;
@@ -2566,12 +2595,23 @@ purple_account_add_buddies(PurpleAccount
groups = g_list_append(groups, purple_buddy_get_group(buddy));
}
- if (prpl_info->add_buddies != NULL)
+ if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddies_with_invite))
+ prpl_info->add_buddies_with_invite(gc, buddies, groups, NULL);
+ else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddies))
prpl_info->add_buddies(gc, buddies, groups);
- else if (prpl_info->add_buddy != NULL) {
+ else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy_with_invite)) {
GList *curb = buddies, *curg = groups;
while ((curb != NULL) && (curg != NULL)) {
+ prpl_info->add_buddy_with_invite(gc, curb->data, curg->data, NULL);
+ curb = curb->next;
+ curg = curg->next;
+ }
+ }
+ else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy)) {
+ GList *curb = buddies, *curg = groups;
+
+ while ((curb != NULL) && (curg != NULL)) {
prpl_info->add_buddy(gc, curb->data, curg->data);
curb = curb->next;
curg = curg->next;
@@ -2583,6 +2623,55 @@ void
}
void
+purple_account_add_buddies_with_invite(PurpleAccount *account, GList *buddies, const char *message)
+{
+ PurplePluginProtocolInfo *prpl_info = NULL;
+ PurpleConnection *gc = purple_account_get_connection(account);
+ PurplePlugin *prpl = NULL;
+
+ if (gc != NULL)
+ prpl = purple_connection_get_prpl(gc);
+
+ if (prpl != NULL)
+ prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl);
+
+ if (prpl_info) {
+ GList *cur, *groups = NULL;
+
+ /* Make a list of what group each buddy is in */
+ for (cur = buddies; cur != NULL; cur = cur->next) {
+ PurpleBuddy *buddy = cur->data;
+ groups = g_list_append(groups, purple_buddy_get_group(buddy));
+ }
+
+ if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddies_with_invite))
+ prpl_info->add_buddies_with_invite(gc, buddies, groups, message);
+ else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy_with_invite)) {
+ GList *curb = buddies, *curg = groups;
+
+ while ((curb != NULL) && (curg != NULL)) {
+ prpl_info->add_buddy_with_invite(gc, curb->data, curg->data, message);
+ curb = curb->next;
+ curg = curg->next;
+ }
+ }
+ else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddies))
+ prpl_info->add_buddies(gc, buddies, groups);
+ else if (PURPLE_PROTOCOL_PLUGIN_HAS_FUNC(prpl_info, add_buddy)) {
+ GList *curb = buddies, *curg = groups;
+
+ while ((curb != NULL) && (curg != NULL)) {
+ prpl_info->add_buddy(gc, curb->data, curg->data);
+ curb = curb->next;
+ curg = curg->next;
+ }
+ }
+
+ g_list_free(groups);
+ }
+}
+
+void
purple_account_remove_buddy(PurpleAccount *account, PurpleBuddy *buddy,
PurpleGroup *group)
{
============================================================
--- libpurple/account.h 4f02d23f6dede47618f0a9c481d96408f194e3a1
+++ libpurple/account.h 0408092f37ba3b8a88d9f0643914f719cef34492
@@ -958,15 +958,40 @@ void purple_account_destroy_log(PurpleAc
*
* @param account The account.
* @param buddy The buddy to add.
+ *
+ * @deprecated Use purple_account_add_buddy_with_invite and \c NULL message.
*/
void purple_account_add_buddy(PurpleAccount *account, PurpleBuddy *buddy);
/**
+ * Adds a buddy to the server-side buddy list for the specified account.
+ *
+ * @param account The account.
+ * @param buddy The buddy to add.
+ * @param message The invite message. This may be ignored by a prpl.
+ *
+ * @since 2.8.0
+ */
+void purple_account_add_buddy_with_invite(PurpleAccount *account, PurpleBuddy *buddy, const char *message);
+
+/**
* Adds a list of buddies to the server-side buddy list.
*
* @param account The account.
* @param buddies The list of PurpleBlistNodes representing the buddies to add.
+ *
+ * @deprecated Use purple_account_add_buddies_with_invite and \c NULL message.
*/
void purple_account_add_buddies(PurpleAccount *account, GList *buddies);
+/**
+ * Adds a list of buddies to the server-side buddy list.
+ *
+ * @param account The account.
+ * @param buddies The list of PurpleBlistNodes representing the buddies to add.
+ * @param message The invite message. This may be ignored by a prpl.
+ *
+ * @since 2.8.0
+ */
+void purple_account_add_buddies_with_invite(PurpleAccount *account, GList *buddies, const char *message);
/**
* Removes a buddy from the server-side buddy list.
============================================================
--- ChangeLog.API c372bdf25d0162ea1cc45c25b1f75fb3f9c360f4
+++ ChangeLog.API b23d685d49dd3a35d42b5286daa734fd57ed8526
@@ -5,12 +5,22 @@ version 2.8.0 (??/??/????):
Added:
* account-authorization-requested-with-message signal (Stefan Ott)
(#8690)
+ * purple_account_add_buddy_with_invite
+ * purple_account_add_buddies_with_invite
* purple_notify_user_info_add_pair_plaintext
* purple_media_get_active_local_candidates
* purple_media_get_active_remote_candidates
* purple_media_manager_get_video_caps (Jakub Adam) (#13095)
* purple_media_manager_set_video_caps (Jakub Adam) (#13095)
+ * Added add_buddy_with_invite to PurplePluginProtocolInfo
+ * Added add_buddies_with_invite to PurplePluginProtocolInfo
+ Deprecated:
+ * purple_account_add_buddy
+ * purple_account_add_buddies_with_invite
+ * add_buddy from PurplePluginProtocolInfo struct
+ * add_buddies from PurplePluginProtocolInfo struct
+
Pidgin:
Added:
* pidgin_make_scrollable (Gabriel Schulhof) (#10599)
More information about the Commits
mailing list