gloox  0.9.9.12
flexoff.h
1 /*
2  Copyright (c) 2005-2008 by Jakob Schroeter <js@camaya.net>
3  This file is part of the gloox library. http://camaya.net/gloox
4 
5  This software is distributed under a license. The full license
6  agreement can be found in the file LICENSE in this distribution.
7  This software may not be copied, modified, sold or distributed
8  other than expressed in the named license agreement.
9 
10  This software is distributed without any warranty.
11 */
12 
13 
14 #ifndef FLEXOFF_H__
15 #define FLEXOFF_H__
16 
17 #include "clientbase.h"
18 #include "discohandler.h"
19 #include "flexoffhandler.h"
20 #include "iqhandler.h"
21 
22 namespace gloox
23 {
24 
33  class GLOOX_API FlexibleOffline : public DiscoHandler, public IqHandler
34  {
35  public:
40  FlexibleOffline( ClientBase *parent );
41 
45  virtual ~FlexibleOffline();
46 
52  void checkSupport();
53 
58  void getMsgCount();
59 
64  void fetchHeaders();
65 
73  void fetchMessages( const StringList& msgs );
74 
81  void removeMessages( const StringList& msgs );
82 
88  void registerFlexibleOfflineHandler( FlexibleOfflineHandler *foh );
89 
93  void removeFlexibleOfflineHandler();
94 
95  // reimplemented from DiscoHandler
96  virtual void handleDiscoInfoResult( Stanza *stanza, int context );
97 
98  // reimplemented from DiscoHandler
99  virtual void handleDiscoItemsResult( Stanza *stanza, int context );
100 
101  // reimplemented from DiscoHandler
102  virtual void handleDiscoError( Stanza *stanza, int context );
103 
104  // reimplemented from IqHandler
105  virtual bool handleIqID( Stanza *stanza, int context );
106 
107  // reimplemented from IqHandler
108  virtual bool handleIq( Stanza *stanza );
109 
110  private:
111  enum FOContext
112  {
113  FOCheckSupport,
114  FORequestNum,
115  FORequestHeaders,
116  FORequestMsgs,
117  FORemoveMsgs
118  };
119 
120  ClientBase *m_parent;
121  FlexibleOfflineHandler *m_flexibleOfflineHandler;
122  };
123 
124 }
125 
126 #endif // FLEXOFF_H__