diff src/blist.h @ 9787:904b757835ca

[gaim-migrate @ 10655] after an utter failure to get comments on this since it was updated, and thinking that the functionality is worth having, i present to you: " This is a patch to blist.c and blist.h to modify the GaimBuddy structure to add a field for flags. It also adds a single flag GAIM_BUDDY_NO_SAVE, which can be used to indicate that a particular buddy should not be saved to file. This will be particularly useful for prpls with dynamic group support (which I am working on adding to Meanwhile), such as Oscar's recent buddies group. I used a negative flag (NO_SAVE rather than SAVE) because the default should be for saving to happen, and I didn't want to have to initiate the buddy with a save flag set. To counteract this, there is a macro called GAIM_BUDDY_SHOULD_SAVE which checks for the absense of the flag. Woo-hoo double negative!! The beefy part of this patch also factors out the deeply nested loops of the saving code into separate functions. This code also fixes a minor possible bug wherein when saving only a particular account, a group could be written containing empty contacts (due to checking for the specific account only at the group and buddy levels) Here's a version that places the flags field in the BlistNode, and checks for it at each stage (group, chat, contact, buddy). It didn't erase my buddy list when I tried it, so that's nice at least." --Christopher (siege) O'Brien committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Fri, 20 Aug 2004 03:40:33 +0000
parents 4a8bf81b82ae
children fb08a0973b3e
line wrap: on
line diff
--- a/src/blist.h	Thu Aug 19 22:48:27 2004 +0000
+++ b/src/blist.h	Fri Aug 20 03:40:33 2004 +0000
@@ -74,6 +74,14 @@
 		((b)->present == GAIM_BUDDY_ONLINE || \
 		 (b)->present == GAIM_BUDDY_SIGNING_ON))
 
+typedef enum
+{
+	GAIM_BLIST_NODE_FLAG_NO_SAVE = 1,	/**< node should not be saved with the buddy list */
+} GaimBlistNodeFlags;
+
+#define GAIM_BLIST_NODE_HAS_FLAG(b, f) ((b)->flags & (f))
+#define GAIM_BLIST_NODE_SHOULD_SAVE(b) (! GAIM_BLIST_NODE_HAS_FLAG(b, GAIM_BLIST_NODE_FLAG_NO_SAVE))
+
 
 /**************************************************************************/
 /* Data Structures                                                        */
@@ -90,6 +98,7 @@
 	GaimBlistNode *child;               /**< The child of this node         */
 	GHashTable *settings;               /**< per-node settings              */
 	void          *ui_data;             /**< The UI can put data here.      */
+	GaimBlistNodeFlags flags;           /**< The buddy flags                */
 };
 
 /**
@@ -108,8 +117,8 @@
 	int uc;                                 /**< This is a cryptic bitmask that makes sense only to the prpl.  This will get changed */
 	void *proto_data;                       /**< This allows the prpl to associate whatever data it wants with a buddy */
 	GaimBuddyIcon *icon;                    /**< The buddy icon. */
-	GaimAccount *account;           /**< the account this buddy belongs to */
-	guint timer;							/**< The timer handle. */
+	GaimAccount *account;           	/**< the account this buddy belongs to */
+	guint timer;				/**< The timer handle. */
 };
 
 /**
@@ -493,6 +502,17 @@
 const char *gaim_contact_get_alias(GaimContact *contact);
 
 /**
+ * Determines whether an account owns any buddies in a given contact
+ *
+ * @param contact  The contact to search through.
+ * @param account  The account.
+ *
+ * @return TRUE if there are any buddies from account in the contact, or FALSE otherwise.
+ */
+gboolean gaim_contact_on_account(GaimContact *contact, GaimAccount *account);
+
+
+/**
  * Removes a buddy from the buddy list and frees the memory allocated to it.
  *
  * @param buddy   The buddy to be removed