Ignore:
Timestamp:
2010-08-14T16:16:52Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
6ddb223
Parents:
e5854a8
Message:

Responses to add requests work now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/soap.c

    re5854a8 r193dc74  
    517517}
    518518
     519/* Variant: Adding/Removing people */
     520struct msn_soap_memlist_edit_data
     521{
     522        char *handle;
     523        gboolean add;
     524        msn_buddy_flags_t list;
     525};
     526
     527static int msn_soap_memlist_edit_build_request( struct msn_soap_req_data *soap_req )
     528{
     529        struct msn_data *md = soap_req->ic->proto_data;
     530        struct msn_soap_memlist_edit_data *med = soap_req->data;
     531        char *add, *scenario, *list;
     532       
     533        soap_req->url = g_strdup( SOAP_MEMLIST_URL );
     534        if( med->add )
     535        {
     536                soap_req->action = g_strdup( SOAP_MEMLIST_ADD_ACTION );
     537                add = "Add";
     538        }
     539        else
     540        {
     541                soap_req->action = g_strdup( SOAP_MEMLIST_DEL_ACTION );
     542                add = "Delete";
     543        }
     544        switch( med->list )
     545        {
     546        case MSN_BUDDY_AL:
     547                scenario = "BlockUnblock";
     548                list = "Allow";
     549                break;
     550        case MSN_BUDDY_BL:
     551                scenario = "BlockUnblock";
     552                list = "Block";
     553                break;
     554        case MSN_BUDDY_RL:
     555                scenario = "Timer";
     556                list = "Reverse";
     557                break;
     558        case MSN_BUDDY_PL:
     559        default:
     560                scenario = "Timer";
     561                list = "Pending";
     562                break;
     563        }
     564        soap_req->payload = g_markup_printf_escaped( SOAP_MEMLIST_EDIT_PAYLOAD,
     565                scenario, md->tokens[1], add, list, med->handle, add );
     566       
     567        return 1;
     568}
     569
     570static int msn_soap_memlist_edit_handle_response( struct msn_soap_req_data *soap_req )
     571{
     572        return MSN_SOAP_OK;
     573}
     574
     575static int msn_soap_memlist_edit_free_data( struct msn_soap_req_data *soap_req )
     576{
     577        struct msn_soap_memlist_edit_data *med = soap_req->data;
     578       
     579        g_free( med->handle );
     580        g_free( med );
     581       
     582        return 0;
     583}
     584
     585int msn_soap_memlist_edit( struct im_connection *ic, const char *handle, gboolean add, int list )
     586{
     587        struct msn_soap_memlist_edit_data *med;
     588       
     589        med = g_new0( struct msn_soap_memlist_edit_data, 1 );
     590        med->handle = g_strdup( handle );
     591        med->add = add;
     592        med->list = list;
     593       
     594        return msn_soap_start( ic, med, msn_soap_memlist_edit_build_request,
     595                                        NULL,
     596                                        msn_soap_memlist_edit_handle_response,
     597                                        msn_soap_memlist_edit_free_data );
     598}
     599
    519600
    520601/* addressbook: Fetching the membership list (NOT address book) */
Note: See TracChangeset for help on using the changeset viewer.