Changeset d0527c1


Ignore:
Timestamp:
2010-07-17T11:34:24Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
a08e875
Parents:
177ffd7
Message:

libpurple: Handle incoming authorization requests.

Location:
protocols
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • protocols/nogaim.c

    r177ffd7 rd0527c1  
    381381{
    382382        query_add( (irc_t *) ic->bee->ui_data, ic, msg, doit, dont, g_free, data );
     383}
     384
     385void imcb_ask_with_free( struct im_connection *ic, char *msg, void *data,
     386                         query_callback doit, query_callback dont, query_callback myfree )
     387{
     388        query_add( (irc_t *) ic->bee->ui_data, ic, msg, doit, dont, myfree, data );
    383389}
    384390
  • protocols/nogaim.h

    r177ffd7 rd0527c1  
    269269 */
    270270G_MODULE_EXPORT void imcb_ask( struct im_connection *ic, char *msg, void *data, query_callback doit, query_callback dont );
     271G_MODULE_EXPORT void imcb_ask_with_free( struct im_connection *ic, char *msg, void *data, query_callback doit, query_callback dont, query_callback myfree );
    271272
    272273/* Two common questions you may want to ask:
  • protocols/purple/purple.c

    r177ffd7 rd0527c1  
    884884}
    885885
     886/*
    886887static void prplcb_request_test()
    887888{
    888889        fprintf( stderr, "bla\n" );
    889890}
     891*/
    890892
    891893static PurpleRequestUiOps bee_request_uiops =
    892894{
    893         prplcb_request_test,
    894         prplcb_request_test,
     895        NULL,
     896        NULL,
    895897        prplcb_request_action,
    896         prplcb_request_test,
    897         prplcb_request_test,
    898         prplcb_request_test,
    899         prplcb_request_test,
     898        NULL,
     899        NULL,
     900        NULL,
     901        NULL,
    900902};
    901903
     
    10481050};
    10491051
     1052static void *prplcb_account_request_authorize( PurpleAccount *account, const char *remote_user,
     1053        const char *id, const char *alias, const char *message, gboolean on_list,
     1054        PurpleAccountRequestAuthorizationCb authorize_cb, PurpleAccountRequestAuthorizationCb deny_cb, void *user_data )
     1055{
     1056        struct im_connection *ic = purple_ic_by_pa( account );
     1057        char *q;
     1058       
     1059        if( alias )
     1060                q = g_strdup_printf( "%s (%s) wants to add you to his/her contact "
     1061                                     "list. (%s)", alias, remote_user, message );
     1062        else
     1063                q = g_strdup_printf( "%s wants to add you to his/her contact "
     1064                                     "list. (%s)", remote_user, message );
     1065       
     1066        imcb_ask_with_free( ic, q, user_data, authorize_cb, deny_cb, NULL );
     1067        g_free( q );
     1068}
     1069
     1070static PurpleAccountUiOps bee_account_uiops =
     1071{
     1072        NULL,
     1073        NULL,
     1074        NULL,
     1075        prplcb_account_request_authorize,
     1076        NULL,
     1077};
     1078
    10501079extern PurpleXferUiOps bee_xfer_uiops;
    10511080
    10521081static void purple_ui_init()
    10531082{
     1083        purple_connections_set_ui_ops( &bee_conn_uiops );
    10541084        purple_blist_set_ui_ops( &bee_blist_uiops );
    1055         purple_connections_set_ui_ops( &bee_conn_uiops );
    10561085        purple_conversations_set_ui_ops( &bee_conv_uiops );
    10571086        purple_request_set_ui_ops( &bee_request_uiops );
     1087        purple_privacy_set_ui_ops( &bee_privacy_uiops );
    10581088        purple_notify_set_ui_ops( &bee_notify_uiops );
     1089        purple_accounts_set_ui_ops( &bee_account_uiops );
    10591090        purple_xfers_set_ui_ops( &bee_xfer_uiops );
    1060         purple_privacy_set_ui_ops( &bee_privacy_uiops );
    10611091       
    10621092        if( getenv( "BITLBEE_DEBUG" ) )
     
    10771107        }
    10781108       
    1079         purple_util_set_user_dir("/tmp");
    1080         purple_debug_set_enabled(FALSE);
    1081         purple_core_set_ui_ops(&bee_core_uiops);
    1082         purple_eventloop_set_ui_ops(&glib_eventloops);
     1109        purple_util_set_user_dir( "/tmp" );
     1110        purple_debug_set_enabled( FALSE );
     1111        purple_core_set_ui_ops( &bee_core_uiops );
     1112        purple_eventloop_set_ui_ops( &glib_eventloops );
    10831113        if( !purple_core_init( "BitlBee") )
    10841114        {
     
    10891119       
    10901120        /* This seems like stateful shit we don't want... */
    1091         purple_set_blist(purple_blist_new());
     1121        purple_set_blist( purple_blist_new() );
    10921122        purple_blist_load();
    10931123       
     
    11201150        funcs.transfer_request = purple_transfer_request;
    11211151       
    1122         help = g_string_new("BitlBee libpurple module supports the following IM protocols:\n");
     1152        help = g_string_new( "BitlBee libpurple module supports the following IM protocols:\n" );
    11231153       
    11241154        /* Add a protocol entry to BitlBee's structures for every protocol
Note: See TracChangeset for help on using the changeset viewer.