Changeset 437bd9b for protocols


Ignore:
Timestamp:
2010-03-21T21:38:42Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
c735200
Parents:
0cb71a6
Message:

Enough code to make an incoming transfer show up properly and accept it.
Not enough yet to handle the incoming data.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/purple/purple.c

    r0cb71a6 r437bd9b  
    581581                fn = va_arg( actions, void* );
    582582               
    583                 if( strcmp( caption, "Accept" ) == 0 )
     583                if( strstr( caption, "Accept" ) )
    584584                {
    585585                        pqad->yes = fn;
    586586                        pqad->yes_i = i;
    587587                }
    588                 else if( strcmp( caption, "Reject" ) == 0 )
     588                else if( strstr( caption, "Reject" ) || strstr( caption, "Cancel" ) )
    589589                {
    590590                        pqad->no = fn;
     
    659659}
    660660
    661 static  PurpleNotifyUiOps bee_notify_uiops =
     661static PurpleNotifyUiOps bee_notify_uiops =
    662662{
    663663        NULL,
    664664        prplcb_notify_email,
     665};
     666
     667static void prplcb_xfer( PurpleXfer *xfer )
     668{
     669        fprintf( stderr, "ft bla: 0x%p\n", xfer );
     670}
     671
     672static void prpl_xfer_accept( struct file_transfer *ft )
     673{
     674        purple_xfer_request_accepted( ft->data, NULL );
     675        purple_xfer_ui_ready( ft->data );
     676}
     677
     678static void prpl_xfer_reject( struct file_transfer *ft )
     679{
     680        purple_xfer_request_denied( ft->data );
     681}
     682
     683static gboolean prplcb_xfer_new_cb( gpointer data, gint fd, b_input_condition cond )
     684{
     685        PurpleXfer *xfer = data;
     686        struct im_connection *ic = purple_ic_by_pa( xfer->account );
     687        file_transfer_t *ft;
     688       
     689        ft = imcb_file_send_start( ic, xfer->who, xfer->filename, xfer->size );
     690        ft->data = xfer;
     691        xfer->ui_data = ft;
     692       
     693        ft->accept = prpl_xfer_accept;
     694       
     695        return FALSE;
     696}
     697
     698static void prplcb_xfer_new( PurpleXfer *xfer )
     699{
     700        purple_xfer_set_local_filename( xfer, "/tmp/wtf123" );
     701       
     702        fprintf( stderr, "ft_new bla: 0x%p\n", xfer );
     703       
     704        b_timeout_add( 0, prplcb_xfer_new_cb, xfer );
     705}
     706
     707static PurpleXferUiOps bee_xfer_uiops =
     708{
     709        prplcb_xfer_new,
     710        prplcb_xfer,
     711        prplcb_xfer,
     712        prplcb_xfer,
     713        prplcb_xfer,
     714        prplcb_xfer,
     715        prplcb_xfer,
     716        prplcb_xfer,
     717        prplcb_xfer,
     718        prplcb_xfer,
    665719};
    666720
     
    671725        purple_conversations_set_ui_ops( &bee_conv_uiops );
    672726        purple_request_set_ui_ops( &bee_request_uiops );
    673         purple_notify_set_ui_ops(&bee_notify_uiops);
    674         //purple_debug_set_ui_ops( &bee_debug_uiops );
     727        purple_notify_set_ui_ops( &bee_notify_uiops );
     728        purple_xfers_set_ui_ops( &bee_xfer_uiops );
     729        purple_debug_set_ui_ops( &bee_debug_uiops );
    675730}
    676731
Note: See TracChangeset for help on using the changeset viewer.