changeset 16815:9410f6c2c542

merge of '45d1b5cb6bcf0cce3082b5b48045a5b708ed27d5' and 'e3290844f738f1d63f421385f00eb7e013344e70'
author Mark Doliner <mark@kingant.net>
date Thu, 03 May 2007 07:48:32 +0000
parents 358fade1205e (current diff) 3205cc84ce54 (diff)
children 04fecd1ee64d
files pidgin/pixmaps/emotes/default/22/theme
diffstat 8 files changed, 45 insertions(+), 69 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/blist.c	Thu May 03 05:30:29 2007 +0000
+++ b/libpurple/blist.c	Thu May 03 07:48:32 2007 +0000
@@ -1825,7 +1825,6 @@
 	/* Delete the node */
 	purple_buddy_icon_unref(buddy->icon);
 	g_hash_table_destroy(buddy->node.settings);
-	purple_presence_remove_buddy(buddy->presence, buddy);
 	purple_presence_destroy(buddy->presence);
 	g_free(buddy->name);
 	g_free(buddy->alias);
--- a/libpurple/gaim-compat.h	Thu May 03 05:30:29 2007 +0000
+++ b/libpurple/gaim-compat.h	Thu May 03 07:48:32 2007 +0000
@@ -115,7 +115,6 @@
 #define gaim_account_add_buddy       purple_account_add_buddy
 #define gaim_account_add_buddies     purple_account_add_buddies
 #define gaim_account_remove_buddy    purple_account_remove_buddy
-#define gaim_account_remove_buddies  purple_account_remove_buddies
 
 #define gaim_account_remove_group  purple_account_remove_group
 
@@ -1997,7 +1996,6 @@
 #define gaim_presence_get_account        purple_presence_get_account
 #define gaim_presence_get_conversation   purple_presence_get_conversation
 #define gaim_presence_get_chat_user      purple_presence_get_chat_user
-#define gaim_presence_get_buddies        purple_presence_get_buddies
 #define gaim_presence_get_statuses       purple_presence_get_statuses
 #define gaim_presence_get_status         purple_presence_get_status
 #define gaim_presence_get_active_status  purple_presence_get_active_status
--- a/libpurple/protocols/oscar/oscar.c	Thu May 03 05:30:29 2007 +0000
+++ b/libpurple/protocols/oscar/oscar.c	Thu May 03 07:48:32 2007 +0000
@@ -5430,8 +5430,6 @@
 			return "bot";
 		if (userinfo->capabilities & OSCAR_CAPABILITY_HIPTOP)
 			return "hiptop";
-		if (userinfo->flags & AIM_FLAG_AOL)
-			return "aol-client";
 		if (userinfo->capabilities & OSCAR_CAPABILITY_SECUREIM)
 			return "secure";
 	}
--- a/libpurple/sound.c	Thu May 03 05:30:29 2007 +0000
+++ b/libpurple/sound.c	Thu May 03 07:48:32 2007 +0000
@@ -31,6 +31,8 @@
 #define STATUS_AVAILABLE 1
 #define STATUS_AWAY 2
 
+static time_t last_played[PURPLE_NUM_SOUNDS];
+
 static gboolean
 purple_sound_play_required(const PurpleAccount *account)
 {
@@ -77,6 +79,10 @@
 	if (!purple_sound_play_required(account))
 		return;
 
+	if (time(NULL) - last_played[event] < 2)
+		return;
+	last_played[event] = time(NULL);
+
 	if(sound_ui_ops && sound_ui_ops->play_event) {
 		int plugin_return;
 
@@ -127,6 +133,7 @@
 
 	purple_prefs_add_none("/purple/sound");
 	purple_prefs_add_int("/purple/sound/while_status", STATUS_AVAILABLE);
+	memset(last_played, 0, sizeof(last_played));
 }
 
 void
--- a/libpurple/status.c	Thu May 03 05:30:29 2007 +0000
+++ b/libpurple/status.c	Thu May 03 07:48:32 2007 +0000
@@ -91,8 +91,7 @@
 		{
 			PurpleAccount *account;
 			char *name;
-			size_t ref_count;
-			GList *buddies;
+			PurpleBuddy *buddy;
 
 		} buddy;
 
@@ -131,13 +130,15 @@
 	-200,   /* extended away            */
 	-400,   /* mobile                   */
 	-10,    /* idle, special case.      */
-	-5      /* idle time, special case. */
+	-5,     /* idle time, special case. */
+	10      /* Offline messageable      */
 };
 
 static GHashTable *buddy_presences = NULL;
 
 #define SCORE_IDLE      8
 #define SCORE_IDLE_TIME 9
