/cpw/tomkiewicz/gg11: 6ae053435538: Gadu-Gadu: enable inline ima...

Tomasz Wasilczyk tomkiewicz at cpw.pidgin.im
Wed Sep 19 08:48:58 EDT 2012


Changeset: 6ae053435538bbfb8443c9ebd29bed020c35cdf8
Author:	 Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date:	 2012-09-19 14:48 +0200
Branch:	 default
URL: http://hg.pidgin.im/cpw/tomkiewicz/gg11/rev/6ae053435538

Description:

Gadu-Gadu: enable inline images and GG11 formatting for conferences

diffstat:

 libpurple/protocols/gg/chat.c         |  12 +++++++++++-
 libpurple/protocols/gg/message-prpl.c |   4 +---
 libpurple/protocols/gg/message-prpl.h |   1 +
 3 files changed, 13 insertions(+), 4 deletions(-)

diffs (71 lines):

diff --git a/libpurple/protocols/gg/chat.c b/libpurple/protocols/gg/chat.c
--- a/libpurple/protocols/gg/chat.c
+++ b/libpurple/protocols/gg/chat.c
@@ -4,6 +4,7 @@
 
 #include "gg.h"
 #include "utils.h"
+#include "message-prpl.h"
 
 typedef struct _ggp_chat_local_info ggp_chat_local_info;
 
@@ -468,9 +469,11 @@ int ggp_chat_send(PurpleConnection *gc, 
 	PurpleMessageFlags flags)
 {
 	GGPInfo *info = purple_connection_get_protocol_data(gc);
+	PurpleConversation *conv;
 	ggp_chat_local_info *chat;
 	gboolean succ = TRUE;
 	const gchar *me;
+	gchar *gg_msg;
 	
 	chat = ggp_chat_get_local(gc, local_id);
 	if (!chat)
@@ -480,8 +483,15 @@ int ggp_chat_send(PurpleConnection *gc, 
 		return -1;
 	}
 	
-	if (gg_chat_send_message(info->session, chat->id, message, TRUE) < 0)
+	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT,
+		ggp_chat_get_name_from_id(chat->id),
+		purple_connection_get_account(gc));
+
+	gg_msg = ggp_message_format_to_gg(conv, message);
+
+	if (gg_chat_send_message(info->session, chat->id, gg_msg, TRUE) < 0)
 		succ = FALSE;
+	g_free(gg_msg);
 
 	me = purple_account_get_username(purple_connection_get_account(gc));
 	serv_got_chat_in(gc, chat->local_id, me, flags, message, time(NULL));
diff --git a/libpurple/protocols/gg/message-prpl.c b/libpurple/protocols/gg/message-prpl.c
--- a/libpurple/protocols/gg/message-prpl.c
+++ b/libpurple/protocols/gg/message-prpl.c
@@ -67,8 +67,6 @@ static void ggp_message_got_display(Purp
 	ggp_message_got_data *msg);
 static void ggp_message_format_from_gg(ggp_message_got_data *msg,
 	const gchar *text);
-static gchar * ggp_message_format_to_gg(PurpleConversation *conv,
-	const gchar *text);
 
 /**************/
 
@@ -389,7 +387,7 @@ static void ggp_message_format_from_gg(g
 	msg->text = text_new;
 }
 
-static gchar * ggp_message_format_to_gg(PurpleConversation *conv, const gchar *text)
+gchar * ggp_message_format_to_gg(PurpleConversation *conv, const gchar *text)
 {
 	gchar *text_new, *tmp;
 	GList *rt = NULL; /* reformatted text */
diff --git a/libpurple/protocols/gg/message-prpl.h b/libpurple/protocols/gg/message-prpl.h
--- a/libpurple/protocols/gg/message-prpl.h
+++ b/libpurple/protocols/gg/message-prpl.h
@@ -17,5 +17,6 @@ void ggp_message_got_multilogon(PurpleCo
 
 int ggp_message_send_im(PurpleConnection *gc, const char *who,
 	const char *message, PurpleMessageFlags flags);
+gchar * ggp_message_format_to_gg(PurpleConversation *conv, const gchar *text);
 
 #endif /* _GGP_MESSAGE_PRPL_H */



More information about the Commits mailing list