Ignore:
Timestamp:
Mar 10, 2010 4:06:04 PM (3 years ago)
Author:
laurent@…
Branch:
default
Message:

implement rfc 4480 for presence

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libs/sipwrapper/src/phapi/PhApiWrapper.cpp

    r439 r574  
    159159  
    160160 
    161         isOnline = false; 
     161        isOpen = false; 
     162        presence_activities = "close"; 
    162163 
    163164} 
     
    348349                } 
    349350 
    350                 publishOffline(String::null); 
     351                publishPresence(false,"offline",String::null); 
    351352                sleep(2); 
    352353                owplLineDelete(lineId, force); 
     
    685686        switch(state) { 
    686687        case EnumPresenceState::PresenceStateOnline: 
    687                 publishOnline(PresenceStateOnline); 
     688                publishPresence(true,"unknow",note); 
    688689                break; 
    689690 
    690691        case EnumPresenceState::PresenceStateAway: 
    691                 publishOnline(PresenceStateAway); 
     692                publishPresence(true,"away",note); 
    692693                break; 
    693694 
    694695        case EnumPresenceState::PresenceStateDoNotDisturb: 
    695                 publishOnline(PresenceStateDoNotDisturb); 
     696                publishPresence(false,"busy",note); 
    696697                break; 
    697698 
    698699        case EnumPresenceState::PresenceStateUserDefined: 
    699700                if (!sipOptions.sip_p2p_presence) 
    700                   publishOnline(note); 
     701                  publishPresence(true,presence_activities,note); 
    701702                break; 
    702703 
    703704        case EnumPresenceState::PresenceStateInvisible: 
     705                        publishPresence(false,"unknow",note); 
     706                break; 
     707                         
    704708        case EnumPresenceState::PresenceStateOffline: 
    705                 publishOffline(note); 
     709                publishPresence(false,"unknow",note); 
    706710                break; 
    707711 
     
    729733} 
    730734 
    731 void PhApiWrapper::publishOnline(const std::string & note) { 
     735/*void PhApiWrapper::publishOnline(const std::string & note) { 
    732736        if (_isInitialized) { 
    733737                publishPresence(true, note); 
     
    739743                publishPresence(false, note); 
    740744        } 
    741 } 
    742  
    743 void PhApiWrapper::publishPresence(bool online, const std::string & note) { 
     745}*/ 
     746 
     747void PhApiWrapper::publishPresence(bool open, const std::string & activities, const std::string & note) { 
    744748        static const std::string contentType = "application/pidf+xml"; 
    745749 
    746750        if (_isInitialized) { 
    747           isOnline = online; 
     751          isOpen = open; 
     752          presence_activities = activities; 
    748753          presence_note = note; 
    749754 
     
    752757              for (InSubIter isub = _incomingSubscriptions.begin(); isub != _incomingSubscriptions.end(); isub++) 
    753758                if (isub->second.state == SUBCONFIRMED) 
    754                   owplPresenceNotify(_wengoVline, isub->first, (online)?1:0, note.c_str(), 0); 
     759                  owplPresenceNotify(_wengoVline, isub->first, (open)?1:0, activities.c_str(), note.c_str(), 0); 
    755760               
    756761              myPresenceStatusEvent(*this, EnumPresenceState::MyPresenceStatusOk, note); 
    757762 
    758763            } 
    759           else  if(owplPresencePublish(_wengoVline, (online)?1:0, note.c_str(), NULL) != OWPL_RESULT_SUCCESS) { 
     764          else  if(owplPresencePublish(_wengoVline, (open)?1:0, activities.c_str(),  note.c_str()) != OWPL_RESULT_SUCCESS) { 
    760765                        myPresenceStatusEvent(*this, EnumPresenceState::MyPresenceStatusError, note); 
    761766                } else { 
     
    806811 
    807812  // FIXME:  will not work in multiline mode 
    808   owplSubscribeAccept(_wengoVline, sid, 202, (int) isOnline , presence_note.c_str()); 
     813  owplSubscribeAccept(_wengoVline, sid, 202, (int) isOpen , presence_activities.c_str() , presence_note.c_str()); 
    809814 
    810815   
Note: See TracChangeset for help on using the changeset viewer.