+#define SCORE_OFFLINE_MESSAGE 10
 
 /**************************************************************************
  * PurpleStatusPrimitive API
@@ -658,13 +659,8 @@
 	}
 	else if (context == PURPLE_PRESENCE_CONTEXT_BUDDY)
 	{
-		const GList *l;
-
-		for (l = purple_presence_get_buddies(presence); l != NULL; l = l->next)
-		{
-			notify_buddy_status_update((PurpleBuddy *)l->data, presence,
+			notify_buddy_status_update(purple_presence_get_buddy(presence), presence,
 					old_status, new_status);
-		}
 	}
 }
 
@@ -1148,10 +1144,7 @@
 		g_free(key->name);
 		g_free(key);
 	}
-
-	presence->u.buddy.ref_count++;
-	presence->u.buddy.buddies = g_list_append(presence->u.buddy.buddies,
-			buddy);
+	presence->u.buddy.buddy = buddy;
 
 	return presence;
 }
@@ -1165,9 +1158,6 @@
 	{
 		PurpleStatusBuddyKey key;
 
-		if(presence->u.buddy.ref_count != 0)
-			return;
-
 		key.account = presence->u.buddy.account;
 		key.name    = presence->u.buddy.name;
 
@@ -1189,27 +1179,6 @@
 	g_free(presence);
 }
 
-/*
- * TODO: Maybe we should cal purple_presence_destroy() after we
- *       decrement the ref count?  I don't see why we should
- *       make other places do it manually when we can do it here.
- */
-void
-purple_presence_remove_buddy(PurplePresence *presence, PurpleBuddy *buddy)
-{
-	g_return_if_fail(presence != NULL);
-	g_return_if_fail(buddy    != NULL);
-	g_return_if_fail(purple_presence_get_context(presence) ==
-			PURPLE_PRESENCE_CONTEXT_BUDDY);
-
-	if (g_list_find(presence->u.buddy.buddies, buddy) != NULL)
-	{
-		presence->u.buddy.buddies = g_list_remove(presence->u.buddy.buddies,
-				buddy);
-		presence->u.buddy.ref_count--;
-	}
-}
-
 void
 purple_presence_add_status(PurplePresence *presence, PurpleStatus *status)
 {
@@ -1345,11 +1314,8 @@
 		const GList *l;
 		time_t current_time = time(NULL);
 
-		for (l = purple_presence_get_buddies(presence); l != NULL; l = l->next)
-		{
-			update_buddy_idle((PurpleBuddy *)l->data, presence, current_time,
-			old_idle, idle);
-		}
+		update_buddy_idle(purple_presence_get_buddy(presence), presence, current_time,
+		old_idle, idle);
 	}
 	else if(purple_presence_get_context(presence) == PURPLE_PRESENCE_CONTEXT_ACCOUNT)
 	{
@@ -1443,14 +1409,14 @@
 	return presence->u.chat.user;
 }
 
-const GList *
-purple_presence_get_buddies(const PurplePresence *presence)
+PurpleBuddy *
+purple_presence_get_buddy(const PurplePresence *presence)
 {
 	g_return_val_if_fail(presence != NULL, NULL);
 	g_return_val_if_fail(purple_presence_get_context(presence) ==
 			PURPLE_PRESENCE_CONTEXT_BUDDY, NULL);
 
-	return presence->u.buddy.buddies;
+	return presence->u.buddy.buddy;
 }
 
 const GList *
@@ -1607,8 +1573,14 @@
 		PurpleStatus *status = (PurpleStatus *)l->data;
 		PurpleStatusType *type = purple_status_get_type(status);
 
-		if (purple_status_is_active(status))
+		if (purple_status_is_active(status)) {
 			score1 += primitive_scores[purple_status_type_get_primitive(type)];
+			if (!purple_status_is_online(status)) {
+				PurpleBuddy *b = purple_presence_get_buddy(presence1);
+				if (b && purple_account_supports_offline_message(purple_buddy_get_account(b),b))
+					score1 += primitive_scores[SCORE_OFFLINE_MESSAGE];
+			}
+		}
 	}
 	score1 += purple_account_get_int(purple_presence_get_account(presence1), "score", 0);
 
