static bool_t is_duplicate_call(LinphoneCore *lc, const LinphoneAddress *from, const LinphoneAddress *to){ MSList *elem; for(elem=lc->calls;elem!=NULL;elem=elem->next){ LinphoneCall *call=(LinphoneCall*)elem->data; if (linphone_address_weak_equal(call->log->from,from) && linphone_address_weak_equal(call->log->to, to)){ return TRUE; } } return FALSE; }
void linphone_gtk_text_received ( LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *msg ) { GtkWidget *main_window=linphone_gtk_get_main_window(); GtkWidget *friendlist=linphone_gtk_get_widget ( main_window,"contact_list" ); GtkWidget *w; gboolean send=TRUE; /*GtkNotebook *notebook= ( GtkNotebook * ) linphone_gtk_get_widget ( main_window,"viewswitch" );*/ const LinphoneAddress *from= linphone_chat_message_get_from ( msg ); w= ( GtkWidget* ) g_object_get_data ( G_OBJECT ( friendlist ),"chatview" ); if ( w!=NULL ) { /* Chat window opened */ const LinphoneAddress *from_chatview=linphone_gtk_friend_list_get_active_address(); if (linphone_address_weak_equal(from,from_chatview)) { send=TRUE; } else { if ( !linphone_gtk_friend_list_is_contact ( linphone_chat_message_get_from ( msg ) ) ) { linphone_gtk_chat_add_contact ( linphone_chat_message_get_from ( msg ) ); } send=FALSE; } } else { /* Chat window closed */ #ifdef MSG_STORAGE_ENABLED send=FALSE; #else send=TRUE; #endif if ( !linphone_gtk_friend_list_is_contact ( linphone_chat_message_get_from ( msg ) ) ) { linphone_gtk_chat_add_contact ( linphone_chat_message_get_from ( msg ) ); } w=linphone_gtk_init_chatroom ( room,linphone_chat_message_get_from ( msg ) ); g_object_set_data ( G_OBJECT ( friendlist ),"chatview", ( gpointer ) w ); linphone_gtk_friend_list_set_active_address(from); } #ifdef HAVE_GTK_OSX /* Notified when a new message is sent */ linphone_gtk_status_icon_set_blinking ( TRUE ); #else if ( !gtk_window_is_active ( GTK_WINDOW ( main_window ) ) ) { if ( !GPOINTER_TO_INT ( g_object_get_data ( G_OBJECT ( w ),"is_notified" ) ) ) { linphone_gtk_notify ( NULL,linphone_chat_message_get_text ( msg ) ); g_object_set_data ( G_OBJECT ( w ),"is_notified",GINT_TO_POINTER ( TRUE ) ); } else { g_object_set_data ( G_OBJECT ( w ),"is_notified",GINT_TO_POINTER ( FALSE ) ); } } #endif if ( send ) { linphone_gtk_push_text ( w,linphone_chat_message_get_from ( msg ), FALSE,room,msg,FALSE ); } linphone_core_play_local(lc,linphone_gtk_get_sound_path("incoming_chat.wav")); linphone_gtk_show_friends(); }
LinphoneFriend * linphone_friend_list_find_friend_by_address(const LinphoneFriendList *list, const LinphoneAddress *address) { LinphoneFriend *lf = NULL; const bctbx_list_t *elem; for (elem = list->friends; elem != NULL; elem = elem->next) { lf = (LinphoneFriend *)elem->data; if (linphone_address_weak_equal(lf->uri, address)) return lf; } return NULL; }
Account *account_manager_get_account(AccountManager *m, const LinphoneAddress *identity){ MSList *it; for(it=m->accounts;it!=NULL;it=it->next){ Account *a=(Account*)it->data; if (linphone_address_weak_equal(a->identity,identity)){ return a; } } return NULL; }
LinphoneFriend *linphone_core_find_friend(const LinphoneCore *lc, const LinphoneAddress *addr){ LinphoneFriend *lf=NULL; MSList *elem; for(elem=lc->friends;elem!=NULL;elem=ms_list_next(elem)){ lf=(LinphoneFriend*)elem->data; if (linphone_address_weak_equal(lf->uri,addr)) break; lf=NULL; } return lf; }
static bool_t already_a_call_with_remote_address(const LinphoneCore *lc, const LinphoneAddress *remote) { MSList *elem; ms_warning(" searching for already_a_call_with_remote_address."); for(elem=lc->calls;elem!=NULL;elem=elem->next){ const LinphoneCall *call=(LinphoneCall*)elem->data; const LinphoneAddress *cRemote=linphone_call_get_remote_address(call); if (linphone_address_weak_equal(cRemote,remote)) { ms_warning("already_a_call_with_remote_address found."); return TRUE; } } return FALSE; }
static int friend_compare(const void * a, const void * b){ LinphoneAddress *fa=((LinphoneFriend*)a)->uri; LinphoneAddress *fb=((LinphoneFriend*)b)->uri; if (linphone_address_weak_equal(fa,fb)) return 0; return 1; }