changeset 12010:b41b75f709e4

[gaim-migrate @ 14303] sf patch #1350789, from Peter Lawler "When Yahoo introduced their selective visibility, they called it 'stealth'. I guess the US Air Force must've got law-suit happy or something. Anyways, here's the patch where we change it to Presence, to match the native client." committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 08 Nov 2005 23:50:06 +0000
parents 8a7553e149de
children b4d7d6dbc95c
files src/protocols/yahoo/yahoo.c src/protocols/yahoo/yahoo_friend.c src/protocols/yahoo/yahoo_friend.h src/protocols/yahoo/yahoo_packet.h
diffstat 4 files changed, 76 insertions(+), 76 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/yahoo/yahoo.c	Tue Nov 08 23:44:00 2005 +0000
+++ b/src/protocols/yahoo/yahoo.c	Tue Nov 08 23:50:06 2005 +0000
@@ -489,7 +489,7 @@
 	char **buddies;
 	char **tmp, **bud, *norm_bud;
 	char *grp = NULL;
-	char *perm_stealth_buddies = NULL;
+	char *perm_presence_buddies = NULL;
 
 	if (pkt->id)
 		yd->session_id = pkt->id;
@@ -514,8 +514,8 @@
 		case 59: /* cookies, yum */
 			yahoo_process_cookie(yd, pair->value);
 			break;
-		case YAHOO_SERVICE_STEALTH_PERM:
-			perm_stealth_buddies = pair->value;
+		case YAHOO_SERVICE_PRESENCE_PERM:
+			perm_presence_buddies = pair->value;
 			break;
 		}
 	}
@@ -589,12 +589,12 @@
 		      gc->account->username);
 	}
 
-	if (perm_stealth_buddies) {
-		buddies = g_strsplit(perm_stealth_buddies, ",", -1);
+	if (perm_presence_buddies) {
+		buddies = g_strsplit(perm_presence_buddies, ",", -1);
 		for (bud = buddies; bud && *bud; bud++) {
 			f = yahoo_friend_find(gc, *bud);
 			if (f)
-				f->stealth = YAHOO_STEALTH_PERM_OFFLINE;
+				f->presence = YAHOO_PRESENCE_PERM_OFFLINE;
 		}
 		g_strfreev(buddies);
 
@@ -2077,9 +2077,9 @@
 	case YAHOO_SERVICE_COMMENT:
 		yahoo_process_chat_message(gc, pkt);
 		break;
-	case YAHOO_SERVICE_STEALTH_PERM:
-	case YAHOO_SERVICE_STEALTH_SESSION:
-		yahoo_process_stealth(gc, pkt);
+	case YAHOO_SERVICE_PRESENCE_PERM:
+	case YAHOO_SERVICE_PRESENCE_SESSION:
+		yahoo_process_presence(gc, pkt);
 		break;
 	case YAHOO_SERVICE_P2PFILEXFER:
 		/* This case had no break and continued; thus keeping it this way.*/
@@ -2680,15 +2680,15 @@
 	yahoo_c_invite(gc, id, "Join my conference...", buddy->name);
 }
 
-static void yahoo_stealth_settings(GaimBlistNode *node, gpointer data) {
+static void yahoo_presence_settings(GaimBlistNode *node, gpointer data) {
 	GaimBuddy *buddy;
 	GaimConnection *gc;
-	int stealth_val = GPOINTER_TO_INT(data);
+	int presence_val = GPOINTER_TO_INT(data);
 
 	buddy = (GaimBuddy *) node;
 	gc = gaim_account_get_connection(buddy->account);
 
-	yahoo_friend_update_stealth(gc, buddy->name, stealth_val);
+	yahoo_friend_update_presence(gc, buddy->name, presence_val);
 }
 
 static void yahoo_game(GaimBlistNode *node, gpointer data) {
@@ -2758,7 +2758,7 @@
 char *yahoo_tooltip_text(GaimBuddy *b)
 {
 	YahooFriend *f;
-	char *escaped, *status = NULL, *stealth = NULL;
+	char *escaped, *status = NULL, *presence = NULL;
 	GString *s = g_string_new("");
 
 	f = yahoo_friend_find(b->account->gc, b->name);
@@ -2784,16 +2784,16 @@
 			break;
 		}
 
-		switch (f->stealth) {
-			case YAHOO_STEALTH_ONLINE:
-				stealth = _("Appear Online");
+		switch (f->presence) {
+			case YAHOO_PRESENCE_ONLINE:
+				presence = _("Appear Online");
 				break;
-			case YAHOO_STEALTH_PERM_OFFLINE:
-				stealth = _("Appear Permanently Offline");
+			case YAHOO_PRESENCE_PERM_OFFLINE:
+				presence = _("Appear Permanently Offline");
 				break;
-			case YAHOO_STEALTH_DEFAULT:
+			case YAHOO_PRESENCE_DEFAULT:
 			default:
-				stealth = _("None");
+				presence = _("None");
 				break;
 		}
 	}
@@ -2805,9 +2805,9 @@
 		g_free(escaped);
 	}
 
-	if (stealth != NULL)
+	if (presence != NULL)
 		g_string_append_printf(s, _("\n<b>%s:</b> %s"),
-				_("Stealth"), stealth);
+				_("Presence"), presence);
 
 	return g_string_free(s, FALSE);
 }
@@ -2839,38 +2839,38 @@
 	yahoo_chat_goto(gc, buddy->name);
 }
 
-static GList *build_stealth_submenu(YahooFriend *f, GaimConnection *gc) {
+static GList *build_presence_submenu(YahooFriend *f, GaimConnection *gc) {
 	GList *m = NULL;
 	GaimBlistNodeAction *act;
 	struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data;
 
 	if (yd->current_status == YAHOO_STATUS_INVISIBLE) {
-		if (f->stealth != YAHOO_STEALTH_ONLINE) {
+		if (f->presence != YAHOO_PRESENCE_ONLINE) {
 			act = gaim_blist_node_action_new(_("Appear Online"),
-					yahoo_stealth_settings,
-					GINT_TO_POINTER(YAHOO_STEALTH_ONLINE),
+					yahoo_presence_settings,
+					GINT_TO_POINTER(YAHOO_PRESENCE_ONLINE),
 					NULL);
 			m = g_list_append(m, act);
-		} else if (f->stealth != YAHOO_STEALTH_DEFAULT) {
+		} else if (f->presence != YAHOO_PRESENCE_DEFAULT) {
 			act = gaim_blist_node_action_new(_("Appear Offline"),
-					yahoo_stealth_settings,
-					GINT_TO_POINTER(YAHOO_STEALTH_DEFAULT),
+					yahoo_presence_settings,
+					GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT),
 					NULL);
 			m = g_list_append(m, act);
 		}
 	}
 
-	if (f->stealth == YAHOO_STEALTH_PERM_OFFLINE) {
+	if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) {
 		act = gaim_blist_node_action_new(
 				_("Don't Appear Permanently Offline"),
-				yahoo_stealth_settings,
-				GINT_TO_POINTER(YAHOO_STEALTH_DEFAULT), NULL);
+				yahoo_presence_settings,
+				GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT), NULL);
 		m = g_list_append(m, act);
 	} else {
 		act = gaim_blist_node_action_new(
 				_("Appear Permanently Offline"),
-				yahoo_stealth_settings,
-				GINT_TO_POINTER(YAHOO_STEALTH_PERM_OFFLINE),
+				yahoo_presence_settings,
+				GINT_TO_POINTER(YAHOO_PRESENCE_PERM_OFFLINE),
 				NULL);
 		m = g_list_append(m, act);
 	}
@@ -2939,8 +2939,8 @@
 	}
 
 	if (f) {
-		act = gaim_blist_node_action_new(_("Stealth Settings"),
-				NULL, NULL, build_stealth_submenu(f, gc));
+		act = gaim_blist_node_action_new(_("Presence Settings"),
+				NULL, NULL, build_presence_submenu(f, gc));
 		m = g_list_append(m, act);
 	}
 
@@ -3066,11 +3066,11 @@
 	return 0;
 }
 
-static void yahoo_session_stealth_remove(gpointer key, gpointer value, gpointer data)
+static void yahoo_session_presence_remove(gpointer key, gpointer value, gpointer data)
 {
 	YahooFriend *f = value;
-	if (f && f->stealth == YAHOO_STEALTH_ONLINE)
-		f->stealth = YAHOO_STEALTH_DEFAULT;
+	if (f && f->presence == YAHOO_PRESENCE_ONLINE)
+		f->presence = YAHOO_PRESENCE_DEFAULT;
 }
 
 static void yahoo_set_status(GaimAccount *account, GaimStatus *status)
@@ -3142,8 +3142,8 @@
 		yahoo_packet_hash_str(pkt, 13, "1");
 		yahoo_packet_send_and_free(pkt, yd);
 
-		/* Any per-session stealth settings are removed */
-		g_hash_table_foreach(yd->friends, yahoo_session_stealth_remove, NULL);
+		/* Any per-session presence settings are removed */
+		g_hash_table_foreach(yd->friends, yahoo_session_presence_remove, NULL);
 
 	}
 }
