LinphoneFriend *linphone_core_get_friend_by_ref_key(const LinphoneCore *lc, const char *key){ const MSList *elem; if (key==NULL) return NULL; for(elem=linphone_core_get_friend_list(lc);elem!=NULL;elem=elem->next){ LinphoneFriend *lf=(LinphoneFriend*)elem->data; if (lf->refkey!=NULL && strcmp(lf->refkey,key)==0){ return lf; } } return NULL; }
static void simple_subscribe_with_friend_from_rc(void) { LinphoneCoreManager* pauline = presence_linphone_core_manager_new("pauline"); LinphoneCoreManager *marie = presence_linphone_core_manager_new_with_rc_name("marie", "pauline_as_friend_rc"); LinphoneFriend *pauline_as_friend; BC_ASSERT_EQUAL((unsigned int)bctbx_list_size(linphone_core_get_friend_list(marie->lc)), 1, unsigned int , "%u"); if (bctbx_list_size(linphone_core_get_friend_list(marie->lc))>0) { pauline_as_friend = (LinphoneFriend*)linphone_core_get_friend_list(marie->lc)->data; linphone_friend_set_address(pauline_as_friend, pauline->identity); /*hack to update addr with port number*/ } BC_ASSERT_TRUE (wait_for(marie->lc,pauline->lc,&marie->stat.number_of_LinphonePresenceActivityOnline,1)); BC_ASSERT_EQUAL(pauline->stat.number_of_NewSubscriptionRequest,1, int, "%d"); BC_ASSERT_EQUAL(marie->stat.number_of_NotifyPresenceReceived,1, int, "%d"); linphone_core_manager_destroy(marie); /*unsubscribe is not reported ?*/ BC_ASSERT_FALSE(wait_for(NULL,pauline->lc,&pauline->stat.number_of_NewSubscriptionRequest,2)); /*just to wait for unsubscription even if not notified*/ linphone_core_manager_destroy(pauline); }
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); } }