- Timestamp:
- Nov 27, 2013 9:37:32 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/pjsua2/pjsip/include/pjsua2/account.hpp
r4644 r4657 26 26 #include <pjsua-lib/pjsua.h> 27 27 #include <pjsua2/persistent.hpp> 28 #include <pjsua2/presence.hpp> 28 29 #include <pjsua2/siptypes.hpp> 29 30 … … 913 914 }; 914 915 915 /**916 * This describes account presence status.917 */918 struct AccountPresenceStatus919 {920 /** Basic status. */921 bool isOnline;922 923 /** Activity type. */924 pjrpid_activity activity;925 926 /** Optional text describing the person/element. */927 string note;928 929 /** Optional RPID ID string. */930 string rpidId;931 932 public:933 AccountPresenceStatus();934 };935 936 916 937 917 /** … … 1071 1051 { 1072 1052 /** 1053 * Server presence subscription instance. If application delays 1054 * the acceptance of the request, it will need to specify this object 1055 * when calling Account::presNotify(). 1056 */ 1057 void *srvPres; 1058 1059 /** 1073 1060 * Sender URI. 1074 1061 */ … … 1220 1207 }; 1221 1208 1209 /** 1210 * Parameters for presNotify() account method. 1211 */ 1212 struct PresNotifyParam 1213 { 1214 /** 1215 * Server presence subscription instance. 1216 */ 1217 void *srvPres; 1218 1219 /** 1220 * Server presence subscription state to set. 1221 */ 1222 pjsip_evsub_state state; 1223 1224 /** 1225 * Optionally specify the state string name, if state is not "active", 1226 * "pending", or "terminated". 1227 */ 1228 string stateStr; 1229 1230 /** 1231 * If the new state is PJSIP_EVSUB_STATE_TERMINATED, optionally specify 1232 * the termination reason. 1233 */ 1234 string reason; 1235 1236 /** 1237 * If the new state is PJSIP_EVSUB_STATE_TERMINATED, this specifies 1238 * whether the NOTIFY request should contain message body containing 1239 * account's presence information. 1240 */ 1241 bool withBody; 1242 1243 /** 1244 * Optional list of headers to be sent with the NOTIFY request. 1245 */ 1246 SipTxOption txOption; 1247 }; 1248 1249 1250 /** 1251 * Wrapper class for Buddy matching algo. 1252 * 1253 * Default algo is a simple substring lookup of search-token in the 1254 * Buddy URIs, with case sensitive. Application can implement its own 1255 * matching algo by overriding this class and specifying its instance 1256 * in Account::findBuddy(). 1257 */ 1258 class FindBuddyMatch 1259 { 1260 public: 1261 /** 1262 * Default algo implementation. 1263 */ 1264 virtual bool match(const string &token, const Buddy &buddy) 1265 { 1266 BuddyInfo bi = buddy.getInfo(); 1267 return bi.uri.find(token) != string::npos; 1268 } 1269 1270 /** 1271 * Destructor. 1272 */ 1273 virtual ~FindBuddyMatch() {} 1274 }; 1222 1275 1223 1276 /** … … 1332 1385 * @param pres_st Presence online status. 1333 1386 */ 1334 void setOnlineStatus(const AccountPresenceStatus &pres_st) throw(Error);1387 void setOnlineStatus(const PresenceStatus &pres_st) throw(Error); 1335 1388 1336 1389 /** … … 1350 1403 void setTransport(TransportId tp_id) throw(Error); 1351 1404 1405 /** 1406 * Send NOTIFY to inform account presence status or to terminate server 1407 * side presence subscription. If application wants to reject the incoming 1408 * request, it should set the param \a PresNotifyParam.state to 1409 * PJSIP_EVSUB_STATE_TERMINATED. 1410 * 1411 * @param prm The sending NOTIFY parameter. 1412 */ 1413 void presNotify(const PresNotifyParam &prm) throw(Error); 1414 1415 /** 1416 * Enumerate all buddies of the account. 1417 * 1418 * @return The buddy list. 1419 */ 1420 const BuddyVector& enumBuddies() const throw(Error); 1421 1422 /** 1423 * Find a buddy in the buddy list with the specified URI. 1424 * 1425 * Exception: if buddy is not found, PJ_ENOTFOUND will be thrown. 1426 * 1427 * @param uri The buddy URI. 1428 * @param buddy_match The buddy match algo. 1429 * 1430 * @return The pointer to buddy. 1431 */ 1432 Buddy* findBuddy(string uri, FindBuddyMatch *buddy_match = NULL) const 1433 throw(Error); 1434 1435 /** 1436 * An internal function to add a Buddy to Account buddy list. 1437 * This function must never be used by application. 1438 */ 1439 void addBuddy(Buddy *buddy); 1440 1441 /** 1442 * An internal function to remove a Buddy from Account buddy list. 1443 * This function must never be used by application. 1444 */ 1445 void removeBuddy(Buddy *buddy); 1446 1352 1447 public: 1353 1448 /* … … 1360 1455 */ 1361 1456 virtual void onIncomingCall(OnIncomingCallParam &prm) 1362 { }1457 { PJ_UNUSED_ARG(prm); } 1363 1458 1364 1459 /** … … 1371 1466 */ 1372 1467 virtual void onRegStarted(OnRegStartedParam &prm) 1373 { }1468 { PJ_UNUSED_ARG(prm); } 1374 1469 1375 1470 /** … … 1381 1476 */ 1382 1477 virtual void onRegState(OnRegStateParam &prm) 1383 { }1478 { PJ_UNUSED_ARG(prm); } 1384 1479 1385 1480 /** … … 1403 1498 * user permission whether to accept or reject the request. In this 1404 1499 * case, the application MUST set the IncomingSubscribeParam.code 1405 * argument to 202, then IMMEDIATELY calls #pjsua_pres_notify() with1406 * state PJSIP_EVSUB_STATE_PENDING and later calls #pjsua_pres_notify()1500 * argument to 202, then IMMEDIATELY calls presNotify() with 1501 * state PJSIP_EVSUB_STATE_PENDING and later calls presNotify() 1407 1502 * again to accept or reject the subscription request. 1408 1503 * … … 1416 1511 */ 1417 1512 virtual void onIncomingSubscribe(OnIncomingSubscribeParam &prm) 1418 { }1513 { PJ_UNUSED_ARG(prm); } 1419 1514 1420 1515 /** … … 1425 1520 */ 1426 1521 virtual void onInstantMessage(OnInstantMessageParam &prm) 1427 { }1522 { PJ_UNUSED_ARG(prm); } 1428 1523 1429 1524 /** … … 1434 1529 */ 1435 1530 virtual void onInstantMessageStatus(OnInstantMessageStatusParam &prm) 1436 { }1531 { PJ_UNUSED_ARG(prm); } 1437 1532 1438 1533 /** … … 1442 1537 */ 1443 1538 virtual void onTypingIndication(OnTypingIndicationParam &prm) 1444 { }1539 { PJ_UNUSED_ARG(prm); } 1445 1540 1446 1541 /** … … 1453 1548 */ 1454 1549 virtual void onMwiInfo(OnMwiInfoParam &prm) 1455 { }1550 { PJ_UNUSED_ARG(prm); } 1456 1551 1457 1552 protected: … … 1461 1556 pjsua_acc_id id; 1462 1557 string tmpReason; // for saving response's reason 1558 BuddyVector buddyList; 1463 1559 }; 1464 1560
Note: See TracChangeset
for help on using the changeset viewer.