00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef OPAL_IM_PRES_ENT_H
00032 #define OPAL_IM_PRES_ENT_H
00033
00034 #include <ptlib.h>
00035 #include <opal/buildopts.h>
00036
00037 #include <opal/manager.h>
00038 #include <ptclib/url.h>
00039 #include <sip/sipep.h>
00040
00042
00043 class OpalPresEntity : public PSafeObject
00044 {
00045 public:
00046 static const char * AddressOfRecordKey;
00047 static const char * AuthNameKey;
00048 static const char * AuthPasswordKey;
00049 static const char * FullNameKey;
00050 static const char * TimeToLiveKey;
00051
00052 enum State {
00053
00054 Unknown = SIPPresenceInfo::Unknown,
00055 Available,
00056 NotAvailable,
00057 Unchanged,
00058
00059
00060 ExtendedBase = 100,
00061 UnknownExtended = ExtendedBase + SIPPresenceInfo::UnknownExtended,
00062 Appointment,
00063 Away,
00064 Breakfast,
00065 Busy,
00066 Dinner,
00067 Holiday,
00068 InTransit,
00069 LookingForWork,
00070 Lunch,
00071 Meal,
00072 Meeting,
00073 OnThePhone,
00074 Other,
00075 Performance,
00076 PermanentAbsence,
00077 Playing,
00078 Presentation,
00079 Shopping,
00080 Sleeping,
00081 Spectator,
00082 Steering,
00083 Travel,
00084 TV,
00085 Vacation,
00086 Working,
00087 Worship
00088 };
00089
00090 static OpalPresEntity * Create(
00091 const PString & url
00092 );
00093
00094 virtual bool Open(
00095 OpalManager & manager
00096 );
00097
00098 virtual bool Open(
00099 OpalManager & manager,
00100 const OpalGloballyUniqueID & uid
00101 ) = 0;
00102
00103 virtual bool IsOpen() const = 0;
00104
00105 virtual bool Close() = 0;
00106
00107 virtual bool SetPresence(
00108 State state,
00109 const PString & note = PString::Empty()
00110 ) = 0;
00111
00112 virtual bool RemovePresence() = 0;
00113
00114 virtual bool HasAttribute(const PString & key) const
00115 { return m_attributes.Contains(key); }
00116
00117 virtual PString GetAttribute(const PString & key, const PString & deflt = PString::Empty()) const
00118 { return m_attributes(key, deflt); }
00119
00120 virtual void SetAttribute(const PString & key, const PString & value)
00121 { m_attributes.SetAt(key, value); }
00122
00123
00124 protected:
00125 OpalGloballyUniqueID m_guid;
00126
00127 PStringToString m_attributes;
00128 };
00129
00130 #endif // OPAL_IM_PRES_ENT_H
00131