Mercurial > pidgin.yaz
changeset 11800:32bac0647037
[gaim-migrate @ 14091]
Patch from Peter Lawler that adds a blist menu option for the whiteboard/doodle feature and also cleaned up the call of the whiteboard, so it's a little more generic. With a tweak from me.
committer: Tailor Script <tailor@pidgin.im>
author | Gary Kramlich <grim@reaperworld.com> |
---|---|
date | Mon, 24 Oct 2005 20:56:12 +0000 |
parents | a3c28707ef4d |
children | 81806e9241be |
files | src/protocols/yahoo/yahoo.c src/protocols/yahoo/yahoo_doodle.c src/protocols/yahoo/yahoo_doodle.h |
diffstat | 3 files changed, 45 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/yahoo/yahoo.c Mon Oct 24 20:33:06 2005 +0000 +++ b/src/protocols/yahoo/yahoo.c Mon Oct 24 20:56:12 2005 +0000 @@ -709,6 +709,10 @@ // Check for the Doodle IMV if( !strcmp( imv, "doodle;11" ) ) { + if (!yahoo_privacy_check(gc, im->from)) { + gaim_debug_info("yahoo", "Doodle request from %s dropped.\n", im->from); + return; + } GaimWhiteboard *wb; g_print( "'doodle;11' found in chat packet\n" ); @@ -2858,6 +2862,14 @@ return m; } +static void yahoo_doodle_blist_node(GaimBlistNode *node, gpointer data) +{ + GaimBuddy *b = (GaimBuddy *)node; + GaimConnection *gc = b->account->gc; + + yahoo_doodle_initiate(gc, b->name); +} + static GList *yahoo_buddy_menu(GaimBuddy *buddy) { GList *m = NULL; @@ -2916,6 +2928,12 @@ m = g_list_append(m, act); } + if (f) { + act = gaim_blist_node_action_new(_("Start Doodling"), + yahoo_doodle_blist_node, NULL, NULL); + m = g_list_append(m, act); + } + return m; }
--- a/src/protocols/yahoo/yahoo_doodle.c Mon Oct 24 20:33:06 2005 +0000 +++ b/src/protocols/yahoo/yahoo_doodle.c Mon Oct 24 20:56:12 2005 +0000 @@ -77,19 +77,38 @@ { GaimAccount *account; GaimConnection *gc; - char *to; - GaimWhiteboard *wb; + const gchar *name; if( *args && args[0] ) return( GAIM_CMD_RET_FAILED ); account = gaim_conversation_get_account( conv ); gc = gaim_account_get_connection( account ); - to = ( char* )( gaim_conversation_get_name( conv ) ); - wb = gaim_whiteboard_get_session( account, to ); + name = gaim_conversation_get_name(conv); + yahoo_doodle_initiate(gc, name); + + // Write a local message to this conversation showing that + // a request for a Doodle session has been made + gaim_conv_im_write( GAIM_CONV_IM( conv ), "", _("Sent Doodle request."), + GAIM_MESSAGE_NICK | GAIM_MESSAGE_RECV, time( NULL ) ); - // NOTE Functionalize this code? - + return( GAIM_CMD_RET_OK ); +} + +// ------------------------------------------------------------------------------------------------------ + +void yahoo_doodle_initiate(GaimConnection *gc, const char *name) +{ + GaimAccount *account; + char *to; + GaimWhiteboard *wb; + g_return_if_fail(gc); + g_return_if_fail(name); + + account = gaim_connection_get_account( gc ); + to = (char* )name; + wb = gaim_whiteboard_get_session( account, to ); + if( wb == NULL ) { // Insert this 'session' in the list. At this point, it's only a requested session. @@ -100,13 +119,7 @@ yahoo_doodle_command_send_request( gc, to ); yahoo_doodle_command_send_ready( gc, to ); - - // Write a local message to this conversation showing that - // a request for a Doodle session has been made - gaim_conv_im_write( GAIM_CONV_IM( conv ), "", _("Sent Doodle request."), - GAIM_MESSAGE_NICK | GAIM_MESSAGE_RECV, time( NULL ) ); - - return( GAIM_CMD_RET_OK ); + } // ------------------------------------------------------------------------------------------------------ @@ -754,4 +767,3 @@ } // ------------------------------------------------------------------------------------------------------ -
--- a/src/protocols/yahoo/yahoo_doodle.h Mon Oct 24 20:33:06 2005 +0000 +++ b/src/protocols/yahoo/yahoo_doodle.h Mon Oct 24 20:56:12 2005 +0000 @@ -94,6 +94,7 @@ char **error, void *data ); void yahoo_doodle_process( GaimConnection *gc, char *me, char *from, char *command, char *message ); +void yahoo_doodle_initiate( GaimConnection *gc, const char *to); void yahoo_doodle_command_got_request( GaimConnection *gc, char *from ); void yahoo_doodle_command_got_ready( GaimConnection *gc, char *from );