int fetion_buddylist_delete(User* user , int id) { FetionSip* sip = user->sip; SipHeader* eheader; char *res , *body; int ret; fetion_sip_set_type(sip , SIP_SERVICE); eheader = fetion_sip_event_header_new(SIP_EVENT_DELETEBUDDYLIST); fetion_sip_add_header(sip , eheader); body = generate_delete_buddylist_body(id); res = fetion_sip_to_string(sip , body); free(body); tcp_connection_send(sip->tcp , res , strlen(res)); free(res); res = fetion_sip_get_response(sip); ret = fetion_sip_get_code(res); free(res); if(ret == 200) { fetion_group_remove(user->groupList , id); debug_info("Delete buddy list success"); return 1; } else { debug_error("Delete buddy list failed , errno:%d" , ret); return -1; } }
gint fetion_buddylist_delete(fetion_account *ac, gint id) { fetion_sip *sip = ac->user->sip; SipHeader *eheader; gchar *res , *body; fetion_sip_set_type(sip , SIP_SERVICE); eheader = fetion_sip_event_header_new(SIP_EVENT_DELETEBUDDYLIST); fetion_sip_add_header(sip , eheader); body = generate_delete_buddylist_body(id); res = fetion_sip_to_string(sip , body); g_free(body); if(send(ac->sk, res, strlen(res), 0) == -1) { g_free(res); return -1; } g_free(res); return 0; }