diff libgaim/conversation.c @ 14520:82b59abcaee4

[gaim-migrate @ 17240] SF Patch #1492561 from Lars T. Mikkelsen "This patch adds gaim-url-handler, a URL handler for most protocols in Gaim. The gaim-url-handler is similar to (and based on) gaim-remote, however, it uses the native URL format of each protocol. Furthermore, the patch includes a GConf schema, which allows Gnome applications to use the URL handler." With this and gaim-send/gaim-send-async, we should be able to drop gaim-remote. Please let me know if you object, or I'll remove gaim-remote shortly. For the record, I know this doesn't support 100% of the ChatZilla IRC URL spec, and I haven't investigated the XMPP URL spec beyond a casual first look. We can tweak these things later -- I figured it was important to get the bulk of the code in place. committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Mon, 11 Sep 2006 02:30:59 +0000
parents 60b1bc8dbf37
children a6aad36ca735
line wrap: on
line diff
--- a/libgaim/conversation.c	Mon Sep 11 02:02:18 2006 +0000
+++ b/libgaim/conversation.c	Mon Sep 11 02:30:59 2006 +0000
@@ -28,6 +28,7 @@
 #include "notify.h"
 #include "prefs.h"
 #include "prpl.h"
+#include "request.h"
 #include "signals.h"
 #include "util.h"
 
@@ -338,6 +339,8 @@
 
 	g_return_if_fail(conv != NULL);
 
+	gaim_request_close_with_handle(conv);
+
 	ops  = gaim_conversation_get_ui_ops(conv);
 	gc   = gaim_conversation_get_gc(conv);
 	name = gaim_conversation_get_name(conv);
@@ -1126,6 +1129,41 @@
 	gaim_conv_im_send_with_flags(im, message, 0);
 }
 
+static void
+gaim_conv_send_confirm_cb(gpointer *data)
+{
+	GaimConversation *conv = data[0];
+	char *message = data[1];
+
+	g_free(data);
+	common_send(conv, message, 0);
+}
+
+void
+gaim_conv_send_confirm(GaimConversation *conv, const char *message)
+{
+	char *text;
+	gpointer *data;
+
+	g_return_if_fail(conv != NULL);
+	g_return_if_fail(message != NULL);
+
+	if (conv->ui_ops != NULL && conv->ui_ops->send_confirm != NULL)
+	{
+		conv->ui_ops->send_confirm(conv, message);
+		return;
+	}
+
+	text = g_strdup_printf("You are about to send the following message:\n%s", message);
+	data = g_new0(gpointer, 2);
+	data[0] = conv;
+	data[1] = (gpointer)message;
+
+	gaim_request_action(conv, NULL, _("Send Message"), text, 0, data, 2,
+	                    _("_Send Message"), G_CALLBACK(gaim_conv_send_confirm_cb),
+	                    _("Cancel"), NULL);
+}
+
 void
 gaim_conv_im_send_with_flags(GaimConvIm *im, const char *message, GaimMessageFlags flags)
 {