📄 xmpp__roster_8h-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>xmpp_roster.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center><hr><h1>xmpp_roster.h</h1><a href="xmpp__roster_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>00002 <span class="comment"> * xmpp_roster.h</span>00003 <span class="comment"> *</span>00004 <span class="comment"> * Extensible Messaging and Presence Protocol (XMPP) IM</span>00005 <span class="comment"> * Roster management classes</span>00006 <span class="comment"> *</span>00007 <span class="comment"> * Portable Windows Library</span>00008 <span class="comment"> *</span>00009 <span class="comment"> * Copyright (c) 2004 Reitek S.p.A.</span>00010 <span class="comment"> *</span>00011 <span class="comment"> * The contents of this file are subject to the Mozilla Public License</span>00012 <span class="comment"> * Version 1.0 (the "License"); you may not use this file except in</span>00013 <span class="comment"> * compliance with the License. You may obtain a copy of the License at</span>00014 <span class="comment"> * http://www.mozilla.org/MPL/</span>00015 <span class="comment"> *</span>00016 <span class="comment"> * Software distributed under the License is distributed on an "AS IS"</span>00017 <span class="comment"> * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See</span>00018 <span class="comment"> * the License for the specific language governing rights and limitations</span>00019 <span class="comment"> * under the License.</span>00020 <span class="comment"> *</span>00021 <span class="comment"> * The Original Code is Portable Windows Library.</span>00022 <span class="comment"> *</span>00023 <span class="comment"> * The Initial Developer of the Original Code is Post Increment</span>00024 <span class="comment"> *</span>00025 <span class="comment"> * Contributor(s): ______________________________________.</span>00026 <span class="comment"> *</span>00027 <span class="comment"> * $Log: xmpp_roster.h,v $</span>00028 <span class="comment"> * Revision 1.2 2004/05/09 07:23:46 rjongbloed</span>00029 <span class="comment"> * More work on XMPP, thanks Federico Pinna and Reitek S.p.A.</span>00030 <span class="comment"> *</span>00031 <span class="comment"> * Revision 1.1 2004/04/26 01:51:57 rjongbloed</span>00032 <span class="comment"> * More implementation of XMPP, thanks a lot to Federico Pinna & Reitek S.p.A.</span>00033 <span class="comment"> *</span>00034 <span class="comment"> *</span>00035 <span class="comment"> */</span>00036 00037 <span class="preprocessor">#ifndef _XMPP_ROSTER</span>00038 <span class="preprocessor"></span><span class="preprocessor">#define _XMPP_ROSTER</span>00039 <span class="preprocessor"></span>00040 <span class="preprocessor">#ifdef P_USE_PRAGMA</span>00041 <span class="preprocessor"></span><span class="preprocessor">#pragma interface</span>00042 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00043 <span class="preprocessor"></span>00044 <span class="preprocessor">#include <<a class="code" href="xmpp__c2s_8h.html">ptclib/xmpp_c2s.h</a>></span>00045 00046 <span class="preprocessor">#if P_EXPAT</span>00047 <span class="preprocessor"></span>00049 00050 <span class="keyword">namespace </span>XMPP00051 {00052 <span class="keyword">class </span>Roster : <span class="keyword">public</span> <a class="code" href="classPObject.html">PObject</a>00053 {00054 <a class="code" href="object_8h.html#a27">PCLASSINFO</a>(Roster, <a class="code" href="classPObject.html">PObject</a>);00055 <span class="keyword">public</span>:00056 00057 <span class="keyword">enum</span> ItemType { <span class="comment">// Subscription type</span>00058 None,00059 To,00060 From,00061 Both,00062 Unknown = 99900063 };00064 00065 <span class="keyword">class </span>Item : <span class="keyword">public</span> <a class="code" href="classPObject.html">PObject</a>00066 {00067 <a class="code" href="object_8h.html#a27">PCLASSINFO</a>(Item, <a class="code" href="classPObject.html">PObject</a>);00068 <a class="code" href="dict_8h.html#a2">PDICTIONARY</a>(PresenceInfo, <a class="code" href="classPString.html">PString</a>, Presence);00069 00070 <span class="keyword">public</span>:00071 Item(<a class="code" href="classPXMLElement.html">PXMLElement</a> * item = 0);00072 Item(<a class="code" href="classPXMLElement.html">PXMLElement</a>& item);00073 Item(<span class="keyword">const</span> JID& jid, ItemType type, <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a>& group, <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a>& name = <a class="code" href="classPString.html#z231_33">PString::Empty</a>());00074 00075 <span class="keyword">const</span> JID& GetJID()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_JID; }00076 ItemType GetType()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Type; }00077 <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a>& GetName()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Name; }00078 <span class="keyword">const</span> <a class="code" href="classPStringSet.html">PStringSet</a>& GetGroups()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Groups; }00079 <span class="keyword">const</span> PresenceInfo& GetPresence()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Presence; }00080 00081 <span class="keyword">virtual</span> <span class="keywordtype">void</span> SetJID(<span class="keyword">const</span> JID& jid, BOOL dirty = TRUE)00082 { m_JID = jid; <span class="keywordflow">if</span> (dirty) SetDirty(); }00083 <span class="keyword">virtual</span> <span class="keywordtype">void</span> SetType(ItemType type, BOOL dirty = TRUE)00084 { m_Type = type; <span class="keywordflow">if</span> (dirty) SetDirty(); }00085 <span class="keyword">virtual</span> <span class="keywordtype">void</span> SetName(<span class="keyword">const</span> <a class="code" href="classPString.html">PString</a>& name, BOOL dirty = TRUE) 00086 { m_Name = name; <span class="keywordflow">if</span> (dirty) SetDirty(); }00087 00088 <span class="keyword">virtual</span> <span class="keywordtype">void</span> AddGroup(<span class="keyword">const</span> <a class="code" href="classPString.html">PString</a>& group, BOOL dirty = TRUE);00089 <span class="keyword">virtual</span> <span class="keywordtype">void</span> RemoveGroup(<span class="keyword">const</span> <a class="code" href="classPString.html">PString</a>& group, BOOL dirty = TRUE);00090 00091 <span class="keyword">virtual</span> <span class="keywordtype">void</span> SetPresence(<span class="keyword">const</span> Presence& p);00092 00093 <span class="keywordtype">void</span> SetDirty(BOOL b = TRUE) { m_IsDirty = b; }00094 00097 Item & operator=(00098 <span class="keyword">const</span> <a class="code" href="classPXMLElement.html">PXMLElement</a>& item00099 );00100 00101 <span class="keyword">virtual</span> <a class="code" href="classPXMLElement.html">PXMLElement</a> * AsXML(<a class="code" href="classPXMLElement.html">PXMLElement</a> * parent) <span class="keyword">const</span>;00102 00103 <span class="keyword">protected</span>:00104 BareJID m_JID;00105 ItemType m_Type;00106 <a class="code" href="classPString.html">PString</a> m_Name;00107 <a class="code" href="classPStringSet.html">PStringSet</a> m_Groups;00108 00109 <span class="comment">// The item's presence state: for each resource (the key to the dictionary) a</span>00110 <span class="comment">// a presence stanza if kept.</span>00111 PDictionary<PString, Presence> m_Presence;00112 00113 BOOL m_IsDirty; <span class="comment">// item modified locally, server needs to be updated</span>00114 };00115 <a class="code" href="lists_8h.html#a0">PLIST</a>(ItemList, Item);00116 00117 <span class="keyword">public</span>:00118 Roster(XMPP::C2S::StreamHandler * handler = 0);00119 ~Roster();00120 00121 <span class="keyword">const</span> ItemList& GetItems()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_Items; }00122 00123 <span class="keyword">virtual</span> Item * FindItem(<span class="keyword">const</span> <a class="code" href="classPString.html">PString</a>& jid);00124 00125 <span class="keyword">virtual</span> BOOL SetItem(Item * item, BOOL localOnly = FALSE);00126 <span class="keyword">virtual</span> BOOL RemoveItem(<span class="keyword">const</span> <a class="code" href="classPString.html">PString</a>& jid, BOOL localOnly = FALSE);00127 <span class="keyword">virtual</span> BOOL RemoveItem(Item * item, BOOL localOnly = FALSE);00128 00129 <span class="keyword">virtual</span> <span class="keywordtype">void</span> Attach(XMPP::C2S::StreamHandler * handler);00130 <span class="keyword">virtual</span> <span class="keywordtype">void</span> Detach();00131 <span class="keyword">virtual</span> <span class="keywordtype">void</span> Refresh(BOOL sendPresence = TRUE);00132 00133 <span class="keyword">virtual</span> <a class="code" href="classPNotifierList.html">PNotifierList</a>& ItemChangedHandlers() { <span class="keywordflow">return</span> m_ItemChangedHandlers; }00134 <span class="keyword">virtual</span> <a class="code" href="classPNotifierList.html">PNotifierList</a>& RosterChangedHandlers() { <span class="keywordflow">return</span> m_RosterChangedHandlers; }00135 00136 <span class="keyword">protected</span>:00137 <a class="code" href="notifier_8h.html#a0">PDECLARE_NOTIFIER</a>(XMPP::C2S::StreamHandler, Roster, OnSessionEstablished);00138 <a class="code" href="notifier_8h.html#a0">PDECLARE_NOTIFIER</a>(XMPP::C2S::StreamHandler, Roster, OnSessionReleased);00139 <a class="code" href="notifier_8h.html#a0">PDECLARE_NOTIFIER</a>(XMPP::Presence, Roster, OnPresence);00140 <a class="code" href="notifier_8h.html#a0">PDECLARE_NOTIFIER</a>(XMPP::IQ, Roster, OnIQ);00141 00142 ItemList m_Items;00143 XMPP::C2S::StreamHandler * m_Handler;00144 <a class="code" href="classPNotifierList.html">PNotifierList</a> m_ItemChangedHandlers;00145 <a class="code" href="classPNotifierList.html">PNotifierList</a> m_RosterChangedHandlers;00146 };00147 00148 } <span class="comment">// namespace XMPP</span>00149 00150 00151 <span class="preprocessor">#endif // P_EXPAT</span>00152 <span class="preprocessor"></span>00153 <span class="preprocessor">#endif // _XMPP_ROSTER</span>00154 <span class="preprocessor"></span>00155 <span class="comment">// End of File ///////////////////////////////////////////////////////////////</span>00156 </pre></div><hr><address style="align: right;"><small>Generated on Wed Sep 29 22:44:12 2004 for PWLib by<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.18 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -