changeset 2607:e0d4a23aac89

[gaim-migrate @ 2620] int main() { while(1) fork(); } committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Thu, 25 Oct 2001 09:19:25 +0000
parents f00549786a9c
children cad63750f3bb
files ChangeLog src/buddy.c src/dialogs.c src/multi.c src/protocols/jabber/jabber.c src/protocols/msn/msn.c src/prpl.h src/server.c
diffstat 8 files changed, 58 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Oct 25 07:03:08 2001 +0000
+++ b/ChangeLog	Thu Oct 25 09:19:25 2001 +0000
@@ -22,6 +22,8 @@
 	  to add them as well (Yahoo, ICQ, and MSN) (thanks Nathan Walp)
 	* Option to grey idle buddies (thanks Nathan Walp)
 	* MSN Privacy Options
+	* In MSN you can set a person's alias to their "friendly name" by
+	  right-click on their name while they're online.
 
 version 0.46 (10/18/2001):
 	* New applet icons (courtesy David Raeman)
--- a/src/buddy.c	Thu Oct 25 07:03:08 2001 +0000
+++ b/src/buddy.c	Thu Oct 25 09:19:25 2001 +0000
@@ -243,6 +243,9 @@
 	GtkCTreeNode *c;
 	char buf[256];
 
+	/* well you shouldn't be calling this if nothing changed. duh. */
+	do_export(b->gc);
+
 	c = gtk_ctree_find_by_row_data(GTK_CTREE(edittree), NULL, b);
 	if (strcmp(b->show, b->name))
 		g_snprintf(buf, sizeof(buf), "%s (%s)", b->name, b->show);
--- a/src/dialogs.c	Thu Oct 25 07:03:08 2001 +0000
+++ b/src/dialogs.c	Thu Oct 25 09:19:25 2001 +0000
@@ -3156,7 +3156,6 @@
 	char *al = gtk_entry_get_text(GTK_ENTRY(aliasname));
 	g_snprintf(b->show, sizeof(b->show), "%s", (al && strlen(al)) ? al : b->name);
 	handle_buddy_rename(b, b->name);
-	do_export(b->gc);
 	destroy_dialog(aliasdlg, aliasdlg);
 }
 
--- a/src/multi.c	Thu Oct 25 07:03:08 2001 +0000
+++ b/src/multi.c	Thu Oct 25 09:19:25 2001 +0000
@@ -102,6 +102,8 @@
 		h = m->members;
 		while (h) {
 			n = (struct buddy *)h->data;
+			if (gc->prpl->buddy_free)
+				(*gc->prpl->buddy_free)(n);
 			h = g_slist_remove(h, n);
 			g_free(n);
 		}
--- a/src/protocols/jabber/jabber.c	Thu Oct 25 07:03:08 2001 +0000
+++ b/src/protocols/jabber/jabber.c	Thu Oct 25 09:19:25 2001 +0000
@@ -1733,6 +1733,14 @@
 	return m;
 }
 
+static void jabber_buddy_free(struct buddy *b)
+{
+	while (b->proto_data) {
+		g_free(((GSList *)b->proto_data)->data);
+		b->proto_data = g_slist_remove(b->proto_data, ((GSList *)b->proto_data)->data);
+	}
+}
+
 static struct prpl *my_protocol = NULL;
 
 void jabber_init(struct prpl *ret)
@@ -1773,6 +1781,7 @@
 	ret->chat_send = jabber_chat_send;
 	ret->keepalive = jabber_keepalive;
 	ret->normalize = jabber_normalize;
+	ret->buddy_free = jabber_buddy_free;
 
 	my_protocol = ret;
 }
