pidgin.mxit: 8fe017f8: Display a message in the chat window whe...

andrew.victor at mxit.com andrew.victor at mxit.com
Wed Jun 30 09:01:55 EDT 2010


----------------------------------------------------------------------
Revision: 8fe017f89f6289d2aa1a7d0437e389895095f933
Parent:   5e100dffc9b7d212a420f899daa1f893a4be6b3c
Author:   andrew.victor at mxit.com
Date:     06/30/10 08:56:53
Branch:   im.pidgin.pidgin.mxit
URL: http://d.pidgin.im/viewmtn/revision/info/8fe017f89f6289d2aa1a7d0437e389895095f933

Changelog: 

Display a message in the chat window when you invite someone.
Provides better UI feedback.


Changes against parent 5e100dffc9b7d212a420f899daa1f893a4be6b3c

  patched  libpurple/protocols/mxit/multimx.c

-------------- next part --------------
============================================================
--- libpurple/protocols/mxit/multimx.c	8055289b53d1ae927067e5313e7c251a03449653
+++ libpurple/protocols/mxit/multimx.c	5cca42f4f0c89b64afc6ec5aca2981bcdb3891b6
@@ -557,6 +557,9 @@ void mxit_chat_invite(PurpleConnection *
 {
 	struct MXitSession* session = (struct MXitSession*) gc->proto_data;
 	struct multimx* multimx = NULL;
+	PurpleBuddy* buddy;
+	PurpleConversation *convo;
+	char* tmp;
 
 	purple_debug_info(MXIT_PLUGIN_ID, "Groupchat invite to '%s'\n", username);
 
@@ -569,6 +572,24 @@ void mxit_chat_invite(PurpleConnection *
 
 	/* Send invite to MXit */
 	mxit_send_groupchat_invite(session, multimx->roomid, 1, &username);
+
+	/* Find the buddy information for this contact (reference: "libpurple/blist.h") */
+	buddy = purple_find_buddy(session->acc, username);
+	if (!buddy) {
+		purple_debug_warning(MXIT_PLUGIN_ID, "mxit_chat_invite: unable to find the buddy '%s'\n", username);
+		return;
+	}
+
+	convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, multimx->roomname, session->acc);
+	if (convo == NULL) {
+		purple_debug_error(MXIT_PLUGIN_ID, "Conversation '%s' not found\n", multimx->roomname);
+		return;
+	}
+
+	/* Display system message in chat window */
+	tmp = g_strdup_printf("%s: %s", _("You have invited"), purple_buddy_get_alias(buddy));
+	purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "MXit", tmp, PURPLE_MESSAGE_SYSTEM, time(NULL));
+	g_free(tmp);
 }
 
 


More information about the Commits mailing list