changeset 15659:94a19bde141d

Include the user's name/alias in the XEP 85 "gone" messages. I previously added a "Delete Log" string... Do we need to honor the string freeze in light of the rename?
author Richard Laager <rlaager@wiktel.com>
date Mon, 19 Feb 2007 04:34:32 +0000
parents 122be0df0567
children fc981ec147a6 b5c5fbe365d2
files libpurple/protocols/jabber/message.c
diffstat 1 files changed, 23 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/message.c	Mon Feb 19 04:32:50 2007 +0000
+++ b/libpurple/protocols/jabber/message.c	Mon Feb 19 04:34:32 2007 +0000
@@ -85,13 +85,30 @@
 		} else if(JM_STATE_GONE == jm->chat_state) {
 			GaimConversation *conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM,
 					from, jm->js->gc->account);
-			if (conv) {
-#if 0  /* String freeze */
-				gaim_conversation_write(conv, "",
-						  "So and so has left the conversation.",
-						  GAIM_MESSAGE_INFO, time(NULL));
+			if (conv && jid->node && jid->domain) {
+#if 0  /* String freeze... make sure to mark the message for translation */
+				char buf[256];
+				GaimBuddy *buddy;
+
+				g_snprintf(buf, sizeof(buf), "%s@%s", jid->node, jid->domain);
+
+				if ((buddy = gaim_find_buddy(jm->js->gc->account, buf))) {
+					const char *who;
+					char *escaped;
+
+					who = gaim_buddy_get_alias(buddy);
+					escaped = g_markup_escape_text(who, -1);
+
+					g_snprintf(buf, sizeof(buf),
+					           "%s has left the conversation.", escaped);
+
+					/* At some point when we restructure GaimConversation,
+					 * this should be able to be implemented by removing the
+					 * user from the conversation like we do with chats now. */
+					gaim_conversation_write(conv, "", buf,
+					                        GAIM_MESSAGE_SYSTEM, time(NULL));
+				}
 #endif
-				
 			}
 			serv_got_typing_stopped(jm->js->gc, from);