void linphone_gtk_add_buddy_from_database(GtkWidget *button){ GtkWidget *w=gtk_widget_get_toplevel(button); GtkTreeSelection *select; GtkTreeIter iter; GtkTreeModel *model; select = gtk_tree_view_get_selection(GTK_TREE_VIEW(linphone_gtk_get_widget(w,"search_results"))); if (gtk_tree_selection_get_selected (select, &model, &iter)) { char *uri; char *name; char *addr; LinphoneFriend *lf; int presence=linphone_gtk_get_ui_config_int("use_subscribe_notify",1); gtk_tree_model_get (model, &iter,LOOKUP_RESULT_SIP_URI , &uri,LOOKUP_RESULT_NAME, &name, -1); addr=g_strdup_printf("%s <%s>",name,uri); lf=linphone_friend_new_with_address(addr); linphone_friend_set_inc_subscribe_policy(lf,presence ? LinphoneSPAccept : LinphoneSPDeny); linphone_friend_send_subscribe(lf,presence); linphone_core_add_friend(linphone_gtk_get_core(),lf); linphone_gtk_show_friends(); g_free(addr); g_free(uri); g_free(name); } }
LinphoneFriend * linphone_friend_new_from_config_file(LinphoneCore *lc, int index){ const char *tmp; char item[50]; int a; LinphoneFriend *lf; LpConfig *config=lc->config; sprintf(item,"friend_%i",index); if (!lp_config_has_section(config,item)){ return NULL; } tmp=lp_config_get_string(config,item,"url",NULL); if (tmp==NULL) { return NULL; } lf=linphone_friend_new_with_address(tmp); if (lf==NULL) { return NULL; } tmp=lp_config_get_string(config,item,"pol",NULL); if (tmp==NULL) linphone_friend_set_inc_subscribe_policy(lf,LinphoneSPWait); else{ linphone_friend_set_inc_subscribe_policy(lf,__policy_str_to_enum(tmp)); } a=lp_config_get_int(config,item,"subscribe",0); linphone_friend_send_subscribe(lf,a); linphone_friend_set_ref_key(lf,lp_config_get_string(config,item,"refkey",NULL)); return lf; }
FriendAPI::FriendAPI(StringPtr const &address) : WrapperAPI(APIDescription(this)) { FBLOG_DEBUG("FriendAPI::FriendAPI", "this=" << this << "\t" << "address=" << address); mFriend = linphone_friend_new_with_address(STRING_TO_CHARPTR(address)); if (mFriend == NULL) { throw std::invalid_argument("one/many parameters is/are invalid"); } }
static void linphone_gtk_chat_add_contact(const LinphoneAddress *addr){ LinphoneFriend *lf=NULL; gboolean show_presence=FALSE; char *uri=linphone_address_as_string(addr); lf=linphone_friend_new_with_address(uri); ms_free(uri); linphone_friend_set_inc_subscribe_policy(lf,LinphoneSPWait); linphone_friend_send_subscribe(lf,show_presence); linphone_friend_set_address(lf,addr); linphone_core_add_friend(linphone_gtk_get_core(),lf); linphone_gtk_show_friends(); }
void linphone_gtk_chat_add_contact(const LinphoneAddress *addr){ LinphoneFriend *lf=NULL; LinphoneAddress *fixed_uri=NULL; gboolean show_presence=FALSE; char *uri=linphone_address_as_string(addr); lf=linphone_friend_new_with_address(uri); ms_free(uri); linphone_friend_set_inc_subscribe_policy(lf,LinphoneSPDeny); linphone_friend_send_subscribe(lf,show_presence); fixed_uri = linphone_core_interpret_url(linphone_gtk_get_core(),uri); if (fixed_uri==NULL){ linphone_gtk_display_something(GTK_MESSAGE_WARNING,_("Invalid sip contact !")); return ; } linphone_friend_set_address(lf,addr); linphone_core_add_friend(linphone_gtk_get_core(),lf); linphone_address_destroy(fixed_uri); linphone_gtk_show_friends(); }
void linphone_gtk_call_log_add_contact(GtkWidget *w){ GtkTreeSelection *select; GtkTreeIter iter; select=gtk_tree_view_get_selection(GTK_TREE_VIEW(w)); if (select!=NULL){ GtkTreeModel *model=NULL; if (gtk_tree_selection_get_selected (select,&model,&iter)){ gpointer pcl; LinphoneAddress *la; LinphoneCallLog *cl; LinphoneFriend *lf; gtk_tree_model_get(model,&iter,2,&pcl,-1); cl = (LinphoneCallLog *)pcl; la = linphone_call_log_get_dir(cl)==LinphoneCallIncoming ? linphone_call_log_get_from(cl) : linphone_call_log_get_to(cl); if (la != NULL){ char *uri=linphone_address_as_string(la); lf=linphone_friend_new_with_address(uri); linphone_gtk_show_contact(lf); ms_free(uri); } } } }
LinphoneFriend * linphone_core_create_friend_with_address(LinphoneCore *lc, const char *address) { LinphoneFriend * lf = linphone_friend_new_with_address(address); if (lf) lf->lc = lc; return lf; }
LinphoneFriend * linphone_core_create_friend_with_address(LinphoneCore *lc, const char *address) { return linphone_friend_new_with_address(address); }