31 #ifndef OPAL_IM_PRES_ENT_H 32 #define OPAL_IM_PRES_ENT_H 37 #include <ptlib/pfactory.h> 38 #include <ptlib/safecoll.h> 39 #include <ptclib/url.h> 40 #include <ptclib/guid.h> 41 #include <ptclib/vcard.h> 114 Comparison
Compare(
const PObject & other)
const;
154 const PString & scheme = PString::Empty()
173 virtual bool IsOpen()
const {
return m_open; }
177 virtual bool Close();
182 PStringOptions & GetAttributes() {
return m_attributes; }
186 virtual PStringArray GetAttributeNames()
const = 0;
189 virtual PStringArray GetAttributeTypes()
const = 0;
191 static const PCaselessString & AuthNameKey();
192 static const PCaselessString & AuthPasswordKey();
193 static const PCaselessString & TimeToLiveKey();
199 const PURL &
GetAOR()
const {
return m_aor; }
212 virtual bool SubscribeToPresence(
213 const PURL & presentity,
214 bool subscribe =
true,
215 const PString & note = PString::Empty()
226 virtual bool UnsubscribeFromPresence(
227 const PURL & presentity
250 virtual bool SetPresenceAuthorisation(
251 const PURL & presentity,
262 virtual bool SetLocalPresence(
264 const PString & note = PString::Empty()
269 virtual bool GetLocalPresence(
282 return dynamic_cast<cls *
>(InternalCreateCommand(
typeid(cls).name()));
296 virtual bool SendCommand(
316 virtual void OnAuthorisationRequest(
321 #define PDECLARE_AuthorisationRequestNotifier(cls, fn) PDECLARE_NOTIFIER2(OpalPresentity, cls, fn, const OpalPresentity::AuthorisationRequest &) 322 #define PCREATE_AuthorisationRequestNotifier(fn) PCREATE_NOTIFIER2(fn, const OpalPresentity::AuthorisationRequest &) 325 void SetAuthorisationRequestNotifier(
326 const AuthorisationRequestNotifier & notifier
337 virtual void OnPresenceChange(
342 #define PDECLARE_PresenceChangeNotifier(cls, fn) PDECLARE_NOTIFIER2(OpalPresentity, cls, fn, const OpalPresenceInfo &) 343 #define PCREATE_PresenceChangeNotifier(fn) PCREATE_NOTIFIER2(fn, const OpalPresenceInfo &) 346 void SetPresenceChangeNotifier(
347 const PresenceChangeNotifier & notifier
359 const PURL & presentity = PString::Empty(),
360 const PString & displayName = PString::Empty()
361 ) : m_presentity(presentity)
362 , m_displayName(displayName)
394 BuddyStatus_GenericFailure = -1,
402 BuddyStatus_AccountNotLoggedIn
413 {
return GetBuddyListEx(buddies) == BuddyStatus_OK; }
418 const BuddyList & buddies
421 const BuddyList & buddies
423 {
return SetBuddyListEx(buddies) == BuddyStatus_OK; }
441 {
return GetBuddyEx(buddy) == BuddyStatus_OK; }
451 {
return SetBuddyEx(buddy) == BuddyStatus_OK; }
456 const PURL & presentity
459 const PURL & presentity
461 {
return DeleteBuddyEx(presentity) == BuddyStatus_OK; }
469 PINDEX & successfulCount,
470 bool subscribe =
true 473 bool subscribe =
true 475 { PINDEX successfulCount;
return SubscribeBuddyListEx(successfulCount, subscribe) == BuddyStatus_OK; }
484 {
return UnsubscribeBuddyListEx() == BuddyStatus_OK; }
490 virtual bool SendMessageTo(
498 virtual void OnReceivedMessage(
503 #define PDECLARE_ReceivedMessageNotifier(cls, fn) PDECLARE_NOTIFIER2(OpalPresentity, cls, fn, const OpalIM &) 504 #define PCREATE_ReceivedMessageNotifier(fn) PCREATE_NOTIFIER2(fn, const OpalIM &) 507 void SetReceivedMessageNotifier(
508 const ReceivedMessageNotifier & notifier
578 virtual bool SendCommand(
596 bool startQueue =
true 609 bool startQueue =
true 635 : m_responseNeeded(responseNeeded)
642 virtual void Process(
654 #define OPAL_DEFINE_COMMAND(command, entity, func) \ 655 class entity##_##command : public command \ 657 public: virtual void Process(OpalPresentity & presentity) { dynamic_cast<entity &>(presentity).func(*this); } \ 659 static PFactory<OpalPresentityCommand>::Worker<entity##_##command> \ 660 s_##entity##_##command(PDefaultPFactoryKey(entity::Class())+typeid(command).name()) 713 #if OPAL_SIP && OPAL_PTLIB_EXPAT 718 #endif // OPAL_IM_PRES_ENT_H State m_state
New state for presentity.
Definition: pres_ent.h:102
BuddyInfo(const PURL &presentity=PString::Empty(), const PString &displayName=PString::Empty())
Definition: pres_ent.h:358
bool m_temporarilyUnavailable
Definition: pres_ent.h:536
Definition: pres_ent.h:66
ReceivedMessageNotifier m_onReceivedMessageNotifier
Definition: pres_ent.h:532
OpalSubscribeToPresenceCommand(bool subscribe=true)
Definition: pres_ent.h:667
Definition: pres_ent.h:396
ostream & operator<<(ostream &strm, OpalPresenceInfo::State state)
Definition: pres_ent.h:61
virtual bool SetBuddy(const BuddyInfo &buddy)
Definition: pres_ent.h:448
Definition: pres_ent.h:84
Definition: pres_ent.h:397
OpalPresentityCommand(bool responseNeeded=false)
Definition: pres_ent.h:634
PURL m_presentity
Other presentity requesting our presence.
Definition: pres_ent.h:305
Definition: pres_ent.h:81
Definition: pres_ent.h:680
Comparison Compare(const PObject &other) const
Definition: pres_ent.h:96
Definition: pres_ent.h:234
Definition: pres_ent.h:72
__inline cls * CreateCommand()
Definition: pres_ent.h:280
Definition: pres_ent.h:73
CommandQueue m_commandQueue
Definition: pres_ent.h:618
virtual bool UnsubscribeBuddyList()
Definition: pres_ent.h:483
PvCard m_vCard
Definition: pres_ent.h:370
virtual bool GetBuddy(BuddyInfo &buddy)
Definition: pres_ent.h:438
Definition: pres_ent.h:303
const PURL & GetAOR() const
Definition: pres_ent.h:199
BuddyStatus
Definition: pres_ent.h:393
PString m_note
Optional extra note attached to request.
Definition: pres_ent.h:306
Definition: pres_ent.h:76
Definition: pres_ent.h:85
bool m_queueRunning
Definition: pres_ent.h:624
Definition: pres_ent.h:357
PString m_note
Optional extra note attached to subscription request.
Definition: pres_ent.h:685
Definition: pres_ent.h:75
PURL m_homePage
Home page for buddy.
Definition: pres_ent.h:384
PFACTORY_LOAD(OpalPluginCodecManager)
Definition: pres_ent.h:74
std::queue< OpalPresentityCommand * > CommandQueue
Definition: pres_ent.h:617
PString m_rawXML
Raw XML of buddy list entry.
Definition: pres_ent.h:388
PString m_note
Optional extra note attached to subscription request.
Definition: pres_ent.h:670
CmdSeqType m_sequence
Definition: pres_ent.h:647
OpalIM m_message
Definition: pres_ent.h:707
Definition: pres_ent.h:86
PresenceChangeNotifier m_onPresenceChangeNotifier
Definition: pres_ent.h:531
virtual bool SetBuddyList(const BuddyList &buddies)
Definition: pres_ent.h:420
virtual bool IsOpen() const
Definition: pres_ent.h:173
bool m_responseNeeded
Definition: pres_ent.h:648
PURL m_map
Definition: pres_ent.h:378
Definition: pres_ent.h:236
PSyncPoint m_commandQueueSync
Definition: pres_ent.h:621
PString m_displayName
Human readable name.
Definition: pres_ent.h:366
virtual bool GetBuddyList(BuddyList &buddies)
Definition: pres_ent.h:410
Definition: pres_ent.h:233
Definition: pres_ent.h:665
PURL m_presentity
Definition: pres_ent.h:649
Definition: pres_ent.h:77
PAtomicBoolean m_open
Definition: pres_ent.h:534
Definition: pres_ent.h:83
PString m_contentType
MIME type code for XML.
Definition: pres_ent.h:387
Definition: pres_ent.h:398
Definition: pres_ent.h:135
OpalPresenceInfo::State m_localState
our presentity state
Definition: pres_ent.h:537
Definition: pres_ent.h:62
virtual bool DeleteBuddy(const PURL &presentity)
Definition: pres_ent.h:458
PMutex m_commandQueueMutex
Definition: pres_ent.h:619
OpalSetLocalPresenceCommand(State state=NoPresence)
Definition: pres_ent.h:696
virtual bool DeleteBuddyList()
Definition: pres_ent.h:429
State
Presence states.
Definition: pres_ent.h:60
Definition: pres_ent.h:92
PString m_note
Additional information about state change.
Definition: pres_ent.h:103
Definition: pres_ent.h:68
PURL m_icon
Definition: pres_ent.h:374
Definition: pres_ent.h:80
Definition: pres_ent.h:547
virtual ~OpalPresentityCommand()
Definition: pres_ent.h:637
Definition: pres_ent.h:90
PURL m_sound
Definition: pres_ent.h:380
Definition: pres_ent.h:79
PURL m_target
The presentity that is being informed about the state change.
Definition: pres_ent.h:105
Definition: pres_ent.h:694
PMutex m_notificationMutex
Definition: pres_ent.h:535
Definition: pres_ent.h:400
OpalAuthorisationRequestCommand()
Definition: pres_ent.h:682
Definition: pres_ent.h:401
std::list< BuddyInfo > BuddyList
Definition: pres_ent.h:391
Definition: pres_ent.h:87
Definition: pres_ent.h:99
PURL m_presentity
Typicall URI address-of-record.
Definition: pres_ent.h:365
PAtomicInteger::IntegerType CmdSeqType
Definition: pres_ent.h:646
Definition: pres_ent.h:63
Definition: pres_ent.h:78
OpalManager * m_manager
Definition: pres_ent.h:525
static State FromString(const PString &str)
Definition: pres_ent.h:399
Definition: pres_ent.h:88
Definition: pres_ent.h:89
PURL m_aor
Definition: pres_ent.h:527
Definition: pres_ent.h:232
OpalPresentity::Authorisation m_authorisation
Authorisation mode to indicate to remote.
Definition: pres_ent.h:684
PGloballyUniqueID m_guid
Definition: pres_ent.h:526
bool m_subscribe
Flag to indicate subscribing/unsubscribing.
Definition: pres_ent.h:669
virtual bool SubscribeBuddyList(bool subscribe=true)
Definition: pres_ent.h:472
Definition: pres_ent.h:98
PNotifierTemplate< const OpalIM & > ReceivedMessageNotifier
Definition: pres_ent.h:502
OpalPresenceInfo(State state=Unchanged)
Definition: pres_ent.h:108
Definition: pres_ent.h:94
PURL m_entity
The presentity whose state had changed.
Definition: pres_ent.h:104
Definition: pres_ent.h:67
Definition: pres_ent.h:632
Definition: pres_ent.h:235
Definition: pres_ent.h:702
Definition: pres_ent.h:56
OpalSendMessageToCommand()
Definition: pres_ent.h:705
bool m_threadRunning
Definition: pres_ent.h:623
Definition: pres_ent.h:95
PNotifierTemplate< const AuthorisationRequest & > AuthorisationRequestNotifier
Definition: pres_ent.h:320
Authorisation
Authorisation modes for SetPresenceAuthorisation()
Definition: pres_ent.h:231
PStringOptions m_attributes
Definition: pres_ent.h:528
Definition: pres_ent.h:82
PThread * m_thread
Definition: pres_ent.h:625
Definition: pres_ent.h:93
AuthorisationRequestNotifier m_onAuthorisationRequestNotifier
Definition: pres_ent.h:530
PNotifierTemplate< const OpalPresenceInfo & > PresenceChangeNotifier
Definition: pres_ent.h:341
PString m_localStateNote
Additional note attached to the.
Definition: pres_ent.h:538
Definition: pres_ent.h:97
Definition: pres_ent.h:91
PAtomicInteger m_commandSequence
Definition: pres_ent.h:620
PTime m_when
Time/date of state change.
Definition: pres_ent.h:106