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

Add/Remove support.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/msn/soap.c

    r6ddb223 r4fc95c5  
    750750                               msn_soap_ab_namechange_free_data );
    751751}
     752
     753/* Add a contact. */
     754static int msn_soap_ab_contact_add_build_request( struct msn_soap_req_data *soap_req )
     755{
     756        struct msn_data *md = soap_req->ic->proto_data;
     757        bee_user_t *bu = soap_req->data;
     758       
     759        soap_req->url = g_strdup( SOAP_ADDRESSBOOK_URL );
     760        soap_req->action = g_strdup( SOAP_AB_CONTACT_ADD_ACTION );
     761        soap_req->payload = msn_soap_abservice_build( SOAP_AB_CONTACT_ADD_PAYLOAD,
     762                "ContactSave", md->tokens[1], bu->handle, bu->fullname ? bu->fullname : bu->handle );
     763       
     764        return 1;
     765}
     766
     767static xt_status msn_soap_ab_contact_add_cid( struct xt_node *node, gpointer data )
     768{
     769        struct msn_soap_req_data *soap_req = data;
     770        bee_user_t *bu = soap_req->data;
     771        struct msn_buddy_data *bd = bu->data;
     772       
     773        g_free( bd->cid );
     774        bd->cid = g_strdup( node->text );
     775       
     776        return XT_HANDLED;
     777}
     778
     779static const struct xt_handler_entry msn_soap_ab_contact_add_parser[] = {
     780        { "guid", "ABContactAddResult", msn_soap_ab_contact_add_cid },
     781        { NULL,               NULL,     NULL                        }
     782};
     783
     784static int msn_soap_ab_contact_add_handle_response( struct msn_soap_req_data *soap_req )
     785{
     786        /* TODO: Ack the change? Not sure what the NAKs look like.. */
     787        return MSN_SOAP_OK;
     788}
     789
     790static int msn_soap_ab_contact_add_free_data( struct msn_soap_req_data *soap_req )
     791{
     792        return 0;
     793}
     794
     795int msn_soap_ab_contact_add( struct im_connection *ic, bee_user_t *bu )
     796{
     797        return msn_soap_start( ic, bu,
     798                               msn_soap_ab_contact_add_build_request,
     799                               msn_soap_ab_contact_add_parser,
     800                               msn_soap_ab_contact_add_handle_response,
     801                               msn_soap_ab_contact_add_free_data );
     802}
     803
     804/* Remove a contact. */
     805static int msn_soap_ab_contact_del_build_request( struct msn_soap_req_data *soap_req )
     806{
     807        struct msn_data *md = soap_req->ic->proto_data;
     808        bee_user_t *bu = soap_req->data;
     809        struct msn_buddy_data *bd = bu->data;
     810       
     811        soap_req->url = g_strdup( SOAP_ADDRESSBOOK_URL );
     812        soap_req->action = g_strdup( SOAP_AB_CONTACT_DEL_ACTION );
     813        soap_req->payload = msn_soap_abservice_build( SOAP_AB_CONTACT_DEL_PAYLOAD,
     814                "Timer", md->tokens[1], bd->cid );
     815       
     816        return 1;
     817}
     818
     819static int msn_soap_ab_contact_del_handle_response( struct msn_soap_req_data *soap_req )
     820{
     821        /* TODO: Ack the change? Not sure what the NAKs look like.. */
     822        return MSN_SOAP_OK;
     823}
     824
     825static int msn_soap_ab_contact_del_free_data( struct msn_soap_req_data *soap_req )
     826{
     827        return 0;
     828}
     829
     830int msn_soap_ab_contact_del( struct im_connection *ic, bee_user_t *bu )
     831{
     832        return msn_soap_start( ic, bu,
     833                               msn_soap_ab_contact_del_build_request,
     834                               NULL,
     835                               msn_soap_ab_contact_del_handle_response,
     836                               msn_soap_ab_contact_del_free_data );
     837}
Note: See TracChangeset for help on using the changeset viewer.