mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 12:38:09 +00:00
Propose to add contact to friend list in call history only if this contact is not already in the friend list.
This commit is contained in:
parent
7fe87f9f61
commit
aed0de97ee
4 changed files with 20 additions and 18 deletions
|
|
@ -177,7 +177,9 @@ static GtkWidget *linphone_gtk_create_call_log_menu(GtkWidget *call_log){
|
|||
name=linphone_address_as_string(la);
|
||||
call_label=g_strdup_printf(_("Call %s"),name);
|
||||
text_label=g_strdup_printf(_("Send text to %s"),name);
|
||||
add_contact_label=g_strdup_printf(_("Add %s to your contact list"),name);
|
||||
if (!linphone_gtk_is_friend(linphone_gtk_get_core(), name)) {
|
||||
add_contact_label=g_strdup_printf(_("Add %s to your contact list"),name);
|
||||
}
|
||||
ms_free(name);
|
||||
menu=gtk_menu_new();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -464,22 +464,10 @@ static void update_star(GtkEntry *entry, gboolean is_known){
|
|||
|
||||
static void check_contact(GtkEditable *editable, LinphoneCore *lc){
|
||||
bool_t known = TRUE;
|
||||
char *tmp=gtk_editable_get_chars(editable,0,-1);
|
||||
if (tmp!=NULL){
|
||||
if (strlen(tmp)>0){
|
||||
LinphoneAddress *addr=linphone_core_interpret_url(lc,tmp);
|
||||
if (addr){
|
||||
char *uri=linphone_address_as_string_uri_only(addr);
|
||||
LinphoneFriend *lf=linphone_core_get_friend_by_address(lc,uri);
|
||||
ms_free(uri);
|
||||
linphone_address_destroy(addr);
|
||||
if (lf) {
|
||||
update_star(GTK_ENTRY(editable),TRUE);
|
||||
g_free(tmp);
|
||||
return;
|
||||
}
|
||||
}
|
||||
known = FALSE;
|
||||
char *tmp = gtk_editable_get_chars(editable, 0, -1);
|
||||
if (tmp != NULL) {
|
||||
if (strlen(tmp) > 0) {
|
||||
known = linphone_gtk_is_friend(lc, tmp);
|
||||
}
|
||||
g_free(tmp);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -344,4 +344,5 @@ LINPHONE_PUBLIC void linphone_gtk_proxy_transport_changed(GtkWidget *combo);
|
|||
LINPHONE_PUBLIC void linphone_gtk_tunnel_ok(GtkButton *button);
|
||||
LINPHONE_PUBLIC void linphone_gtk_notebook_current_page_changed(GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer user_data);
|
||||
LINPHONE_PUBLIC void linphone_gtk_reload_sound_devices(void);
|
||||
LINPHONE_PUBLIC void linphone_gtk_reload_video_devices(void);
|
||||
LINPHONE_PUBLIC void linphone_gtk_reload_video_devices(void);
|
||||
LINPHONE_PUBLIC bool_t linphone_gtk_is_friend(LinphoneCore *lc, const char *contact);
|
||||
|
|
|
|||
11
gtk/utils.c
11
gtk/utils.c
|
|
@ -112,6 +112,17 @@ void linphone_gtk_reload_video_devices(void){
|
|||
if (pb) linphone_gtk_fill_webcams(pb);
|
||||
}
|
||||
|
||||
bool_t linphone_gtk_is_friend(LinphoneCore *lc, const char *contact) {
|
||||
LinphoneAddress *addr = linphone_core_interpret_url(lc, contact);
|
||||
if (addr) {
|
||||
char *uri = linphone_address_as_string_uri_only(addr);
|
||||
LinphoneFriend *lf = linphone_core_get_friend_by_address(lc, uri);
|
||||
linphone_address_destroy(addr);
|
||||
if (lf) return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBUDEV_H
|
||||
|
||||
static struct udev *udevroot=NULL;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue