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
00032
00033 #ifndef PRESENCE_HH
00034 #define PRESENCE_HH
00035
00036 #include <packet.hh>
00037
00038 namespace jabberoo
00039 {
00045 class Presence
00046 : public Packet
00047 {
00048 public:
00052 enum Type {
00053 ptSubRequest,
00054 ptUnsubRequest,
00055 ptSubscribed,
00056 ptUnsubscribed,
00057 ptAvailable,
00058 ptUnavailable,
00059 ptError,
00060 ptInvisible
00061 };
00062
00068 enum Show {
00069 stInvalid,
00070 stOffline,
00071 stOnline,
00072 stChat,
00073 stAway,
00074 stXA,
00075 stDND
00076 };
00077
00084 Presence(const judo::Element& t);
00085
00095 Presence(const std::string& jid, Type ptype, Show stype = stInvalid, const std::string& status = "", const std::string& priority = "0");
00096
00097
00103 void setType(Presence::Type ptype);
00108 void setStatus(const std::string& status);
00114 void setShow(Presence::Show stype);
00119 void setPriority(const std::string& priority);
00120
00121
00127 Type getType() const;
00133 Show getShow() const;
00139 const std::string getStatus() const;
00145 const std::string getShow_str() const;
00153 int getPriority() const;
00154
00155 protected:
00156 static std::string translateType(Type ptype);
00157 static Type translateType(const std::string& ptype);
00158 static std::string translateShow(Show stype);
00159 static Show translateShow(Type ptype, const std::string& stype);
00160
00161 private:
00162 Show _show;
00163 Type _type;
00164 int _priority;
00165 };
00166 }
00167
00168 #endif // PRESENCE_HH