changeset 14363:4558e71a5a34

[gaim-migrate @ 17069] Add ::gaim::conversation send. tcl already had ::gaim::send_im but that didn't use an existing conversation and didn't print it into the conversation window, this does both of those. committer: Tailor Script <tailor@pidgin.im>
author Etan Reisner <pidgin@unreliablesource.net>
date Mon, 28 Aug 2006 06:15:21 +0000
parents 665b814f8fd7
children 338ac096e322
files libgaim/plugins/tcl/tcl_cmds.c
diffstat 1 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/plugins/tcl/tcl_cmds.c	Mon Aug 28 05:39:42 2006 +0000
+++ b/libgaim/plugins/tcl/tcl_cmds.c	Mon Aug 28 06:15:21 2006 +0000
@@ -670,8 +670,8 @@
 int tcl_cmd_conversation(ClientData unused, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[])
 {
 	Tcl_Obj *list, *elem, *result = Tcl_GetObjResult(interp);
-	const char *cmds[] = { "find", "handle", "list", "new", "write", "name", "title", NULL };
-	enum { CMD_CONV_FIND, CMD_CONV_HANDLE, CMD_CONV_LIST, CMD_CONV_NEW, CMD_CONV_WRITE , CMD_CONV_NAME, CMD_CONV_TITLE } cmd;
+	const char *cmds[] = { "find", "handle", "list", "new", "write", "name", "title", "send", NULL };
+	enum { CMD_CONV_FIND, CMD_CONV_HANDLE, CMD_CONV_LIST, CMD_CONV_NEW, CMD_CONV_WRITE , CMD_CONV_NAME, CMD_CONV_TITLE, CMD_CONV_SEND } cmd;
 	const char *styles[] = { "send", "recv", "system", NULL };
 	enum { CMD_CONV_WRITE_SEND, CMD_CONV_WRITE_RECV, CMD_CONV_WRITE_SYSTEM } style;
 	const char *newopts[] = { "-chat", "-im" };
@@ -803,6 +803,19 @@
 			return TCL_ERROR;
 		Tcl_SetStringObj(result, (char *)gaim_conversation_get_title(convo), -1);
 		break;
+	case CMD_CONV_SEND:
+		if (objc != 4) {
+			Tcl_WrongNumArgs(interp, 2, objv, "conversation message");
+			return TCL_ERROR;
+		}
+		if ((convo = tcl_validate_conversation(objv[2], interp)) == NULL)
+			return TCL_ERROR;
+		what = Tcl_GetString(objv[3]);
+		if (gaim_conversation_get_type(convo) == GAIM_CONV_TYPE_CHAT)
+			gaim_conv_chat_send(GAIM_CONV_CHAT(convo), what);
+		else
+			gaim_conv_im_send(GAIM_CONV_IM(convo), what);
+		break;
 	}
 
 	return TCL_OK;