Ignore:
Timestamp:
Nov 27, 2013 9:37:32 AM (8 years ago)
Author:
nanang
Message:

Re #1519: Added presence API in pjsua2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/pjsua2/pjsip/src/pjsua2/endpoint.cpp

    r4644 r4657  
    1919#include <pjsua2/endpoint.hpp> 
    2020#include <pjsua2/account.hpp> 
     21#include <pjsua2/presence.hpp> 
    2122#include "util.hpp" 
    2223 
     
    6364    } 
    6465 
    65     this->stunIgnoreFailure = ua_cfg.stun_ignore_failure; 
     66    this->stunIgnoreFailure = PJ2BOOL(ua_cfg.stun_ignore_failure); 
    6667    this->natTypeInSdp = ua_cfg.nat_type_in_sdp; 
    67     this->mwiUnsolicitedEnabled = ua_cfg.enable_unsolicited_mwi; 
     68    this->mwiUnsolicitedEnabled = PJ2BOOL(ua_cfg.enable_unsolicited_mwi); 
    6869} 
    6970 
     
    205206    this->audioFramePtime = mc.audio_frame_ptime; 
    206207    this->maxMediaPorts = mc.max_media_ports; 
    207     this->hasIoqueue = mc.has_ioqueue; 
     208    this->hasIoqueue = PJ2BOOL(mc.has_ioqueue); 
    208209    this->threadCnt = mc.thread_cnt; 
    209210    this->quality = mc.quality; 
    210211    this->ptime = mc.ptime; 
    211     this->noVad = mc.no_vad; 
     212    this->noVad = PJ2BOOL(mc.no_vad); 
    212213    this->ilbcMode = mc.ilbc_mode; 
    213214    this->txDropPct = mc.tx_drop_pct; 
     
    222223    this->jbMax = mc.jb_max; 
    223224    this->sndAutoCloseTime = mc.snd_auto_close_time; 
    224     this->vidPreviewEnableNative = mc.vid_preview_enable_native; 
     225    this->vidPreviewEnableNative = PJ2BOOL(mc.vid_preview_enable_native); 
    225226} 
    226227 
     
    362363    } catch (Error &err) { 
    363364        // Ignore 
     365        PJ_UNUSED_ARG(err); 
    364366    } 
    365367    delete writer; 
     
    412414                        pj_timer_entry *entry) 
    413415{ 
     416    PJ_UNUSED_ARG(timer_heap); 
     417 
    414418    Endpoint &ep = Endpoint::instance(); 
    415419    UserTimer *ut = (UserTimer*) entry->user_data; 
     
    505509 
    506510    OnRegStartedParam prm; 
    507     prm.renew = renew; 
     511    prm.renew = PJ2BOOL(renew); 
    508512    acc->onRegStarted(prm); 
    509513} 
     
    536540                                     pjsua_msg_data *msg_data) 
    537541{ 
     542    PJ_UNUSED_ARG(buddy_id); 
     543    PJ_UNUSED_ARG(srv_pres); 
     544 
    538545    Account *acc = lookupAcc(acc_id, "on_incoming_subscribe()"); 
    539546    if (!acc) { 
     
    543550 
    544551    OnIncomingSubscribeParam prm; 
     552    prm.srvPres         = srv_pres; 
    545553    prm.fromUri         = pj2Str(*from); 
    546554    prm.rdata.fromPj(*rdata); 
    547555    prm.code            = *code; 
    548556    prm.reason          = pj2Str(*reason); 
     557    prm.txOption.fromPj(*msg_data); 
    549558 
    550559    acc->onIncomingSubscribe(prm); 
     
    553562    acc->tmpReason = prm.reason; 
    554563    *reason = str2Pj(acc->tmpReason); 
    555     // TODO: 
    556     //  apply msg_data 
     564    prm.txOption.toPj(*msg_data); 
    557565} 
    558566 
     
    599607                                 pjsua_acc_id acc_id) 
    600608{ 
     609    PJ_UNUSED_ARG(tdata); 
     610 
    601611    OnInstantMessageStatusParam prm; 
    602612    prm.userData        = user_data; 
     
    667677} 
    668678 
     679void Endpoint::on_buddy_state(pjsua_buddy_id buddy_id) 
     680{ 
     681    Buddy *buddy = (Buddy*)pjsua_buddy_get_user_data(buddy_id); 
     682    if (!buddy || !buddy->isValid()) { 
     683        /* Ignored */ 
     684        return; 
     685    } 
     686 
     687    buddy->onBuddyState(); 
     688} 
     689 
    669690 
    670691/////////////////////////////////////////////////////////////////////////////// 
     
    723744    ua_cfg.cb.on_typing2        = &Endpoint::on_typing2; 
    724745    ua_cfg.cb.on_mwi_info       = &Endpoint::on_mwi_info; 
     746    ua_cfg.cb.on_buddy_state    = &Endpoint::on_buddy_state; 
    725747 
    726748    /* Init! */ 
Note: See TracChangeset for help on using the changeset viewer.