Changes between Version 4 and Version 5 of pjsip-doc/presence
- Timestamp:
- Feb 10, 2014 11:46:09 AM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
pjsip-doc/presence
v4 v5 4 4 Buddy (Presence) 5 5 ================ 6 This class represents a remote buddy (a person, or a SIP endpoint).6 Presence feature in PJSUA2 centers around Buddy class. This class represents a remote buddy (a person, or a SIP endpoint). 7 7 8 8 Subclassing the Buddy class 9 9 ---------------------------- 10 To use the Buddy class, normally application SHOULD create its own subclass, such as:: 10 To use the Buddy class, normally application SHOULD create its own subclass, such as: 11 12 .. code-block:: c++ 11 13 12 14 class MyBuddy : public Buddy … … 23 25 Subscribing to Buddy's Presence Status 24 26 --------------------------------------- 25 To subscribe to buddy's presence status, you need to add a buddy object and subscribe to buddy's presence status. The snippet below shows a sample code to achieve these:: 27 To subscribe to buddy's presence status, you need to add a buddy object and subscribe to buddy's presence status. The snippet below shows a sample code to achieve these: 28 29 .. code-block:: c++ 26 30 27 31 BuddyConfig cfg; … … 34 38 } 35 39 36 Then you can get the buddy's presence state change inside the onBuddyState() callback:: 40 Then you can get the buddy's presence state change inside the onBuddyState() callback: 41 42 .. code-block:: c++ 37 43 38 44 void MyBuddy::onBuddyState() … … 48 54 By default, incoming presence subscription to an account will be accepted automatically. You will probably want to change this behavior, for example only to automatically accept subscription if it comes from one of the buddy in the buddy list, and for anything else prompt the user if he/she wants to accept the request. 49 55 50 This can be done by overriding the onIncomingSubscribe() method of the Account class. 56 This can be done by overriding the onIncomingSubscribe() method of the Account class. Please see the documentation of this method for more info. 51 57 52 58 Changing Account's Presence Status 53 59 ---------------------------------- 54 To change account's presence status, you can use the function Account.setOnlineStatus() to set basic account's presence status (i.e. available or not available) and optionally, some extended information (e.g. busy, away, on the phone, etc), such as:: 60 To change account's presence status, you can use the function Account.setOnlineStatus() to set basic account's presence status (i.e. available or not available) and optionally, some extended information (e.g. busy, away, on the phone, etc), such as: 61 62 .. code-block:: c++ 55 63 56 64 try { … … 64 72 } 65 73 66 When the presence status is changed, the account will publish the new status to all of its presence subscriber, either with PUBLISH request or SUBSCRIBErequest, or both, depending on account configuration.74 When the presence status is changed, the account will publish the new status to all of its presence subscriber, either with PUBLISH request or NOTIFY request, or both, depending on account configuration. 67 75 68 76 Instant Messaging(IM)