Commit f9aee351 authored by Simon Morlat's avatar Simon Morlat

heavy rework of lists, presence list subscriptions, and fix many memory leaks

parent c0fa38c6
......@@ -1829,7 +1829,7 @@ linphonec_proxy_use(LinphoneCore *lc, int index)
static void
linphonec_friend_display(LinphoneFriend *fr)
{
LinphoneAddress *addr = linphone_friend_get_address(fr);
const LinphoneAddress *addr = linphone_friend_get_address(fr);
char *str = NULL;
linphonec_out("name: %s\n", linphone_friend_get_name(fr));
......@@ -1875,12 +1875,11 @@ linphonec_friend_call(LinphoneCore *lc, unsigned int num)
if ( n == num )
{
int ret;
LinphoneAddress *addr = linphone_friend_get_address((LinphoneFriend*)friend->data);
const LinphoneAddress *addr = linphone_friend_get_address((LinphoneFriend*)friend->data);
if (addr) {
addr_str = linphone_address_as_string(addr);
ret=lpc_cmd_call(lc, addr_str);
ms_free(addr_str);
linphone_address_unref(addr);
return ret;
} else {
linphonec_out("Friend %u does not have an address\n", num);
......
......@@ -291,12 +291,11 @@ linphonec_transfer_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneC
static void
linphonec_notify_presence_received(LinphoneCore *lc,LinphoneFriend *fid)
{
LinphoneAddress *addr = linphone_friend_get_address(fid);
const LinphoneAddress *addr = linphone_friend_get_address(fid);
if (addr) {
char *tmp=linphone_address_as_string(addr);
printf("Friend %s is %s\n", tmp, linphone_online_status_to_string(linphone_friend_get_status(fid)));
ms_free(tmp);
linphone_address_unref(addr);
}
// todo: update Friend list state (unimplemented)
}
......
......@@ -1137,7 +1137,7 @@ void sal_remove_supported_tag(Sal *ctx, const char* tag){
bctbx_list_t *elem=bctbx_list_find_custom(ctx->supported_tags,(bctbx_compare_func)strcasecmp,tag);
if (elem){
ms_free(elem->data);
ctx->supported_tags=bctbx_list_remove_link(ctx->supported_tags,elem);
ctx->supported_tags=bctbx_list_erase_link(ctx->supported_tags,elem);
make_supported_header(ctx);
}
}
......
......@@ -538,7 +538,7 @@ static void process_request_event(void *op_base, const belle_sip_request_event_t
bool_t is_update=FALSE;
bool_t drop_op = FALSE;
if (strcmp("ACK",method)!=0){ /*ACK does'nt create srv transaction*/
if (strcmp("ACK",method)!=0){ /*ACK doesn't create a server transaction*/
server_transaction = belle_sip_provider_create_server_transaction(op->base.root->prov,belle_sip_request_event_get_request(event));
belle_sip_object_ref(server_transaction);
belle_sip_transaction_set_application_data(BELLE_SIP_TRANSACTION(server_transaction),sal_op_ref(op));
......
......@@ -1106,7 +1106,7 @@ static bool_t is_duplicate_msg(LinphoneCore *lc, const char *msg_id){
}
if (i>=10){
ms_free(tail->data);
lc->last_recv_msg_ids=bctbx_list_remove_link(lc->last_recv_msg_ids,tail);
lc->last_recv_msg_ids=bctbx_list_erase_link(lc->last_recv_msg_ids,tail);
}
return is_duplicate;
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -153,6 +153,21 @@ LINPHONE_PUBLIC const char * linphone_friend_list_get_rls_uri(const LinphoneFrie
**/
LINPHONE_PUBLIC void linphone_friend_list_set_rls_uri(LinphoneFriendList *list, const char *rls_uri);
/**
* Get the RLS (Resource List Server) URI associated with the friend list to subscribe to these friends presence.
* @param[in] list LinphoneFriendList object.
* @return The RLS URI associated with the friend list.
**/
LINPHONE_PUBLIC const LinphoneAddress * linphone_friend_list_get_rls_address(const LinphoneFriendList *list);
/**
* Set the RLS (Resource List Server) URI associated with the friend list to subscribe to these friends presence.
* @param[in] list LinphoneFriendList object.
* @param[in] rls_addr The RLS URI to associate with the friend list.
**/
LINPHONE_PUBLIC void linphone_friend_list_set_rls_address(LinphoneFriendList *list, const LinphoneAddress *rls_addr);
/**
* Add a friend to a friend list. If or when a remote CardDAV server will be attached to the list, the friend will be sent to the server.
* @param[in] list LinphoneFriendList object.
......@@ -202,14 +217,19 @@ LINPHONE_PUBLIC LinphoneFriend * linphone_friend_list_find_friend_by_address(con
LINPHONE_PUBLIC LinphoneFriend * linphone_friend_list_find_friend_by_uri(const LinphoneFriendList *list, const char *uri);
/**
* Find a frient in the friend list using a ref key.
* Find a friend in the friend list using a ref key.
* @param[in] list LinphoneFriendList object.
* @param[in] ref_key The ref key string of the friend we want to search for.
* @return A LinphoneFriend if found, NULL otherwise.
**/
LINPHONE_PUBLIC LinphoneFriend * linphone_friend_list_find_friend_by_ref_key(const LinphoneFriendList *list, const char *ref_key);
LINPHONE_PUBLIC void linphone_friend_list_update_subscriptions(LinphoneFriendList *list, LinphoneProxyConfig *cfg, bool_t only_when_registered);
/**
* Update presence subscriptions for the entire list. Calling this function is necessary when list subscriptions are enabled,
* ie when a RLS presence server is used.
* @param[in] list the friend list
**/
LINPHONE_PUBLIC void linphone_friend_list_update_subscriptions(LinphoneFriendList *list);
/**
* Notify our presence to all the friends in the friend list that have subscribed to our presence directly (not using a RLS).
......
......@@ -51,23 +51,25 @@ static void stop(int signum){
* presence state change notification callback
*/
static void notify_presence_recv_updated (LinphoneCore *lc, LinphoneFriend *friend) {
LinphoneAddress* friend_address = linphone_friend_get_address(friend);
const LinphoneAddress* friend_address = linphone_friend_get_address(friend);
if (friend_address != NULL) {
const LinphonePresenceModel* model = linphone_friend_get_presence_model(friend);
LinphonePresenceActivity *activity = linphone_presence_model_get_activity(model);
char *activity_str = linphone_presence_activity_to_string(activity);
char *str = linphone_address_as_string (friend_address);
printf("New state state [%s] for user id [%s] \n"
,activity_str
,linphone_address_as_string (friend_address));
linphone_address_unref(friend_address);
,str);
ms_free(str);
}
}
static void new_subscription_requested (LinphoneCore *lc, LinphoneFriend *friend, const char* url) {
LinphoneAddress* friend_address = linphone_friend_get_address(friend);
const LinphoneAddress* friend_address = linphone_friend_get_address(friend);
if (friend_address != NULL) {
printf(" [%s] wants to see your status, accepting\n"
,linphone_address_as_string (friend_address));
linphone_address_unref(friend_address);
char *str = linphone_address_as_string (friend_address);
printf(" [%s] wants to see your status, accepting\n", str);
ms_free(str);
}
linphone_friend_edit(friend); /* start editing friend */
linphone_friend_set_inc_subscribe_policy(friend,LinphoneSPAccept); /* Accept incoming subscription request for this friend*/
......
......@@ -1130,8 +1130,10 @@ static void linphone_call_get_local_ip(LinphoneCall *call, const LinphoneAddress
if (res != NULL) freeaddrinfo(res);
}
if (dest != NULL || call->media_localip[0] == '\0')
if (dest != NULL || call->media_localip[0] == '\0' || call->need_localip_refresh){
call->need_localip_refresh = FALSE;
linphone_core_get_local_ip(call->core, af, dest, call->media_localip);
}
return;
found:
strncpy(call->media_localip,ip,LINPHONE_IPADDR_SIZE);
......@@ -4699,7 +4701,7 @@ void linphone_call_log_completed(LinphoneCall *call){
}
elem=prevelem;
linphone_call_log_unref((LinphoneCallLog*)elem->data);
lc->call_logs=bctbx_list_remove_link(lc->call_logs,elem);
lc->call_logs=bctbx_list_erase_link(lc->call_logs,elem);
}
call_logs_write_to_config_file(lc);
}
......@@ -5023,6 +5025,7 @@ void linphone_call_set_broken(LinphoneCall *call){
/*during these states, the dialog is established. A failure of a transaction is not expected to close it.
* Instead we have to repair the dialog by sending a reINVITE*/
call->broken = TRUE;
call->need_localip_refresh = TRUE;
break;
default:
ms_error("linphone_call_set_broken() unimplemented case.");
......
......@@ -1622,8 +1622,11 @@ void linphone_core_reload_ms_plugins(LinphoneCore *lc, const char *path){
}
static void linphone_core_start(LinphoneCore * lc) {
linphone_core_add_friend_list(lc, NULL);
LinphoneFriendList *list = linphone_core_create_friend_list(lc);
linphone_friend_list_set_display_name(list, "_default");
linphone_core_add_friend_list(lc, list);
linphone_friend_list_unref(list);
sip_setup_register_all(lc->factory);
sound_config_read(lc);
net_config_read(lc);
......@@ -2064,31 +2067,22 @@ void linphone_core_remove_friend_list(LinphoneCore *lc, LinphoneFriendList *list
linphone_core_notify_friend_list_removed(lc, list);
list->lc = NULL;
linphone_friend_list_unref(list);
lc->friends_lists = bctbx_list_remove_link(lc->friends_lists, elem);
lc->friends_lists = bctbx_list_erase_link(lc->friends_lists, elem);
}
void linphone_core_add_friend_list(LinphoneCore *lc, LinphoneFriendList *list) {
const char *rls_uri = lp_config_get_string(lc->config, "sip", "rls_uri", NULL);
if (list) {
if (!list->lc) {
list->lc = lc;
}
lc->friends_lists = bctbx_list_append(lc->friends_lists, linphone_friend_list_ref(list));
if (!list->lc) {
list->lc = lc;
}
lc->friends_lists = bctbx_list_append(lc->friends_lists, linphone_friend_list_ref(list));
#ifdef SQLITE_STORAGE_ENABLED
linphone_core_store_friends_list_in_db(lc, list);
linphone_core_store_friends_list_in_db(lc, list);
#endif
linphone_core_notify_friend_list_created(lc, list);
if (!linphone_friend_list_get_rls_uri(list) && rls_uri && lp_config_get_int(lc->config, "sip", "use_rls_presence", 0)) {
linphone_friend_list_set_rls_uri(list, rls_uri);
}
} else {
list = linphone_core_create_friend_list(lc);
linphone_friend_list_set_display_name(list, "_default");
if (rls_uri && lp_config_get_int(lc->config, "sip", "use_rls_presence", 0)) {
linphone_friend_list_set_rls_uri(list, rls_uri);
}
lc->friends_lists = bctbx_list_append(lc->friends_lists, linphone_friend_list_ref(list));
linphone_friend_list_unref(list);
linphone_core_notify_friend_list_created(lc, list);
if (!linphone_friend_list_get_rls_uri(list) && rls_uri && lp_config_get_int(lc->config, "sip", "use_rls_presence", 0)) {
linphone_friend_list_set_rls_uri(list, rls_uri);
}
}
......@@ -2628,7 +2622,7 @@ static void proxy_update(LinphoneCore *lc){
LinphoneProxyConfig* cfg = (LinphoneProxyConfig*)elem->data;
next=elem->next;
if (ms_time(NULL) - cfg->deletion_date > 32) {
lc->sip_conf.deleted_proxies =bctbx_list_remove_link(lc->sip_conf.deleted_proxies,elem);
lc->sip_conf.deleted_proxies =bctbx_list_erase_link(lc->sip_conf.deleted_proxies,elem);
ms_message("Proxy config for [%s] is definitely removed from core.",linphone_proxy_config_get_addr(cfg));
_linphone_proxy_config_release_ops(cfg);
linphone_proxy_config_unref(cfg);
......@@ -2665,7 +2659,7 @@ static void analyze_buddy_lookup_results(LinphoneCore *lc, LinphoneProxyConfig *
}
/*purge completed requests */
while((elem=bctbx_list_find(lc->bl_reqs,NULL))!=NULL){
lc->bl_reqs=bctbx_list_remove_link(lc->bl_reqs,elem);
lc->bl_reqs=bctbx_list_erase_link(lc->bl_reqs,elem);
}
}
......@@ -7000,7 +6994,7 @@ int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call)
it=bctbx_list_find(the_calls,call);
if (it)
{
the_calls = bctbx_list_remove_link(the_calls,it);
the_calls = bctbx_list_erase_link(the_calls,it);
}
else
{
......
......@@ -158,11 +158,12 @@ LINPHONE_PUBLIC int linphone_friend_set_address(LinphoneFriend *fr, const Linpho
#define linphone_friend_set_addr linphone_friend_set_address
/**
* Get address of this friend
* Get address of this friend.
* @note the LinphoneAddress object returned is hold by the LinphoneFriend, however calling several time this function may return different objects.
* @param lf #LinphoneFriend object
* @return #LinphoneAddress
*/
LINPHONE_PUBLIC LinphoneAddress * linphone_friend_get_address(const LinphoneFriend *lf);
LINPHONE_PUBLIC const LinphoneAddress * linphone_friend_get_address(const LinphoneFriend *lf);
/**
* Adds an address in this friend
......@@ -176,7 +177,7 @@ LINPHONE_PUBLIC void linphone_friend_add_address(LinphoneFriend *lf, const Linph
* @param lf #LinphoneFriend object
* @return \mslist{LinphoneAddress}
*/
LINPHONE_PUBLIC bctbx_list_t* linphone_friend_get_addresses(LinphoneFriend *lf);
LINPHONE_PUBLIC bctbx_list_t* linphone_friend_get_addresses(const LinphoneFriend *lf);
/**
* Removes an address in this friend
......
......@@ -1766,7 +1766,7 @@ void linphone_task_list_remove(LinphoneTaskList *t, LinphoneCoreIterateHook hook
for(elem=t->hooks;elem!=NULL;elem=elem->next){
Hook *h=(Hook*)elem->data;
if (h->fun==hook && h->data==hook_data){
t->hooks = bctbx_list_remove_link(t->hooks,elem);
t->hooks = bctbx_list_erase_link(t->hooks,elem);
ms_free(h);
return;
}
......
......@@ -1471,7 +1471,7 @@ static LinphonePresenceModel * process_pidf_xml_presence_notification(xmlparsing
void linphone_core_add_subscriber(LinphoneCore *lc, const char *subscriber, SalOp *op){
LinphoneFriend *fl=linphone_core_create_friend_with_address(lc,subscriber);
LinphoneAddress *addr;
const LinphoneAddress *addr;
char *tmp;
if (fl==NULL) return ;
......@@ -1487,7 +1487,6 @@ void linphone_core_add_subscriber(LinphoneCore *lc, const char *subscriber, SalO
tmp = linphone_address_as_string(addr);
linphone_core_notify_new_subscription_requested(lc,fl,tmp);
ms_free(tmp);
linphone_address_unref(addr);
}
}
......@@ -1897,7 +1896,7 @@ end:
void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, SalPresenceModel *model){
char *tmp;
LinphoneFriend *lf = NULL;
LinphoneAddress *friend=NULL;
const LinphoneAddress *friend=NULL;
LinphonePresenceModel *presence = model ? (LinphonePresenceModel *)model:linphone_presence_model_new_with_activity(LinphonePresenceActivityOffline, NULL);
if (linphone_core_get_default_friend_list(lc) != NULL)
......@@ -1917,7 +1916,6 @@ void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, Sa
ms_message("We are notified that [%s] has presence [%s]", tmp, activity_str);
if (activity_str != NULL) ms_free(activity_str);
ms_free(tmp);
linphone_address_unref(friend);
}
linphone_friend_set_presence_model(lf, presence);
lf->subscribe_active=TRUE;
......
......@@ -368,6 +368,7 @@ struct _LinphoneCall{
bool_t paused_by_app;
bool_t broken; /*set to TRUE when the call is in broken state due to network disconnection or transport */
bool_t defer_notify_incoming;
bool_t need_localip_refresh;
};
BELLE_SIP_DECLARE_VPTR(LinphoneCall);
......@@ -424,7 +425,7 @@ void _linphone_friend_list_release(LinphoneFriendList *list);
void linphone_friend_invalidate_subscription(LinphoneFriend *lf);
void linphone_friend_close_subscriptions(LinphoneFriend *lf);
void _linphone_friend_release(LinphoneFriend *lf);
void linphone_friend_update_subscribes(LinphoneFriend *fr, LinphoneProxyConfig *cfg, bool_t only_when_registered);
void linphone_friend_update_subscribes(LinphoneFriend *fr, bool_t only_when_registered);
void linphone_friend_notify(LinphoneFriend *lf, LinphonePresenceModel *presence);
void linphone_friend_apply(LinphoneFriend *fr, LinphoneCore *lc);
void linphone_friend_add_incoming_subscription(LinphoneFriend *lf, SalOp *op);
......@@ -438,7 +439,8 @@ LinphoneFriend *linphone_core_find_friend_by_out_subscribe(const LinphoneCore *l
LinphoneFriend *linphone_core_find_friend_by_inc_subscribe(const LinphoneCore *lc, SalOp *op);
MSList *linphone_find_friend_by_address(MSList *fl, const LinphoneAddress *addr, LinphoneFriend **lf);
bool_t linphone_core_should_subscribe_friends_only_when_registered(const LinphoneCore *lc);
void linphone_core_update_friends_subscriptions(LinphoneCore *lc, LinphoneProxyConfig *cfg, bool_t only_when_registered);
void linphone_core_update_friends_subscriptions(LinphoneCore *lc);
void _linphone_friend_list_update_subscriptions(LinphoneFriendList *list, LinphoneProxyConfig *cfg, bool_t only_when_registered);
void linphone_core_friends_storage_init(LinphoneCore *lc);
void linphone_core_friends_storage_close(LinphoneCore *lc);
void linphone_core_store_friend_in_db(LinphoneCore *lc, LinphoneFriend *lf);
......@@ -754,7 +756,8 @@ struct _LinphoneFriendList {
LinphoneCore *lc;
LinphoneEvent *event;
char *display_name;
char *rls_uri;
char *rls_uri; /*this field is take in sync with rls_addr*/
LinphoneAddress *rls_addr;
MSList *friends;
unsigned char *content_digest;
int expected_notification_version;
......
......@@ -1272,7 +1272,7 @@ void linphone_proxy_config_set_state(LinphoneProxyConfig *cfg, LinphoneRegistrat
ms_message("Updating friends for identity [%s] on core [%p]",linphone_proxy_config_get_identity(cfg),cfg->lc);
/* state must be updated before calling linphone_core_update_friends_subscriptions*/
cfg->state=state;
linphone_core_update_friends_subscriptions(lc,cfg,TRUE);
linphone_core_update_friends_subscriptions(lc);
} else {
/*at this point state must be updated*/
cfg->state=state;
......
......@@ -48,7 +48,7 @@ static void cleanup_dead_vtable_refs(LinphoneCore *lc){
next_it=it->next;
if (ref->valid==0){
ref->valid=0;
lc->vtable_refs=bctbx_list_remove_link(lc->vtable_refs, it);
lc->vtable_refs=bctbx_list_erase_link(lc->vtable_refs, it);
ms_free(ref);
}
it=next_it;
......
......@@ -90,13 +90,12 @@ static void linphone_gtk_set_selection_to_uri_bar(GtkTreeView *treeview){
gchar* friend;
select = gtk_tree_view_get_selection (treeview);
if (gtk_tree_selection_get_selected (select, &model, &iter)) {
LinphoneAddress *addr;
const LinphoneAddress *addr;
gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
addr = linphone_friend_get_address(lf);
if (addr) {
friend=linphone_address_as_string(addr);
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(linphone_gtk_get_main_window(),"uribar")),friend);
linphone_address_unref(addr);
ms_free(friend);
}
}
......@@ -179,14 +178,13 @@ gboolean linphone_gtk_on_key_press(GtkWidget *widget, GdkEvent *event, gpointer
LinphoneChatRoom *cr;
do{
if (index == key) {
LinphoneAddress *addr;
const LinphoneAddress *addr;
gtk_tree_model_get (model, &iter,FRIEND_CHATROOM , &cr, -1);
gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
if (lf != NULL) {
addr = linphone_friend_get_address(lf);
if (addr != NULL) {
linphone_gtk_friend_list_set_chat_conversation(addr);
linphone_address_unref(addr);
}
}
if (cr != NULL){
......@@ -223,7 +221,7 @@ void linphone_gtk_delete_history(GtkWidget *button){
linphone_chat_room_delete_history(cr);
if(chat_view!=NULL){
const LinphoneAddress *from=linphone_gtk_friend_list_get_active_address();
LinphoneAddress *addr=linphone_friend_get_address(lf);
const LinphoneAddress *addr=linphone_friend_get_address(lf);
if (addr != NULL) {
if(linphone_address_weak_equal(from,addr)){
GtkTextView *text_view=GTK_TEXT_VIEW(linphone_gtk_get_widget(chat_view,"textview"));
......@@ -236,7 +234,6 @@ void linphone_gtk_delete_history(GtkWidget *button){
gtk_text_buffer_delete (text_buffer, &start, &end);
g_object_set_data(G_OBJECT(chat_view),"from_message",NULL);
}
linphone_address_unref(addr);
}
}
linphone_gtk_show_friends();
......@@ -339,7 +336,7 @@ void linphone_gtk_friend_list_set_chat_conversation(const LinphoneAddress *la){
store=GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(friendlist)));
if (gtk_tree_model_get_iter_first(model,&iter)) {
do{
LinphoneAddress *addr;
const LinphoneAddress *addr;
gtk_tree_model_get(model, &iter,FRIEND_ID , &lf, -1);
addr=linphone_friend_get_address(lf);
if (addr != NULL) {
......@@ -353,7 +350,6 @@ void linphone_gtk_friend_list_set_chat_conversation(const LinphoneAddress *la){
gtk_tree_selection_select_iter(selection, &iter);
break;
}
linphone_address_unref(addr);
}
}while(gtk_tree_model_iter_next(model,&iter));
}
......@@ -403,7 +399,7 @@ void linphone_gtk_chat_selected(GtkWidget *item){
store=GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(item)));
if (gtk_tree_selection_get_selected (select, &model, &iter)){
GtkNotebook *notebook=(GtkNotebook *)linphone_gtk_get_widget(w,"viewswitch");
LinphoneAddress *addr;
const LinphoneAddress *addr;
gtk_tree_model_get (model, &iter,FRIEND_ID , &lf, -1);
gtk_tree_model_get (model, &iter,FRIEND_CHATROOM , &cr, -1);
addr=linphone_friend_get_address(lf);
......@@ -420,7 +416,6 @@ void linphone_gtk_chat_selected(GtkWidget *item){
} else {
linphone_gtk_load_chatroom(cr,addr,page);
}
linphone_address_unref(addr);
linphone_gtk_mark_chat_read(cr);
gtk_notebook_set_current_page(notebook,gtk_notebook_page_num(notebook,page));
g_idle_add((GSourceFunc)grab_focus,linphone_gtk_get_widget(page,"text_entry"));
......@@ -607,12 +602,11 @@ void linphone_gtk_friend_list_on_name_column_clicked(GtkTreeModel *model){
static int get_friend_weight(const LinphoneFriend *lf){
int w=0;
LinphoneCore *lc=linphone_gtk_get_core();
LinphoneAddress *addr = linphone_friend_get_address(lf);
const LinphoneAddress *addr = linphone_friend_get_address(lf);
LinphoneChatRoom *cr = NULL;
if (addr != NULL) {
cr = linphone_core_get_chat_room(lc, addr);
linphone_address_unref(addr);
}
if (cr && linphone_chat_room_get_unread_messages_count(cr)>0){
w+=2000;
......@@ -639,7 +633,7 @@ static int friend_compare_func(const LinphoneFriend *lf1, const LinphoneFriend *
w2=get_friend_weight(lf2);
if (w1==w2){
const char *u1,*u2;
LinphoneAddress *addr1,*addr2;
const LinphoneAddress *addr1,*addr2;
addr1=linphone_friend_get_address(lf1);
addr2=linphone_friend_get_address(lf2);
if ((addr1 == NULL) && (addr2 == NULL)) return 0;
......@@ -654,8 +648,6 @@ static int friend_compare_func(const LinphoneFriend *lf1, const LinphoneFriend *
} else {
ret = -1;
}
linphone_address_unref(addr1);
linphone_address_unref(addr2);
} else {
ret = w2-w1;
}
......@@ -777,7 +769,7 @@ void linphone_gtk_show_friends(void){
for(itf=sorted;itf!=NULL;itf=bctbx_list_next(itf)){
LinphoneFriend *lf=(LinphoneFriend*)itf->data;
LinphoneAddress *f_addr=linphone_friend_get_address(lf);
const LinphoneAddress *f_addr=linphone_friend_get_address(lf);
const char *name=linphone_friend_get_name(lf);
char *uri = NULL;
const char *display=name;
......@@ -806,7 +798,6 @@ void linphone_gtk_show_friends(void){
escaped=g_markup_escape_text(uri,-1);
gtk_list_store_set(store,&iter,FRIEND_SIP_ADDRESS,escaped,-1);
g_free(escaped);
linphone_address_unref(f_addr);
ms_free(uri);
}
}
......@@ -817,7 +808,7 @@ void linphone_gtk_show_contact(LinphoneFriend *lf, GtkWidget *parent){
GtkWidget *w = linphone_gtk_create_window("contact", parent);
char *uri;
const char *name = linphone_friend_get_name(lf);
LinphoneAddress *f_addr = linphone_friend_get_address(lf);
const LinphoneAddress *f_addr = linphone_friend_get_address(lf);
if (f_addr != NULL) {
uri=linphone_address_as_string_uri_only(f_addr);
......@@ -825,7 +816,6 @@ void linphone_gtk_show_contact(LinphoneFriend *lf, GtkWidget *parent){
gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"sip_address")),uri);
ms_free(uri);
}
linphone_address_unref(f_addr);
}
if (name){
......
......@@ -677,7 +677,7 @@ void on_contact_provider_search_results( LinphoneContactSearch* req, bctbx_list_
while( friends ){
LinphoneFriend* lf = friends->data;
if( lf ) {
LinphoneAddress* la = linphone_friend_get_address(lf);
const LinphoneAddress* la = linphone_friend_get_address(lf);
if( la ){
char *addr = linphone_address_as_string(la);
......@@ -688,7 +688,6 @@ void on_contact_provider_search_results( LinphoneContactSearch* req, bctbx_list_
1, COMPLETION_LDAP, -1);
ms_free(addr);
}
linphone_address_unref(la);
}
}
friends = friends->next;
......
......@@ -807,7 +807,7 @@ static void linphone_gtk_codec_move(GtkWidget *button, int dir, int type){ /* 0=
else before=sel_elem;
codec_list=bctbx_list_insert(codec_list,before,pt);
}
codec_list=bctbx_list_remove_link(codec_list,sel_elem);
codec_list=bctbx_list_erase_link(codec_list,sel_elem);
if (pt->type==PAYLOAD_VIDEO)
linphone_core_set_video_codecs(lc,codec_list);
else linphone_core_set_audio_codecs(lc,codec_list);
......
mediastreamer2 @ 5feed435
Subproject commit 28ade0c3e76761ad7fa35ebaa7c68e98599de17e
Subproject commit 5feed4355361ef5dfd22317c68851131891a62d5
oRTP @ 5d58ed7b
Subproject commit 9522d4f0d06bb41fd5c684804d5fdb665664bf03
Subproject commit 5d58ed7bead312e77bd6f0ac0328352250dd1349
......@@ -393,7 +393,7 @@ static void test_presence_list_base(bool_t enable_compression) {
linphone_core_remove_friend_list(marie->lc, linphone_core_get_default_friend_list(marie->lc));
linphone_core_add_friend_list(marie->lc, lfl);
linphone_friend_list_unref(lfl);
linphone_friend_list_update_subscriptions(linphone_core_get_default_friend_list(marie->lc), NULL, FALSE);
linphone_friend_list_update_subscriptions(linphone_core_get_default_friend_list(marie->lc));
wait_for_list(lcs, &marie->stat.number_of_NotifyPresenceReceived, 1, 4000);
BC_ASSERT_EQUAL(marie->stat.number_of_NotifyPresenceReceived, 1, int, "%d");
......@@ -411,7 +411,7 @@ static void test_presence_list_base(bool_t enable_compression) {
linphone_core_remove_friend_list(pauline->lc, linphone_core_get_default_friend_list(pauline->lc));
linphone_core_add_friend_list(pauline->lc, lfl);
linphone_friend_list_unref(lfl);
linphone_friend_list_update_subscriptions(linphone_core_get_default_friend_list(pauline->lc), NULL, FALSE);
linphone_friend_list_update_subscriptions(linphone_core_get_default_friend_list(pauline->lc));
wait_for_list(lcs, &pauline->stat.number_of_NotifyPresenceReceived, 1, 4000);
BC_ASSERT_EQUAL(pauline->stat.number_of_NotifyPresenceReceived, 1, int, "%d");
......@@ -476,6 +476,7 @@ static void test_presence_list_base(bool_t enable_compression) {
, LinphonePresenceActivityOnline, int, "%d"); fixme, should be LinphonePresenceActivityUnknown*/
end:
bctbx_list_free(lcs);
linphone_core_manager_destroy(laure);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
......@@ -555,7 +556,7 @@ static void test_presence_list_subscription_expire_for_unknown(void) {
linphone_friend_list_add_friend(lfl, lf);
linphone_core_remove_friend_list(laure->lc, linphone_core_get_default_friend_list(laure->lc));
linphone_core_add_friend_list(laure->lc, lfl);
linphone_friend_list_update_subscriptions(lfl,NULL,FALSE);
linphone_friend_list_update_subscriptions(lfl);
linphone_friend_list_unref(lfl);
/* wait for refresh*/
......@@ -593,7 +594,7 @@ static void test_presence_list_subscribe_with_error(bool_t io_error) {
linphone_core_add_friend_list(laure->lc, lfl);
linphone_friend_list_unref(lfl);
linphone_core_set_presence_model(laure->lc, linphone_core_create_presence_model_with_activity(laure->lc, LinphonePresenceActivityOnline, NULL));
linphone_friend_list_update_subscriptions(linphone_core_get_default_friend_list(laure->lc), NULL, FALSE);
linphone_friend_list_update_subscriptions(linphone_core_get_default_friend_list(laure->lc));
lcs = bctbx_list_append(lcs, laure->lc);
lcs = bctbx_list_append(lcs, pauline->lc);
......
......@@ -38,11 +38,10 @@ static LinphoneCoreManager* presence_linphone_core_manager_new(char* username) {
void new_subscription_requested(LinphoneCore *lc, LinphoneFriend *lf, const char *url){
stats* counters;
LinphoneAddress *addr = linphone_friend_get_address(lf);
const LinphoneAddress *addr = linphone_friend_get_address(lf);
if (addr != NULL) {
char* from=linphone_address_as_string(addr);
ms_message("New subscription request from [%s] url [%s]",from,url);
linphone_address_unref(addr);
ms_free(from);
}
counters = get_stats(lc);
......@@ -53,11 +52,10 @@ void new_subscription_requested(LinphoneCore *lc, LinphoneFriend *lf, const char
void notify_presence_received(LinphoneCore *lc, LinphoneFriend * lf) {
stats* counters;
unsigned int i;
LinphoneAddress *addr = linphone_friend_get_address(lf);
const LinphoneAddress *addr = linphone_friend_get_address(lf);
if (addr != NULL) {
char* from=linphone_address_as_string(addr);
ms_message("New Notify request from [%s] ",from);
linphone_address_unref(addr);
ms_free(from);
}
counters = get_stats(lc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment