void linphone_call_log_completed(LinphoneCall *call){ LinphoneCore *lc=call->core; call->log->duration=time(NULL)-call->start_time; if (call->log->status==LinphoneCallMissed){ char *info; lc->missed_calls++; info=ortp_strdup_printf(ngettext("You have missed %i call.", "You have missed %i calls.", lc->missed_calls), lc->missed_calls); if (lc->vtable.display_status!=NULL) lc->vtable.display_status(lc,info); ms_free(info); } lc->call_logs=ms_list_prepend(lc->call_logs,(void *)call->log); if (ms_list_size(lc->call_logs)>lc->max_call_logs){ MSList *elem,*prevelem=NULL; /*find the last element*/ for(elem=lc->call_logs;elem!=NULL;elem=elem->next){ prevelem=elem; } elem=prevelem; linphone_call_log_destroy((LinphoneCallLog*)elem->data); lc->call_logs=ms_list_remove_link(lc->call_logs,elem); } if (lc->vtable.call_log_updated!=NULL){ lc->vtable.call_log_updated(lc,call->log); } call_logs_write_to_config_file(lc); }
void sal_remove_supported_tag(Sal *ctx, const char* tag){ MSList *elem=ms_list_find_custom(ctx->supported_tags,(MSCompareFunc)strcasecmp,tag); if (elem){ ms_free(elem->data); ctx->supported_tags=ms_list_remove_link(ctx->supported_tags,elem); make_supported_header(ctx); } }
MSList * ms_list_remove(MSList *first, void *data){ MSList *it; it=ms_list_find(first,data); if (it) return ms_list_remove_link(first,it); else { ms_warning("ms_list_remove: no element with %p data was in the list", data); return first; } }
void linphone_core_remove_friend(LinphoneCore *lc, LinphoneFriend* fl){ MSList *el=ms_list_find(lc->friends,fl); if (el!=NULL){ linphone_friend_destroy((LinphoneFriend*)el->data); lc->friends=ms_list_remove_link(lc->friends,el); linphone_core_write_friends_config(lc); }else{ ms_error("linphone_core_remove_friend(): friend [%p] is not part of core's list.",fl); } }
static void remove_tasks_for_filter(MSTicker *ticker, MSFilter *f){ MSList *elem,*nextelem; for (elem=ticker->task_list;elem!=NULL;elem=nextelem){ MSFilterTask *t=(MSFilterTask*)elem->data; nextelem=elem->next; if (t->f==f){ ticker->task_list=ms_list_remove_link(ticker->task_list,elem); ms_free(t); } } }
static void cleanup_dead_vtable_refs(LinphoneCore *lc){ MSList *it,*next_it; for(it=lc->vtable_refs; it!=NULL; ){ VTableReference *ref=(VTableReference*)it->data; next_it=it->next; if (ref->valid==0){ ref->valid=0; lc->vtable_refs=ms_list_remove_link(lc->vtable_refs, it); ms_free(ref); } it=next_it; } }
void ms_filter_remove_notify_callback(MSFilter *f, MSFilterNotifyFunc fn, void *ud){ MSList *elem; MSList *found=NULL; for(elem=f->notify_callbacks;elem!=NULL;elem=elem->next){ MSNotifyContext *ctx=(MSNotifyContext*)elem->data; if (ctx->fn==fn && ctx->ud==ud){ found=elem; break; } } if (found){ ms_notify_context_destroy((MSNotifyContext*)found->data); f->notify_callbacks=ms_list_remove_link(f->notify_callbacks,found); }else ms_warning("ms_filter_remove_notify_callback(filter=%p): no registered callback with fn=%p and ud=%p",f,fn,ud); }
static unsigned int linphone_ldap_contact_provider_cancel_search(LinphoneContactProvider* obj, LinphoneContactSearch *req) { LinphoneLDAPContactSearch* ldap_req = LINPHONE_LDAP_CONTACT_SEARCH(req); LinphoneLDAPContactProvider* ldap_cp = LINPHONE_LDAP_CONTACT_PROVIDER(obj); int ret = 1; MSList* list_entry = ms_list_find_custom(ldap_cp->requests, linphone_ldap_request_entry_compare_strong, req); if( list_entry ) { ms_message("Delete search %p", req); ldap_cp->requests = ms_list_remove_link(ldap_cp->requests, list_entry); ldap_cp->req_count--; ret = 0; // return OK if we found it in the monitored requests } else { ms_warning("Couldn't find ldap request %p (id %d) in monitoring.", ldap_req, ldap_req->msgid); } belle_sip_object_unref(req); // unref request even if not found return ret; }
static bool_t is_duplicate_msg(LinphoneCore *lc, const char *msg_id){ MSList *elem=lc->last_recv_msg_ids; MSList *tail=NULL; int i; bool_t is_duplicate=FALSE; for(i=0;elem!=NULL;elem=elem->next,i++){ if (strcmp((const char*)elem->data,msg_id)==0){ is_duplicate=TRUE; } tail=elem; } if (!is_duplicate){ lc->last_recv_msg_ids=ms_list_prepend(lc->last_recv_msg_ids,ms_strdup(msg_id)); } if (i>=10){ ms_free(tail->data); lc->last_recv_msg_ids=ms_list_remove_link(lc->last_recv_msg_ids,tail); } return is_duplicate; }
static int uninit_bench(struct bench_config *bench) { MSList *it; for(it=bench->tsessions;it!=NULL;it=bench->tsessions){ struct test_session *ts = (struct test_session *)it->data; bench->tsessions = ms_list_remove_link(bench->tsessions, it); ms_ticker_detach(bench->ticker,ts->fplayer); ms_ticker_detach(bench->ticker,ts->rtprecv); ms_filter_call_method_noarg(ts->frecorder,MS_FILE_REC_CLOSE); if (strstr(bench->wavfile, ".au")==NULL) { ms_filter_unlink(ts->fplayer,0,ts->encoder,0); ms_filter_unlink(ts->encoder,0,ts->rtpsend,0); } else { ms_filter_unlink(ts->fplayer,0,ts->rtpsend,0); } ms_filter_unlink(ts->rtprecv,0,ts->decoder,0); ms_filter_unlink(ts->decoder,0,ts->frecorder,0); if (ts->fplayer) ms_filter_destroy(ts->fplayer); if (ts->encoder) ms_filter_destroy(ts->encoder); if (ts->rtpsend) ms_filter_destroy(ts->rtpsend); if (ts->rtprecv) ms_filter_destroy(ts->rtprecv); if (ts->decoder) ms_filter_destroy(ts->decoder); if (ts->frecorder) ms_filter_destroy(ts->frecorder); ortp_free(ts); } ms_ticker_destroy(bench->ticker); return 0; }