/usr/include/gloox/lastactivity.h is in libgloox-dev 1.0.13-3build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | /*
Copyright (c) 2005-2015 by Jakob Schröter <js@camaya.net>
This file is part of the gloox library. http://camaya.net/gloox
This software is distributed under a license. The full license
agreement can be found in the file LICENSE in this distribution.
This software may not be copied, modified, sold or distributed
other than expressed in the named license agreement.
This software is distributed without any warranty.
*/
#ifndef LASTACTIVITY_H__
#define LASTACTIVITY_H__
#include "iqhandler.h"
#include <ctime>
namespace gloox
{
class JID;
class ClientBase;
class LastActivityHandler;
/**
* @brief This is an implementation of @xep{0012} (Last Activity) for both clients and components.
*
* LastActivity can be used to query remote entities about their last activity time as well
* as answer incoming last-activity-queries.
*
* XEP Version: 2.0
*
* @author Jakob Schröter <js@camaya.net>
* @since 0.6
*/
class GLOOX_API LastActivity : public IqHandler
{
public:
/**
* @brief This is an abstraction of a LastActivity Query that
* can be used in @xep{0012} as well as @xep{0256}.
*
* XEP-Version: 2.0 (@xep{0012})
* XEP-Version: 0.1 (@xep{0256})
*
* @author Jakob Schröter <js@camaya.net>
* @since 1.0
*/
class GLOOX_API Query : public StanzaExtension
{
public:
/**
* Constructs a new Query object from the given Tag.
* @param tag The Tag to parse.
*/
Query( const Tag* tag = 0 );
/**
* Constructs a new Query object from the given long.
* @param status A status message.
* @param seconds The number of seconds since last activity.
*/
Query( const std::string& status, long seconds );
/**
* Virtual destructor.
*/
virtual ~Query();
/**
* Returns the number of seconds since last activity.
* @return The number of seconds since last activity.
* -1 if last activity is unknown.
*/
long seconds() const { return m_seconds; }
/**
* Returns the last status message if the user is offline
* and specified a status message when logging off.
* @return The last status message, if any.
*/
const std::string& status() const { return m_status; }
// reimplemented from StanzaExtension
virtual const std::string& filterString() const;
// reimplemented from StanzaExtension
virtual StanzaExtension* newInstance( const Tag* tag ) const
{
return new Query( tag );
}
// reimplemented from StanzaExtension
virtual Tag* tag() const;
// reimplemented from StanzaExtension
virtual StanzaExtension* clone() const
{
return new Query( *this );
}
private:
long m_seconds;
std::string m_status;
};
/**
* Constructs a new LastActivity object.
* @param parent The ClientBase object to use for communication.
*/
LastActivity( ClientBase* parent );
/**
* Virtual destructor.
*/
virtual ~LastActivity();
/**
* Queries the given JID for their last activity. The result can be received by reimplementing
* @ref LastActivityHandler::handleLastActivityResult() and
* @ref LastActivityHandler::handleLastActivityError().
*/
void query( const JID& jid );
/**
* Use this function to register an object as handler for incoming results of Last-Activity queries.
* Only one handler is possible at a time.
* @param lah The object to register as handler.
*/
void registerLastActivityHandler( LastActivityHandler* lah ) { m_lastActivityHandler = lah; }
/**
* Use this function to un-register the LastActivityHandler set earlier.
*/
void removeLastActivityHandler() { m_lastActivityHandler = 0; }
/**
* Use this function to reset the idle timer. By default the number of seconds since the
* instantiation will be used.
*/
void resetIdleTimer();
// reimplemented from IqHandler
virtual bool handleIq( const IQ& iq );
// reimplemented from IqHandler
virtual void handleIqID( const IQ& iq, int context );
private:
#ifdef LASTACTIVITY_TEST
public:
#endif
LastActivityHandler* m_lastActivityHandler;
ClientBase* m_parent;
time_t m_active;
};
}
#endif // LASTACTIVITY_H__
|