Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | Related Pages

flexoff.h

00001 /*
00002   Copyright (c) 2005-2008 by Jakob Schroeter <js@camaya.net>
00003   This file is part of the gloox library. http://camaya.net/gloox
00004 
00005   This software is distributed under a license. The full license
00006   agreement can be found in the file LICENSE in this distribution.
00007   This software may not be copied, modified, sold or distributed
00008   other than expressed in the named license agreement.
00009 
00010   This software is distributed without any warranty.
00011 */
00012 
00013 
00014 #ifndef FLEXOFF_H__
00015 #define FLEXOFF_H__
00016 
00017 #include "clientbase.h"
00018 #include "discohandler.h"
00019 #include "flexoffhandler.h"
00020 #include "iqhandler.h"
00021 #include "stanzaextension.h"
00022 
00023 namespace gloox
00024 {
00025 
00034   class GLOOX_API FlexibleOffline : public DiscoHandler, public IqHandler
00035   {
00036     public:
00041       FlexibleOffline( ClientBase* parent );
00042 
00046       virtual ~FlexibleOffline();
00047 
00053       void checkSupport();
00054 
00059       void getMsgCount();
00060 
00065       void fetchHeaders();
00066 
00074       void fetchMessages( const StringList& msgs )
00075         { messageOperation( FORequestMsgs, msgs ); }
00076 
00083       void removeMessages( const StringList& msgs )
00084         { messageOperation( FORemoveMsgs, msgs ); }
00085 
00091       void registerFlexibleOfflineHandler( FlexibleOfflineHandler* foh );
00092 
00096       void removeFlexibleOfflineHandler();
00097 
00098       // reimplemented from DiscoHandler
00099       virtual void handleDiscoInfo( const JID& from, const Disco::Info& info, int context );
00100 
00101       // reimplemented from DiscoHandler
00102       virtual void handleDiscoItems( const JID& from, const Disco::Items& items, int context );
00103 
00104       // reimplemented from DiscoHandler
00105       virtual void handleDiscoError( const JID& from, const Error* error, int context );
00106 
00107       // reimplemented from IqHandler.
00108       virtual bool handleIq( const IQ& iq ) { (void)iq; return false; }
00109 
00110       // reimplemented from IqHandler.
00111       virtual void handleIqID( const IQ& iq, int context );
00112 
00113     private:
00114 #ifdef FLEXOFF_TEST
00115     public:
00116 #endif
00117       class Offline : public StanzaExtension
00118       {
00119         public:
00124           Offline( const Tag* tag = 0 );
00125 
00131           Offline( int context, const StringList& msgs );
00132 
00136           virtual ~Offline();
00137 
00138           // reimplemented from StanzaExtension
00139           virtual const std::string& filterString() const;
00140 
00141           // reimplemented from StanzaExtension
00142           virtual StanzaExtension* newInstance( const Tag* tag ) const
00143           {
00144             return new Offline( tag );
00145           }
00146 
00147           // reimplemented from StanzaExtension
00148           virtual Tag* tag() const;
00149 
00150         private:
00151           int m_context;
00152           StringList m_msgs;
00153       };
00154 
00155       void messageOperation( int context, const StringList& msgs );
00156 
00157       enum FOContext
00158       {
00159         FOCheckSupport,
00160         FORequestNum,
00161         FORequestHeaders,
00162         FORequestMsgs,
00163         FORemoveMsgs
00164       };
00165 
00166       ClientBase* m_parent;
00167       FlexibleOfflineHandler* m_flexibleOfflineHandler;
00168   };
00169 
00170 }
00171 
00172 #endif // FLEXOFF_H__

Generated on Mon Sep 1 09:25:10 2008 for gloox by  doxygen 1.4.1