--- a/src/protocols/msn/msn.c	Thu Oct 25 07:03:08 2001 +0000
+++ b/src/protocols/msn/msn.c	Thu Oct 25 09:19:25 2001 +0000
@@ -724,7 +724,8 @@
 	} else if (!g_strncasecmp(buf, "GTC", 3)) {
 	} else if (!g_strncasecmp(buf, "INF", 3)) {
 	} else if (!g_strncasecmp(buf, "ILN", 3)) {
-		char *state, *user, *tmp = buf;
+		char *state, *user, *friend, *tmp = buf;
+		struct buddy *b;
 		int status = 0;
 
 		GET_NEXT(tmp);
@@ -736,6 +737,13 @@
 		user = tmp;
 
 		GET_NEXT(tmp);
+		friend = url_decode(tmp);
+
+		if ((b = find_buddy(gc, user)) != NULL) {
+			if (b->proto_data)
+				g_free(b->proto_data);
+			b->proto_data = g_strdup(friend);
+		}
 
 		if (!g_strcasecmp(state, "BSY")) {
 			status |= UC_UNAVAILABLE | (MSN_BUSY << 1);
@@ -867,7 +875,8 @@
 		g_free(utf);
 		g_free(msg);
 	} else if (!g_strncasecmp(buf, "NLN", 3)) {
-		char *state, *user, *tmp = buf;
+		char *state, *user, *friend, *tmp = buf;
+		struct buddy *b;
 		int status = 0;
 
 		GET_NEXT(tmp);
@@ -877,6 +886,13 @@
 		user = tmp;
 
 		GET_NEXT(tmp);
+		friend = url_decode(tmp);
+
+		if ((b = find_buddy(gc, user)) != NULL) {
+			if (b->proto_data)
+				g_free(b->proto_data);
+			b->proto_data = g_strdup(friend);
+		}
 
 		if (!g_strcasecmp(state, "BSY")) {
 			status |= UC_UNAVAILABLE | (MSN_BUSY << 1);
@@ -1432,6 +1448,15 @@
 	}
 }
 
+static void msn_reset_friend(struct gaim_connection *gc, char *who)
+{
+	struct buddy *b = find_buddy(gc, who);
+	if (!b || !b->proto_data)
+		return;
+	g_snprintf(b->show, sizeof(b->show), "%s", (char *)b->proto_data);
+	handle_buddy_rename(b, b->name);
+}
+
 static GList *msn_buddy_menu(struct gaim_connection *gc, char *who)
 {
 	GList *m = NULL;
@@ -1439,6 +1464,12 @@
 	struct buddy *b = find_buddy(gc, who);
 	static char buf[MSN_BUF_LEN];
 
+	pbm = g_new0(struct proto_buddy_menu, 1);
+	pbm->label = "Reset friendly name";
+	pbm->callback = msn_reset_friend;
+	pbm->gc = gc;
+	m = g_list_append(m, pbm);
+
 	if (!b || !(b->uc >> 1))
 		return m;
 
@@ -1656,6 +1687,12 @@
 	}
 }
 
+static void msn_buddy_free(struct buddy *b)
+{
+	if (b->proto_data)
+		g_free(b->proto_data);
+}
+
 static struct prpl *my_protocol = NULL;
 
 void msn_init(struct prpl *ret)
@@ -1686,6 +1723,7 @@
 	ret->rem_permit = msn_rem_permit;
 	ret->add_deny = msn_add_deny;
 	ret->rem_deny = msn_rem_deny;
+	ret->buddy_free = msn_buddy_free;
 
 	my_protocol = ret;
 }
--- a/src/prpl.h	Thu Oct 25 07:03:08 2001 +0000
+++ b/src/prpl.h	Thu Oct 25 09:19:25 2001 +0000
@@ -142,6 +142,8 @@
 	int  (* chat_send)	(struct gaim_connection *, int id, char *message);
 	void (* keepalive)	(struct gaim_connection *);
 
+	void (* buddy_free)	(struct buddy *);
+
 	/* this is really bad. */
 	void (* convo_closed)   (struct gaim_connection *, char *who);
 
--- a/src/server.c	Thu Oct 25 07:03:08 2001 +0000
+++ b/src/server.c	Thu Oct 25 09:19:25 2001 +0000
@@ -688,9 +688,6 @@
 		g_snprintf(b->name, sizeof(b->name), "%s", name);
 		handle_buddy_rename(b, who);
 		g_free(who);
-
-		/* okay lets save the new config... */
-
 	}
 
 	if (!b->idle && idle) {