]> sjero.net Git - linphone/blobdiff - coreapi/presence.c
Aac-eld add missing header according to RFC3640 3.3.6
[linphone] / coreapi / presence.c
index c56861d9df1a5ebcd1ea4c6d4b434b44e2e89798..ca63572588c764cfcde05fa5b7ff39f8d6e13cc9 100644 (file)
@@ -31,9 +31,9 @@ void linphone_core_add_subscriber(LinphoneCore *lc, const char *subscriber, SalO
        linphone_friend_set_inc_subscribe_policy(fl,LinphoneSPAccept);
        fl->inc_subscribe_pending=TRUE;
        lc->subscribers=ms_list_append(lc->subscribers,(void *)fl);
-       if (lc->vtable.new_unknown_subscriber!=NULL) {
+       if (lc->vtable.new_subscription_request!=NULL) {
                char *tmp=linphone_address_as_string(fl->uri);
-               lc->vtable.new_unknown_subscriber(lc,fl,tmp);
+               lc->vtable.new_subscription_request(lc,fl,tmp);
                ms_free(tmp);
        }
 }
@@ -57,11 +57,24 @@ void linphone_subscription_new(LinphoneCore *lc, SalOp *op, const char *from){
        LinphoneFriend *lf=NULL;
        char *tmp;
        LinphoneAddress *uri;
+       LinphoneProxyConfig *cfg;
+       const char *fixed_contact;
        
        uri=linphone_address_new(from);
        linphone_address_clean(uri);
        tmp=linphone_address_as_string(uri);
        ms_message("Receiving new subscription from %s.",from);
+
+       cfg=linphone_core_lookup_known_proxy(lc,uri);
+       if (cfg!=NULL){
+               if (cfg->op){
+                       fixed_contact=sal_op_get_contact(cfg->op);
+                       if (fixed_contact) {
+                               sal_op_set_contact (op,fixed_contact);
+                               ms_message("Contact for next subscribe answer has been fixed using proxy to %s",fixed_contact);
+                       }
+               }
+       }
        /* check if we answer to this subscription */
        if (linphone_find_friend(lc->friends,uri,&lf)!=NULL){
                lf->insub=op;
@@ -88,40 +101,40 @@ void linphone_subscription_new(LinphoneCore *lc, SalOp *op, const char *from){
        ms_free(tmp);
 }
 
-void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeState ss, SalPresenceStatus sal_status){
+void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, SalPresenceStatus sal_status){
        char *tmp;
        LinphoneFriend *lf;
        LinphoneAddress *friend=NULL;
-       LinphoneOnlineStatus estatus=LINPHONE_STATUS_OFFLINE;
+       LinphoneOnlineStatus estatus=LinphoneStatusOffline;
        
        switch(sal_status){
                case SalPresenceOffline:
-                       estatus=LINPHONE_STATUS_OFFLINE;
+                       estatus=LinphoneStatusOffline;
                break;
                case SalPresenceOnline:
-                       estatus=LINPHONE_STATUS_ONLINE;
+                       estatus=LinphoneStatusOnline;
                break;
                case SalPresenceBusy:
-                       estatus=LINPHONE_STATUS_BUSY;
+                       estatus=LinphoneStatusBusy;
                break;
                case SalPresenceBerightback:
-                       estatus=LINPHONE_STATUS_AWAY;
+                       estatus=LinphoneStatusBeRightBack;
                break;
                case SalPresenceAway:
-                       estatus=LINPHONE_STATUS_AWAY;
+                       estatus=LinphoneStatusAway;
                break;
                case SalPresenceOnthephone:
-                       estatus=LINPHONE_STATUS_ONTHEPHONE;
+                       estatus=LinphoneStatusOnThePhone;
                break;
                case SalPresenceOuttolunch:
-                       estatus=LINPHONE_STATUS_OUTTOLUNCH;
+                       estatus=LinphoneStatusOutToLunch;
                break;
                case SalPresenceDonotdisturb:
-                       estatus=LINPHONE_STATUS_BUSY;
+                       estatus=LinphoneStatusDoNotDisturb;
                break;
                case SalPresenceMoved:
                case SalPresenceAltService:
-                       estatus=LINPHONE_STATUS_AWAY;
+                       estatus=LinphoneStatusMoved;
                break;
        }
        lf=linphone_find_friend_by_out_subscribe(lc->friends,op);