LpSectionParam *lp_section_find_param(const LpSection *sec, const char *key){ MSList *elem; LpSectionParam *param; for (elem = sec->params; elem != NULL; elem = ms_list_next(elem)){ param = (LpSectionParam*)elem->data; if (strcmp(param->key, key) == 0) { return param; } } return NULL; }
/** * Retrieve an existing chat room whose peer is the supplied address, if exists. * @param lc the linphone core * @param add a linphone address. * @returns the matching chatroom, or NULL if no such chatroom exists. **/ LinphoneChatRoom *linphone_core_get_chat_room(LinphoneCore *lc, const LinphoneAddress *addr){ LinphoneChatRoom *cr=NULL; MSList *elem; for(elem=lc->chatrooms;elem!=NULL;elem=ms_list_next(elem)){ cr=(LinphoneChatRoom*)elem->data; if (linphone_chat_room_matches(cr,addr)){ break; } cr=NULL; } return cr; }
MSFilterDesc * ms_factory_get_decoder(MSFactory* factory, const char *mime){ MSList *elem; for (elem=factory->desc_list;elem!=NULL;elem=ms_list_next(elem)){ MSFilterDesc *desc=(MSFilterDesc*)elem->data; if ((desc->flags & MS_FILTER_IS_ENABLED) && (desc->category==MS_FILTER_DECODER || desc->category==MS_FILTER_DECODER_RENDERER) && strcasecmp(desc->enc_fmt,mime)==0){ return desc; } } return NULL; }
void lp_config_for_each_entry(const LpConfig *lpconfig, const char *section, void (*callback)(const char *entry, void *ctx), void *ctx) { LpItem *item; MSList *elem; LpSection *sec=lp_config_find_section(lpconfig,section); if (sec!=NULL){ for (elem=sec->items;elem!=NULL;elem=ms_list_next(elem)){ item=(LpItem*)elem->data; if (!item->is_comment) callback(item->key, ctx); } } }
LpItem *lp_section_find_item(LpSection *sec, const char *name){ MSList *elem; LpItem *item; /*printf("Looking for item %s\n",name);*/ for (elem=sec->items;elem!=NULL;elem=ms_list_next(elem)){ item=(LpItem*)elem->data; if (strcmp(item->key,name)==0) { /*printf("Item %s found\n",name);*/ return item; } } return NULL; }
LpSection *lp_config_find_section(LpConfig *lpconfig, const char *name){ LpSection *sec; MSList *elem; /*printf("Looking for section %s\n",name);*/ for (elem=lpconfig->sections;elem!=NULL;elem=ms_list_next(elem)){ sec=(LpSection*)elem->data; if (strcmp(sec->name,name)==0){ /*printf("Section %s found\n",name);*/ return sec; } } return NULL; }
void linphone_proxy_config_write_all_to_config_file(LinphoneCore *lc){ MSList *elem; int i; if (!linphone_core_ready(lc)) return; for(elem=lc->sip_conf.proxies,i=0;elem!=NULL;elem=ms_list_next(elem),i++){ LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)elem->data; linphone_proxy_config_write_to_config_file(lc->config,cfg,i); } /*to ensure removed configs are erased:*/ linphone_proxy_config_write_to_config_file(lc->config,NULL,i); lp_config_set_int(lc->config,"sip","default_proxy",linphone_core_get_default_proxy(lc,NULL)); }
LpItem *lp_section_find_comment(const LpSection *sec, const char *comment){ MSList *elem; LpItem *item; /*printf("Looking for item %s\n",name);*/ for (elem=sec->items;elem!=NULL;elem=ms_list_next(elem)){ item=(LpItem*)elem->data; if (item->is_comment && strcmp(item->value,comment)==0) { /*printf("Item %s found\n",name);*/ return item; } } return NULL; }
void linphone_core_write_friends_config(LinphoneCore* lc) { MSList *elem; int i; int store_friends; if (! linphone_core_ready(lc)) return; /*dont write config when reading it !*/ store_friends = lp_config_get_int(lc->config, "misc", "store_friends", 1); if (store_friends) { for (elem=linphone_core_get_default_friend_list(lc)->friends,i=0; elem!=NULL; elem=ms_list_next(elem),i++){ linphone_friend_write_to_config_file(lc->config,(LinphoneFriend*)elem->data,i); } linphone_friend_write_to_config_file(lc->config,NULL,i); /* set the end */ } }
MSFilter *ms_filter_new(MSFilterId id) { MSList *elem; if (id==MS_FILTER_PLUGIN_ID) { ms_warning("cannot create plugin filters with ms_filter_new_from_id()"); return NULL; } for (elem=desc_list; elem!=NULL; elem=ms_list_next(elem)) { MSFilterDesc *desc=(MSFilterDesc*)elem->data; if (desc->id==id) { return ms_filter_new_from_desc(desc); } } ms_error("No such filter with id %i",id); return NULL; }
static void carddav_clean(void) { // This is to ensure the content of the test addressbook is in the correct state for the following tests LinphoneCoreManager *manager = linphone_core_manager_new2("carddav_rc", FALSE); LinphoneFriendList *lfl = linphone_core_create_friend_list(manager->lc); LinphoneFriendListCbs *cbs = linphone_friend_list_get_callbacks(lfl); LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)ms_new0(LinphoneCardDAVStats, 1); MSList *friends = NULL; MSList *friends_iterator = NULL; LinphoneFriend *lf = NULL; LinphoneVcard *lvc = NULL; linphone_friend_list_cbs_set_user_data(cbs, stats); linphone_friend_list_cbs_set_contact_created(cbs, carddav_contact_created); linphone_friend_list_cbs_set_contact_deleted(cbs, carddav_contact_deleted); linphone_friend_list_cbs_set_contact_updated(cbs, carddav_contact_updated); linphone_friend_list_cbs_set_sync_status_changed(cbs, carddav_sync_status_changed); linphone_core_add_friend_list(manager->lc, lfl); linphone_friend_list_set_uri(lfl, CARDDAV_SERVER); linphone_friend_list_synchronize_friends_from_server(lfl); wait_for_until(manager->lc, NULL, &stats->sync_done_count, 1, 5000); BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i"); stats->sync_done_count = 0; friends = ms_list_copy(lfl->friends); friends_iterator = friends; while (friends_iterator) { LinphoneFriend *lf = (LinphoneFriend *)friends_iterator->data; linphone_friend_list_remove_friend(lfl, lf); wait_for_until(manager->lc, NULL, &stats->sync_done_count, 1, 5000); BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i"); stats->sync_done_count = 0; stats->removed_contact_count = 0; friends_iterator = ms_list_next(friends_iterator); } ms_list_free(friends); lvc = linphone_vcard_new_from_vcard4_buffer("BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:[email protected]\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nEND:VCARD\r\n"); linphone_vcard_set_url(lvc, "http://dav.linphone.org/card.php/addressbooks/tester/default/me.vcf"); lf = linphone_friend_new_from_vcard(lvc); linphone_friend_list_add_friend(lfl, lf); wait_for_until(manager->lc, NULL, &stats->sync_done_count, 1, 5000); BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i"); ms_free(stats); linphone_friend_unref(lf); linphone_friend_list_unref(lfl); linphone_core_manager_destroy(manager); }
MSList *ms_list_insert(MSList *list, MSList *before, void *data){ MSList *elem; if (list==NULL || before==NULL) return ms_list_append(list,data); for(elem=list;elem!=NULL;elem=ms_list_next(elem)){ if (elem==before){ if (elem->prev==NULL) return ms_list_prepend(list,data); else{ MSList *nelem=ms_list_new(data); nelem->prev=elem->prev; nelem->next=elem; elem->prev->next=nelem; elem->prev=nelem; } } } return list; }
void fill_address_book(GtkWidget *address_list){ GtkListStore *store; GtkTreeIter iter; GtkTreeModel *model; MSList *elem; gchar *tmpstr; /* fill the store */ elem=linphone_core_get_friend_list(get_core()); model=gtk_tree_view_get_model(GTK_TREE_VIEW(address_list)); store=GTK_LIST_STORE(model); gtk_list_store_clear(store); for(;elem!=NULL;elem=ms_list_next(elem)){ LinphoneFriend *lf=(LinphoneFriend*)elem->data; tmpstr=linphone_friend_get_url(lf); gtk_list_store_append(store,&iter); gtk_list_store_set(store,&iter,SIP_ADDRESS_COLUMN,tmpstr,FRIEND_REFERENCE,(gpointer)lf,-1); ms_free(tmpstr); } }
MSFilterDesc * ms_factory_get_decoding_renderer(MSFactory* factory, const char *mime) { MSList *elem; for (elem = factory->desc_list; elem != NULL; elem = ms_list_next(elem)) { MSFilterDesc *desc = (MSFilterDesc *)elem->data; if (desc->category == MS_FILTER_DECODER_RENDERER) { char *saveptr=NULL; char *enc_fmt = ms_strdup(desc->enc_fmt); char *token = strtok_r(enc_fmt, " ", &saveptr); while (token != NULL) { if (strcasecmp(token, mime) == 0) { break; } token = strtok_r(NULL, " ", &saveptr); } ms_free(enc_fmt); if (token != NULL) return desc; } } return NULL; }
void AccountSettingsModel::setSelectedAccount(QString sipUri) { const MSList *proxy_configs = linphone_core_get_proxy_config_list(LinphoneManager::getInstance()->getLc()); sipUri = QString("sip:") + sipUri; while (proxy_configs) { LinphoneProxyConfig *lpc = (LinphoneProxyConfig *)proxy_configs->data; const LinphoneAddress *addr = linphone_proxy_config_get_identity_address(lpc); const char *uri = linphone_address_as_string_uri_only(addr); if (strcmp(uri, sipUri.toUtf8().constData()) == 0) { _proxyConfig = lpc; _authInfo = linphone_proxy_config_find_auth_info(_proxyConfig); if (_proxyConfig && _authInfo) { emit accountUpdated(); } return; } proxy_configs = ms_list_next(proxy_configs); } }
MSFilterDesc * ms_filter_get_encoding_capturer(const char *mime) { MSList *elem; for (elem = desc_list; elem != NULL; elem = ms_list_next(elem)) { MSFilterDesc *desc = (MSFilterDesc *)elem->data; if (desc->category == MS_FILTER_ENCODING_CAPTURER) { char *saveptr=NULL; char *enc_fmt = ms_strdup(desc->enc_fmt); char *token = strtok_r(enc_fmt, " ", &saveptr); while (token != NULL) { if (strcasecmp(token, mime) == 0) { break; } token = strtok_r(NULL, " ", &saveptr); } ms_free(enc_fmt); if (token != NULL) return desc; } } return NULL; }