@@ -1618,8 +1590,15 @@
 		PurpleStatus *status = (PurpleStatus *)l->data;
 		PurpleStatusType *type = purple_status_get_type(status);
 
-		if (purple_status_is_active(status))
+		if (purple_status_is_active(status)) {
 			score2 += primitive_scores[purple_status_type_get_primitive(type)];
+			if (!purple_status_is_online(status)) {
+				PurpleBuddy *b = purple_presence_get_buddy(presence2);
+				if (b && purple_account_supports_offline_message(purple_buddy_get_account(b),b))
+					score2 += primitive_scores[SCORE_OFFLINE_MESSAGE];
+			}
+
+		}
 	}
 	score2 += purple_account_get_int(purple_presence_get_account(presence2), "score", 0);
 
@@ -1723,6 +1702,8 @@
 			primitive_scores[PURPLE_STATUS_EXTENDED_AWAY]);
 	purple_prefs_add_int("/purple/status/scores/idle",
 			primitive_scores[SCORE_IDLE]);
+	purple_prefs_add_int("/purple/status/scores/offline_msg",
+			primitive_scores[SCORE_OFFLINE_MESSAGE]);
 
 	purple_prefs_connect_callback(handle, "/purple/status/scores/offline",
 			score_pref_changed_cb,
@@ -1742,6 +1723,9 @@
 	purple_prefs_connect_callback(handle, "/purple/status/scores/idle",
 			score_pref_changed_cb,
 			GINT_TO_POINTER(SCORE_IDLE));
+	purple_prefs_connect_callback(handle, "/purple/status/scores/offline_msg",
+			score_pref_changed_cb,
+			GINT_TO_POINTER(SCORE_OFFLINE_MESSAGE));
 
 	buddy_presences = g_hash_table_new_full(purple_buddy_presences_hash,
 											purple_buddy_presences_equal,
--- a/libpurple/status.h	Thu May 03 05:30:29 2007 +0000
+++ b/libpurple/status.h	Thu May 03 07:48:32 2007 +0000
@@ -760,16 +760,6 @@
 void purple_presence_destroy(PurplePresence *presence);
 
 /**
- * Removes a buddy from a presence.
- *
- * This must be done before destroying a buddy in a presence.
- *
- * @param presence The presence.
- * @param buddy    The buddy.
- */
-void purple_presence_remove_buddy(PurplePresence *presence, PurpleBuddy *buddy);
-
-/**
  * Adds a status to a presence.
  *
  * @param presence The presence.
@@ -869,13 +859,13 @@
 const char *purple_presence_get_chat_user(const PurplePresence *presence);
 
 /**
- * Returns a presence's list of buddies.
+ * Returns the presence's buddy.
  *
  * @param presence The presence.
  *
- * @return The presence's list of buddies.
+ * @return The presence's buddy.
  */
-const GList *purple_presence_get_buddies(const PurplePresence *presence);
+PurpleBuddy *purple_presence_get_buddy(const PurplePresence *presence);
 
 /**
  * Returns all the statuses in a presence.
--- a/pidgin/gtkconv.c	Thu May 03 05:30:29 2007 +0000
+++ b/pidgin/gtkconv.c	Thu May 03 07:48:32 2007 +0000
@@ -3389,7 +3389,7 @@
 			for (iter = g_list_last(list); iter != NULL; iter = iter->prev)
 			{
 				PurplePresence *pre = iter->data;
-				PurpleBuddy *buddy = purple_presence_get_buddies(pre)->data;
+				PurpleBuddy *buddy = purple_presence_get_buddy(pre);
 				create_sendto_item(menu, sg, &group, buddy,
 							purple_buddy_get_account(buddy), purple_buddy_get_name(buddy));
 			}
--- a/pidgin/pixmaps/emotes/default/22/theme	Thu May 03 05:30:29 2007 +0000
+++ b/pidgin/pixmaps/emotes/default/22/theme	Thu May 03 07:48:32 2007 +0000
@@ -1,5 +1,5 @@
 Name=Default
-Description=Pidgin smileys (default)
+Description=Pidgin smileys
 Icon=smile.png
 Author=Hylke Bons
 
@@ -21,8 +21,8 @@
 moneymouth.png      :-$
 foot-in-mouth.png   :-!
 shout.png           >:o     >:O
-!skywalker.png      C:-)
-!monkey.png         :-(|)
+! skywalker.png     C:-)
+! monkey.png        :-(|)
 
 ### Following AIM 6.1
 [AIM]