# HG changeset patch # User Etan Reisner # Date 1156745721 0 # Node ID 4558e71a5a34b21bef4ae89dd236f71739dbf6a4 # Parent 665b814f8fd77c131d473731db127be93a8fefd9 [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 diff -r 665b814f8fd7 -r 4558e71a5a34 libgaim/plugins/tcl/tcl_cmds.c --- 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;