# HG changeset patch # User Sadrul Habib Chowdhury # Date 1179813822 0 # Node ID c9a046a7f3267e463f05adb4a6f2f3578860a96c # Parent da2bab3b9fabf5da325e18d3fef2732b8f84d9f6 New function purple_conversation_do_command. This is almost like purple_cmd_do_command, except it allows NULL for markup and error, and it's properly namespaced. diff -r da2bab3b9fab -r c9a046a7f326 ChangeLog.API --- a/ChangeLog.API Tue May 22 03:28:12 2007 +0000 +++ b/ChangeLog.API Tue May 22 06:03:42 2007 +0000 @@ -3,6 +3,7 @@ version 2.1.0 (?/?/?): Added: * purple_conversation_get_extended_menu + * purple_conversation_do_command Signals - Added: (See the Doxygen docs for details on all signals.) * "conversation-extended-menu" diff -r da2bab3b9fab -r c9a046a7f326 libpurple/conversation.c --- a/libpurple/conversation.c Tue May 22 03:28:12 2007 +0000 +++ b/libpurple/conversation.c Tue May 22 06:03:42 2007 +0000 @@ -21,6 +21,7 @@ */ #include "internal.h" #include "blist.h" +#include "cmds.h" #include "conversation.h" #include "dbus-maybe.h" #include "debug.h" @@ -2001,6 +2002,15 @@ return menu; } +gboolean +purple_conversation_do_command(PurpleConversation *conv, const gchar *cmdline, + const gchar *markup, gchar **error) +{ + char *mark = (markup && *markup) ? NULL : g_markup_escape_text(cmdline, -1), *err = NULL; + PurpleCmdStatus status = purple_cmd_do_command(conv, cmdline, mark ? mark : markup, error ? error : &err); + g_free(mark); + return (status == PURPLE_CMD_STATUS_OK); +} void * purple_conversations_get_handle(void) diff -r da2bab3b9fab -r c9a046a7f326 libpurple/conversation.h --- a/libpurple/conversation.h Tue May 22 03:28:12 2007 +0000 +++ b/libpurple/conversation.h Tue May 22 06:03:42 2007 +0000 @@ -1201,6 +1201,19 @@ */ GList * purple_conversation_get_extended_menu(PurpleConversation *conv); +/** + * Perform a command in a conversation. Similar to @see purple_cmd_do_command + * + * @param conv The conversation. + * @param cmdline The entire command including the arguments. + * @param markup @c NULL, or the formatted command line. + * @param error If the command failed errormsg is filled in with the appropriate error + * message, if not @c NULL. It must be freed by the caller with g_free(). + * + * @return @c TRUE if the command was executed successfully, @c FALSE otherwise. + */ +gboolean purple_conversation_do_command(PurpleConversation *conv, const gchar *cmdline, const gchar *markup, gchar **error); + /*@}*/ /**************************************************************************/