gloox  0.9.9.12
lastactivity.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 LASTACTIVITY_H__
15 #define LASTACTIVITY_H__
16 
17 #include "iqhandler.h"
18 
19 #include <time.h>
20 
21 namespace gloox
22 {
23 
24  class JID;
25  class ClientBase;
26  class LastActivityHandler;
27 
37  class GLOOX_API LastActivity : public IqHandler
38  {
39  public:
44  LastActivity( ClientBase *parent );
45 
49  virtual ~LastActivity();
50 
56  void query( const JID& jid );
57 
63  void registerLastActivityHandler( LastActivityHandler *lah ) { m_lastActivityHandler = lah; }
64 
68  void removeLastActivityHandler() { m_lastActivityHandler = 0; }
69 
74  void resetIdleTimer();
75 
76  // reimplemented from IqHandler
77  virtual bool handleIqID( Stanza *stanza, int context );
78 
79  // reimplemented from IqHandler
80  virtual bool handleIq( Stanza *stanza );
81 
82  private:
83  LastActivityHandler *m_lastActivityHandler;
84  ClientBase *m_parent;
85 
86  time_t m_active;
87 
88  };
89 
90 }
91 
92 #endif // LASTACTIVITY_H__