# HG changeset patch # User Sadrul Habib Chowdhury # Date 1179974423 0 # Node ID 2f50c067b67b757c9714ee1fefe07358b01cd0f5 # Parent 686f62f538d4eea8878f9deb15e70cacc3142744# Parent 8d3c28521112dda48a847341c913203e5bbb0479 merge of '7bec6f145cd4aba859bf2e7dfc1034f68514b89b' and 'c2538d8e9eb15a53f1093acad3966222ada77f12' diff -r 686f62f538d4 -r 2f50c067b67b ChangeLog.API --- a/ChangeLog.API Thu May 24 01:21:19 2007 +0000 +++ b/ChangeLog.API Thu May 24 02:40:23 2007 +0000 @@ -1,5 +1,13 @@ Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul +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" + version 2.0.0 (5/3/2007): Please note all functions, defines, and data structures have been re-namespaced to match the new names of Pidgin, Finch, and libpurple. diff -r 686f62f538d4 -r 2f50c067b67b doc/conversation-signals.dox --- a/doc/conversation-signals.dox Thu May 24 01:21:19 2007 +0000 +++ b/doc/conversation-signals.dox Thu May 24 02:40:23 2007 +0000 @@ -29,6 +29,7 @@ @signal chat-joined @signal chat-left @signal chat-topic-changed + @signal conversation-extended-menu @endsignals @signaldef writing-im-msg @@ -417,5 +418,15 @@ @param topic The new topic. @endsignaldef + @signaldef conversation-extended-menu + @signalproto +void (*conversation_extended_menu)(PurpleConversation *conv, GList **list); + @endsignalproto + @signaldesc + Emitted when the UI requests a list of plugin actions for a + conversation. + @param conv The conversation. + @param list A pointer to the list of actions. + @endsignaldef */ // vim: syntax=c tw=75 et diff -r 686f62f538d4 -r 2f50c067b67b finch/libgnt/gntmain.c --- a/finch/libgnt/gntmain.c Thu May 24 01:21:19 2007 +0000 +++ b/finch/libgnt/gntmain.c Thu May 24 02:40:23 2007 +0000 @@ -359,8 +359,7 @@ switch (sig) { #ifdef SIGWINCH case SIGWINCH: - werase(stdscr); - wrefresh(stdscr); + erase(); g_idle_add(refresh_screen, NULL); org_winch_handler(sig); signal(SIGWINCH, sighandler); diff -r 686f62f538d4 -r 2f50c067b67b finch/libgnt/gntwm.c --- a/finch/libgnt/gntwm.c Thu May 24 01:21:19 2007 +0000 +++ b/finch/libgnt/gntwm.c Thu May 24 02:40:23 2007 +0000 @@ -980,12 +980,11 @@ GntWM *wm = GNT_WM(bindable); endwin(); - refresh(); - curs_set(0); /* endwin resets the cursor to normal */ g_hash_table_foreach(wm->nodes, (GHFunc)refresh_node, NULL); update_screen(wm); draw_taskbar(wm, TRUE); + curs_set(0); /* endwin resets the cursor to normal */ return FALSE; } diff -r 686f62f538d4 -r 2f50c067b67b libpurple/conversation.c --- a/libpurple/conversation.c Thu May 24 01:21:19 2007 +0000 +++ b/libpurple/conversation.c Thu May 24 02:40:23 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" @@ -1989,6 +1990,29 @@ return cb->name; } +GList * +purple_conversation_get_extended_menu(PurpleConversation *conv) +{ + GList *menu = NULL; + + g_return_val_if_fail(conv != NULL, NULL); + + purple_signal_emit(purple_conversations_get_handle(), + "conversation-extended-menu", conv, &menu); + 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); + g_free(err); + return (status == PURPLE_CMD_STATUS_OK); +} + void * purple_conversations_get_handle(void) { @@ -2252,6 +2276,12 @@ PURPLE_SUBTYPE_CONVERSATION), purple_value_new(PURPLE_TYPE_STRING), purple_value_new(PURPLE_TYPE_STRING)); + + purple_signal_register(handle, "conversation-extended-menu", + purple_marshal_VOID__POINTER_POINTER, NULL, 2, + purple_value_new(PURPLE_TYPE_SUBTYPE, + PURPLE_SUBTYPE_CONVERSATION), + purple_value_new(PURPLE_TYPE_BOXED, "GList **")); } void diff -r 686f62f538d4 -r 2f50c067b67b libpurple/conversation.h --- a/libpurple/conversation.h Thu May 24 01:21:19 2007 +0000 +++ b/libpurple/conversation.h Thu May 24 02:40:23 2007 +0000 @@ -1190,6 +1190,30 @@ */ void purple_conv_chat_cb_destroy(PurpleConvChatBuddy *cb); +/** + * Retrieves the extended menu items for the conversation. + * + * @param conv The conversation. + * + * @return A list of PurpleMenuAction items, harvested by the + * chat-extended-menu signal. The list and the menuaction + * items should be freed by the caller. + */ +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); + /*@}*/ /**************************************************************************/ diff -r 686f62f538d4 -r 2f50c067b67b libpurple/plugins/perl/common/Account.xs --- a/libpurple/plugins/perl/common/Account.xs Thu May 24 01:21:19 2007 +0000 +++ b/libpurple/plugins/perl/common/Account.xs Thu May 24 02:40:23 2007 +0000 @@ -215,6 +215,7 @@ t_GL = g_list_append(t_GL, SvPV(*av_fetch((AV *)SvRV(list), i, 0), t_sl)); } purple_account_add_buddies(account, t_GL); + g_list_free(t_GL); void purple_account_add_buddy(account, buddy) @@ -252,6 +253,8 @@ t_GL2 = g_list_append(t_GL2, SvPV(*av_fetch((AV *)SvRV(B), i, 0), t_sl)); } purple_account_remove_buddies(account, t_GL1, t_GL2); + g_list_free(t_GL1); + g_list_free(t_GL2); void purple_account_remove_buddy(account, buddy, group) diff -r 686f62f538d4 -r 2f50c067b67b libpurple/plugins/perl/common/BuddyList.xs --- a/libpurple/plugins/perl/common/BuddyList.xs Thu May 24 01:21:19 2007 +0000 +++ b/libpurple/plugins/perl/common/BuddyList.xs Thu May 24 02:40:23 2007 +0000 @@ -263,7 +263,7 @@ PREINIT: GList *l; PPCODE: - for (l = purple_blist_node_get_extended_menu(node); l != NULL; l = l->next) { + for (l = purple_blist_node_get_extended_menu(node); l != NULL; l = g_list_delete_link(l, l)) { XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::Menu::Action"))); } diff -r 686f62f538d4 -r 2f50c067b67b libpurple/plugins/perl/common/Conversation.xs --- a/libpurple/plugins/perl/common/Conversation.xs Thu May 24 01:21:19 2007 +0000 +++ b/libpurple/plugins/perl/common/Conversation.xs Thu May 24 02:40:23 2007 +0000 @@ -218,6 +218,21 @@ Purple::Conversation conv Purple::Account account +void +purple_conversation_write(conv, who, message, flags, mtime) + Purple::Conversation conv + const char *who + const char *message + Purple::MessageFlags flags + time_t mtime + +gboolean +purple_conversation_do_command(conv, cmdline, markup, error) + Purple::Conversation conv + const char *cmdline + const char *markup + char **error + MODULE = Purple::Conversation PACKAGE = Purple::Conversation::IM PREFIX = purple_conv_im_ PROTOTYPES: ENABLE diff -r 686f62f538d4 -r 2f50c067b67b libpurple/plugins/perl/common/Prefs.xs --- a/libpurple/plugins/perl/common/Prefs.xs Thu May 24 01:21:19 2007 +0000 +++ b/libpurple/plugins/perl/common/Prefs.xs Thu May 24 02:40:23 2007 +0000 @@ -94,8 +94,9 @@ PREINIT: GList *l; PPCODE: - for (l = purple_prefs_get_string_list(name); l != NULL; l = l->next) { - XPUSHs(sv_2mortal(purple_perl_bless_object(l->data, "Purple::PrefValue"))); + for (l = purple_prefs_get_string_list(name); l != NULL; l = g_list_delete_link(l, l)) { + XPUSHs(sv_2mortal(newSVpv(l->data, 0))); + g_free(l->data); } Purple::PrefType