int fetion_buddylist_edit(User* user , int id , const char* name) { 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_SETBUDDYLISTINFO); fetion_sip_add_header(sip , eheader); body = generate_edit_buddylist_body(id , name); 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) { debug_info("Set buddy list name to %s success" , name); return 1; } else { debug_error("Set buddy list name to %s failed , errno:%d" , name , ret); return -1; } }
gint fetion_buddylist_edit(fetion_account *ac, gint id, const gchar *name) { 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_SETBUDDYLISTINFO); fetion_sip_add_header(sip , eheader); body = generate_edit_buddylist_body(id , name); 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; }