]> sjero.net Git - linphone/commitdiff
fix several bug in presence support again.
authorSimon Morlat <simon.morlat@linphone.org>
Tue, 16 Mar 2010 10:55:30 +0000 (11:55 +0100)
committerSimon Morlat <simon.morlat@linphone.org>
Tue, 16 Mar 2010 10:55:30 +0000 (11:55 +0100)
coreapi/friend.c
coreapi/linphonecore.c
coreapi/private.h
coreapi/sal_eXosip2.c
coreapi/sal_eXosip2.h
coreapi/sal_eXosip2_presence.c

index a4ca5484006a7abd9fe2e227b4db0670c3a002c6..68f43e65946af9057bca02f6bec4c95ff8b42e06 100644 (file)
@@ -299,13 +299,18 @@ static void linphone_friend_unsubscribe(LinphoneFriend *lf){
        }
 }
 
-void linphone_friend_destroy(LinphoneFriend *lf){
+void linphone_friend_close_subscriptions(LinphoneFriend *lf){
        linphone_friend_notify(lf,LINPHONE_STATUS_OFFLINE);
        linphone_friend_unsubscribe(lf);
        if (lf->insub){
                sal_notify_close(lf->insub);
                sal_op_release(lf->insub);
+               lf->insub=NULL;
        }
+}
+
+void linphone_friend_destroy(LinphoneFriend *lf){
+       
        if (lf->uri!=NULL) linphone_address_destroy(lf->uri);
        if (lf->info!=NULL) buddy_info_free(lf->info);
        ms_free(lf);
index ddb09892c2a10f9d82c97d40a0762a3c2d127984..f699a2a3efdddd80538bff8324421e0f193d7a7b 100644 (file)
@@ -1392,7 +1392,6 @@ int linphone_core_get_sip_port(LinphoneCore *lc)
        return lc->sip_conf.sip_port;
 }
 
-static bool_t exosip_running=FALSE;
 static char _ua_name[64]="Linphone";
 static char _ua_version[64]=LINPHONE_VERSION;
 
@@ -3389,6 +3388,8 @@ static void linphone_core_uninit(LinphoneCore *lc)
                        linphone_core_iterate(lc);
                }
        }
+       if (lc->friends)
+               ms_list_for_each(lc->friends,(void (*)(void *))linphone_friend_close_subscriptions);
        gstate_new_state(lc, GSTATE_POWER_SHUTDOWN, NULL);
 #ifdef VIDEO_ENABLED
        if (lc->previewstream!=NULL){
@@ -3412,7 +3413,6 @@ static void linphone_core_uninit(LinphoneCore *lc)
        linphone_core_free_payload_types();
 
        ortp_exit();
-       exosip_running=FALSE;
        gstate_new_state(lc, GSTATE_POWER_OFF, NULL);
 }
 
index 84b4d07787e2ea71456b6ceb087ecacb3336bdca..cbb767207ff87021941c2bf162e70c0c1eb4bd29 100644 (file)
@@ -101,7 +101,7 @@ void linphone_core_refresh_subscribes(LinphoneCore *lc);
 int linphone_proxy_config_send_publish(LinphoneProxyConfig *cfg, LinphoneOnlineStatus os);
 
 int linphone_online_status_to_eXosip(LinphoneOnlineStatus os);
-
+void linphone_friend_close_subscriptions(LinphoneFriend *lf);
 void linphone_friend_notify(LinphoneFriend *lf, LinphoneOnlineStatus os);
 LinphoneFriend *linphone_find_friend_by_inc_subscribe(MSList *l, SalOp *op);
 LinphoneFriend *linphone_find_friend_by_out_subscribe(MSList *l, SalOp *op);
index f8a45edb9def0328b88668ffaba9dd70a6ded4c1..5f337b3fa0b468dcb3d0d25a7d92e2cfc7dc235a 100644 (file)
@@ -153,6 +153,12 @@ void sal_op_release(SalOp *op){
                ms_message("Cleaning cid %i",op->cid);
                eXosip_call_set_reference(op->cid,NULL);
        }
+       if (op->sid!=-1){
+               sal_remove_out_subscribe(op->base.root,op);
+       }
+       if (op->nid!=-1){
+               sal_remove_in_subscribe(op->base.root,op);
+       }
        if (op->pending_auth){
                sal_remove_pending_auth(op->base.root,op);
        }
index 22694813477cac7dbce22777f91ba685b8638386..6539dcae895684106a4c1571d8f48baaf92c4766 100644 (file)
@@ -59,6 +59,9 @@ struct SalOp{
        bool_t reinvite;
 };
 
+void sal_remove_out_subscribe(Sal *sal, SalOp *op);
+void sal_remove_in_subscribe(Sal *sal, SalOp *op);
+
 void sal_exosip_subscription_recv(Sal *sal, eXosip_event_t *ev);
 void sal_exosip_subscription_answered(Sal *sal,eXosip_event_t *ev);
 void sal_exosip_notify_recv(Sal *sal,eXosip_event_t *ev);
index f6c85b5f2cb86f0504788d5ceffa94952b18ec54..11104b8d1ac9635a69408085f984eadd0304029b 100644 (file)
@@ -35,16 +35,8 @@ static void sal_add_out_subscribe(Sal *sal, SalOp *op){
        sal->out_subscribes=ms_list_append(sal->out_subscribes,op);
 }
 
-static void sal_remove_out_subscribe(Sal *sal, int sid){
-       MSList *elem;
-       SalOp *op;
-       for(elem=sal->out_subscribes;elem!=NULL;elem=elem->next){
-               op=(SalOp*)elem->data;
-               if (op->sid==sid) {
-                       sal->out_subscribes=ms_list_remove_link(sal->out_subscribes,elem);
-                       return;
-               }
-       }
+void sal_remove_out_subscribe(Sal *sal, SalOp *op){
+       sal->out_subscribes=ms_list_remove(sal->out_subscribes,op);
 }
 
 static SalOp * sal_find_in_subscribe(Sal *sal, int nid){
@@ -61,16 +53,8 @@ static void sal_add_in_subscribe(Sal *sal, SalOp *op){
        sal->in_subscribes=ms_list_append(sal->in_subscribes,op);
 }
 
-static void sal_remove_in_subscribe(Sal *sal, int nid){
-       MSList *elem;
-       SalOp *op;
-       for(elem=sal->in_subscribes;elem!=NULL;elem=elem->next){
-               op=(SalOp*)elem->data;
-               if (op->nid==nid) {
-                       sal->in_subscribes=ms_list_remove_link(sal->in_subscribes,elem);
-                       return;
-               }
-       }
+void sal_remove_in_subscribe(Sal *sal, SalOp *op){
+       sal->in_subscribes=ms_list_remove(sal->in_subscribes,op);
 }
 
 int sal_text_send(SalOp *op, const char *from, const char *to, const char *msg){
@@ -659,7 +643,7 @@ void sal_exosip_notify_recv(Sal *sal, eXosip_event_t *ev){
        }
        ms_message("We are notified that %s has online status %i",tmp,estatus);
        if (ev->ss_status==EXOSIP_SUBCRSTATE_TERMINATED) {
-               sal_remove_out_subscribe(sal,op->sid);
+               sal_remove_out_subscribe(sal,op);
                op->sid=-1;
                op->did=-1;
                ms_message("And outgoing subscription terminated by remote.");
@@ -683,9 +667,9 @@ void sal_exosip_subscription_closed(Sal *sal,eXosip_event_t *ev){
                ms_error("Subscription closed but no associated op !");
                return;
        }
-       sal_remove_in_subscribe(sal,op->nid);
+       sal_remove_in_subscribe(sal,op);
        op->nid=-1;
-       op->did=0;
+       op->did=-1;
 }