--- a/src/protocols/yahoo/yahoo_friend.c	Tue Nov 08 23:44:00 2005 +0000
+++ b/src/protocols/yahoo/yahoo_friend.c	Tue Nov 08 23:50:06 2005 +0000
@@ -34,7 +34,7 @@
 
 	ret = g_new0(YahooFriend, 1);
 	ret->status = YAHOO_STATUS_OFFLINE;
-	ret->stealth = YAHOO_STEALTH_DEFAULT;
+	ret->presence = YAHOO_PRESENCE_DEFAULT;
 
 	return ret;
 }
@@ -137,7 +137,7 @@
 	g_free(f);
 }
 
-void yahoo_process_stealth(GaimConnection *gc, struct yahoo_packet *pkt)
+void yahoo_process_presence(GaimConnection *gc, struct yahoo_packet *pkt)
 {
 	GSList *l = pkt->hash;
 	YahooFriend *f;
@@ -160,7 +160,7 @@
 	}
 
 	if (value != 1 && value != 2) {
-		gaim_debug_error("yahoo", "Received unknown value for stealth key: %d\n", value);
+		gaim_debug_error("yahoo", "Received unknown value for presence key: %d\n", value);
 		return;
 	}
 
@@ -170,28 +170,28 @@
 	if (!f)
 		return;
 
-	if (pkt->service == YAHOO_SERVICE_STEALTH_PERM) {
-		gaim_debug_info("yahoo", "Setting permanent stealth for %s to %d.\n", who, (value == 1));
+	if (pkt->service == YAHOO_SERVICE_PRESENCE_PERM) {
+		gaim_debug_info("yahoo", "Setting permanent presence for %s to %d.\n", who, (value == 1));
 		/* If setting from perm offline to online when in invisible status,
 		 * this has already been taken care of (when the temp status changed) */
-		if (value == 2 && f->stealth == YAHOO_STEALTH_ONLINE) {
+		if (value == 2 && f->presence == YAHOO_PRESENCE_ONLINE) {
 		} else {
 			if (value == 1) /* Setting Perm offline */
-				f->stealth = YAHOO_STEALTH_PERM_OFFLINE;
+				f->presence = YAHOO_PRESENCE_PERM_OFFLINE;
 			else
-				f->stealth = YAHOO_STEALTH_DEFAULT;
+				f->presence = YAHOO_PRESENCE_DEFAULT;
 		}
 	} else {
-		gaim_debug_info("yahoo", "Setting session stealth for %s to %d.\n", who, (value == 1));
+		gaim_debug_info("yahoo", "Setting session presence for %s to %d.\n", who, (value == 1));
 		if (value == 1)
-			f->stealth = YAHOO_STEALTH_ONLINE;
+			f->presence = YAHOO_PRESENCE_ONLINE;
 		else
-			f->stealth = YAHOO_STEALTH_DEFAULT;
+			f->presence = YAHOO_PRESENCE_DEFAULT;
 	}
 }
 
-void yahoo_friend_update_stealth(GaimConnection *gc, const char *name,
-		YahooStealthVisibility stealth)
+void yahoo_friend_update_presence(GaimConnection *gc, const char *name,
+		YahooPresenceVisibility presence)
 {
 	struct yahoo_data *yd = gc->proto_data;
 	struct yahoo_packet *pkt = NULL;
@@ -205,36 +205,36 @@
 		return;
 
 	/* No need to change the value if it is already correct */
-	if (f->stealth == stealth) {
-		gaim_debug_info("yahoo", "Not setting stealth because there are no changes.\n");
+	if (f->presence == presence) {
+		gaim_debug_info("yahoo", "Not setting presence because there are no changes.\n");
 		return;
 	}
 
-	if (stealth == YAHOO_STEALTH_PERM_OFFLINE) {
-		pkt = yahoo_packet_new(YAHOO_SERVICE_STEALTH_PERM,
+	if (presence == YAHOO_PRESENCE_PERM_OFFLINE) {
+		pkt = yahoo_packet_new(YAHOO_SERVICE_PRESENCE_PERM,
 				YAHOO_STATUS_AVAILABLE, yd->session_id);
 
 		yahoo_packet_hash(pkt, "ssss",
 				1, gaim_connection_get_display_name(gc),
 				31, "1", 13, "2", 7, name);
-	} else if (stealth == YAHOO_STEALTH_DEFAULT) {
-		if (f->stealth == YAHOO_STEALTH_PERM_OFFLINE) {
-			pkt = yahoo_packet_new(YAHOO_SERVICE_STEALTH_PERM,
+	} else if (presence == YAHOO_PRESENCE_DEFAULT) {
+		if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) {
+			pkt = yahoo_packet_new(YAHOO_SERVICE_PRESENCE_PERM,
 					YAHOO_STATUS_AVAILABLE, yd->session_id);
 
 			yahoo_packet_hash(pkt, "ssss",
 					1, gaim_connection_get_display_name(gc),
 					31, "2", 13, "2", 7, name);
 		} else if (yd->current_status == YAHOO_STATUS_INVISIBLE) {
-			pkt = yahoo_packet_new(YAHOO_SERVICE_STEALTH_SESSION,
+			pkt = yahoo_packet_new(YAHOO_SERVICE_PRESENCE_SESSION,
 					YAHOO_STATUS_AVAILABLE, yd->session_id);
 			yahoo_packet_hash(pkt, "ssss",
 				1, gaim_connection_get_display_name(gc),
 				31, "2", 13, "1", 7, name);
 		}
-	} else if (stealth == YAHOO_STEALTH_ONLINE) {
-		if (f->stealth == YAHOO_STEALTH_PERM_OFFLINE) {
-			pkt = yahoo_packet_new(YAHOO_SERVICE_STEALTH_PERM,
+	} else if (presence == YAHOO_PRESENCE_ONLINE) {
+		if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) {
+			pkt = yahoo_packet_new(YAHOO_SERVICE_PRESENCE_PERM,
 					YAHOO_STATUS_AVAILABLE, yd->session_id);
 			yahoo_packet_hash(pkt, "ssss",
 					1, gaim_connection_get_display_name(gc),
@@ -242,7 +242,7 @@
 			yahoo_packet_send_and_free(pkt, yd);
 		}
 
-		pkt = yahoo_packet_new(YAHOO_SERVICE_STEALTH_SESSION,
+		pkt = yahoo_packet_new(YAHOO_SERVICE_PRESENCE_SESSION,
 				YAHOO_STATUS_AVAILABLE, yd->session_id);
 		yahoo_packet_hash(pkt, "ssss",
 				1, gaim_connection_get_display_name(gc),
--- a/src/protocols/yahoo/yahoo_friend.h	Tue Nov 08 23:44:00 2005 +0000
+++ b/src/protocols/yahoo/yahoo_friend.h	Tue Nov 08 23:50:06 2005 +0000
@@ -29,10 +29,10 @@
 #include "yahoo_packet.h"
 
 typedef enum {
-	YAHOO_STEALTH_DEFAULT = 0,
-	YAHOO_STEALTH_ONLINE,
-	YAHOO_STEALTH_PERM_OFFLINE
-} YahooStealthVisibility;
+	YAHOO_PRESENCE_DEFAULT = 0,
+	YAHOO_PRESENCE_ONLINE,
+	YAHOO_PRESENCE_PERM_OFFLINE
+} YahooPresenceVisibility;
 
 /* these are called friends instead of buddies mainly so I can use variables
  * named f and not confuse them with variables named b
@@ -46,7 +46,7 @@
 	gboolean sms;
 	char *ip;
 	gboolean bicon_sent_request;
-	YahooStealthVisibility stealth;
+	YahooPresenceVisibility presence;
 } YahooFriend;
 
 YahooFriend *yahoo_friend_find(GaimConnection *gc, const char *name);
@@ -66,8 +66,8 @@
 
 void yahoo_friend_free(gpointer p);
 
-void yahoo_process_stealth(GaimConnection *gc, struct yahoo_packet *pkt);
-void yahoo_friend_update_stealth(GaimConnection *gc, const char *name,
-		YahooStealthVisibility stealth);
+void yahoo_process_presence(GaimConnection *gc, struct yahoo_packet *pkt);
+void yahoo_friend_update_presence(GaimConnection *gc, const char *name,
+		YahooPresenceVisibility presence);
 
 #endif /* _YAHOO_FRIEND_H_ */
--- a/src/protocols/yahoo/yahoo_packet.h	Tue Nov 08 23:44:00 2005 +0000
+++ b/src/protocols/yahoo/yahoo_packet.h	Tue Nov 08 23:50:06 2005 +0000
@@ -85,8 +85,8 @@
 	YAHOO_SERVICE_CHATLOGOUT = 0xa0,
 	YAHOO_SERVICE_CHATPING,
 	YAHOO_SERVICE_COMMENT = 0xa8,
-	YAHOO_SERVICE_STEALTH_PERM = 0xb9,
-	YAHOO_SERVICE_STEALTH_SESSION = 0xba,
+	YAHOO_SERVICE_PRESENCE_PERM = 0xb9,
+	YAHOO_SERVICE_PRESENCE_SESSION = 0xba,
 	YAHOO_SERVICE_AVATAR = 0xbc,
 	YAHOO_SERVICE_PICTURE_CHECKSUM = 0xbd,
 	YAHOO_SERVICE_PICTURE = 0xbe,