changeset 11921:8140885c022c

[gaim-migrate @ 14212] sf patch #1341917, from Evan Schoenberg "Allow sending with GaimMsgFlags in conversation.c" committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 31 Oct 2005 04:38:58 +0000
parents 52f27ffe68a5
children 19b46e4e43a0
files src/conversation.c src/conversation.h
diffstat 2 files changed, 45 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Mon Oct 31 04:27:06 2005 +0000
+++ b/src/conversation.c	Mon Oct 31 04:38:58 2005 +0000
@@ -85,7 +85,7 @@
 }
 
 static void
-common_send(GaimConversation *conv, const char *message)
+common_send(GaimConversation *conv, const char *message, GaimMessageFlags msgflags)
 {
 	GaimConversationType type;
 	GaimAccount *account;
@@ -107,8 +107,11 @@
 	type = gaim_conversation_get_type(conv);
 	ops  = gaim_conversation_get_ui_ops(conv);
 
-	if (conv->features & GAIM_CONNECTION_HTML)
+	if ((conv->features & GAIM_CONNECTION_HTML) &&
+		!(msgflags & GAIM_MESSAGE_RAW))
+	{
 		displayed = gaim_markup_linkify(message);
+	}
 	else
 		displayed = g_strdup(message);
 
@@ -155,15 +158,20 @@
 						 gaim_conversation_get_name(conv), &sent);
 
 		if (sent != NULL && sent[0] != '\0') {
-			GaimMessageFlags msgflags = GAIM_MESSAGE_SEND;
+			GaimConvImFlags imflags = 0;
+
+			msgflags |= GAIM_MESSAGE_SEND;
+
+			if (msgflags & GAIM_MESSAGE_AUTO_RESP)
+				imflags |= GAIM_CONV_IM_AUTO_RESP;
 
 			if (conv->features & GAIM_CONNECTION_HTML) {
 				err = serv_send_im(gc, gaim_conversation_get_name(conv),
-				                   sent, 0);
+				                   sent, imflags);
 			} else {
 				gchar *tmp = gaim_unescape_html(sent);
 				err = serv_send_im(gc, gaim_conversation_get_name(conv),
-				                   tmp, 0);
+				                   tmp, imflags);
 				g_free(tmp);
 			}
 
@@ -1147,10 +1155,16 @@
 void
 gaim_conv_im_send(GaimConvIm *im, const char *message)
 {
+	gaim_conv_im_send_with_flags(im, message, 0);
+}
+
+void
+gaim_conv_im_send_with_flags(GaimConvIm *im, const char *message, GaimMessageFlags flags)
+{
 	g_return_if_fail(im != NULL);
 	g_return_if_fail(message != NULL);
 
-	common_send(gaim_conv_im_get_conversation(im), message);
+	common_send(gaim_conv_im_get_conversation(im), message, flags);
 }
 
 gboolean
@@ -1412,10 +1426,16 @@
 void
 gaim_conv_chat_send(GaimConvChat *chat, const char *message)
 {
+	gaim_conv_chat_send_with_flags(chat, message, 0);
+}
+
+void
+gaim_conv_chat_send_with_flags(GaimConvChat *chat, const char *message, GaimMessageFlags flags)
+{
 	g_return_if_fail(chat != NULL);
 	g_return_if_fail(message != NULL);
 
-	common_send(gaim_conv_chat_get_conversation(chat), message);
+	common_send(gaim_conv_chat_get_conversation(chat), message, flags);
 }
 
 void
--- a/src/conversation.h	Mon Oct 31 04:27:06 2005 +0000
+++ b/src/conversation.h	Mon Oct 31 04:38:58 2005 +0000
@@ -747,6 +747,15 @@
 void gaim_conv_im_send(GaimConvIm *im, const char *message);
 
 /**
+ * Sends a message to this IM conversation with specified flags.
+ *
+ * @param im      The IM.
+ * @param message The message to send.
+ * @param flags   The GaimMessageFlags flags to use in addition to GAIM_MESSAGE_SEND.
+ */
+void gaim_conv_im_send_with_flags(GaimConvIm *im, const char *message, GaimMessageFlags flags);
+
+/**
  * Adds a smiley to the conversation's smiley tree. If this returns
  * @c TRUE you should call gaim_conv_custom_smiley_write() one or more
  * times, and then gaim_conv_custom_smiley_close(). If this returns
@@ -954,6 +963,15 @@
 void gaim_conv_chat_send(GaimConvChat *chat, const char *message);
 
 /**
+ * Sends a message to this chat conversation with specified flags.
+ *
+ * @param chat    The chat.
+ * @param message The message to send.
+ * @param flags   The GaimMessageFlags flags to use.
+ */
+void gaim_conv_chat_send_with_flags(GaimConvChat *chat, const char *message, GaimMessageFlags flags);
+
+/**
  * Adds a user to a chat.
  *
  * @param chat        The chat.