changeset 9167:10bdd25f367f

[gaim-migrate @ 9952] This adds a /me command, which just sends its argument with /me prepended. Certain protocols have their own /me commands registered, which take priorty over this /me command. There's still two problems. 1. W and S aren't implemented yet, so /me's and anything else using W or S behave as though w or s were used. I.e. /me sends with no formatting. 2. Commands aren't added to the ctrl-up send_history. They should be. We also still need /help. And the bad command error messages like "Syntax Error" need to be made more clear. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Wed, 02 Jun 2004 05:38:56 +0000
parents 1e51236d825e
children 1a446f2a1822
files src/gtkconv.c
diffstat 1 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkconv.c	Wed Jun 02 05:08:49 2004 +0000
+++ b/src/gtkconv.c	Wed Jun 02 05:38:56 2004 +0000
@@ -342,6 +342,23 @@
 	return "/";
 }
 
+static GaimCmdRet
+me_command_cb(GaimConversation *conv,
+              const char *cmd, char **args, char **error)
+{
+	char *tmp;
+
+	tmp = g_strdup_printf("/me %s", args[0]);
+	
+	if (gaim_conversation_get_type(conv) == GAIM_CONV_IM)
+		gaim_conv_im_send(GAIM_CONV_IM(conv), tmp);
+	else if (gaim_conversation_get_type(conv) == GAIM_CONV_CHAT)
+		gaim_conv_chat_send(GAIM_CONV_CHAT(conv), tmp);
+
+	g_free(tmp);
+	return GAIM_CMD_RET_OK;
+}
+
 static void
 send_cb(GtkWidget *widget, GaimConversation *conv)
 {
@@ -5938,6 +5955,14 @@
 	                                    GAIM_SUBTYPE_CONV_WINDOW),
 	                     gaim_value_new(GAIM_TYPE_SUBTYPE,
 	                                    GAIM_SUBTYPE_CONV_WINDOW));
+
+	/**********************************************************************
+	 * Register commands
+	 **********************************************************************/
+	 gaim_cmd_register("me", "S", GAIM_CMD_P_DEFAULT,
+                        GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL,
+                        me_command_cb, _("Send an IRC style action to a buddy or chat."));
+
 }
 
 void