LastActivity Class Reference

`#include <lastactivity.h>`

Inheritance diagram for LastActivity:
[legend]

## Classes

class | Query

## Public Member Functions

| LastActivity (ClientBase *parent)
virtual | ~LastActivity ()
void | query (const JID &jid)
void | registerLastActivityHandler (LastActivityHandler *lah)
void | removeLastActivityHandler ()
void | resetIdleTimer ()
virtual bool | handleIq (const IQ &iq)
virtual void | handleIqID (const IQ &iq, int context)
Public Member Functions inherited from IqHandler
virtual | ~IqHandler ()

## Detailed Description

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@ca.nosp@m.maya.nosp@m..net

Since
  0.6

Definition at line 39 of file lastactivity.h.

## Constructor & Destructor Documentation

## LastActivity()

LastActivity | ( | ClientBase * | parent | ) |

Constructs a new LastActivity object.

Parameters

  parent | The ClientBase object to use for communication.

Definition at line 68 of file lastactivity.cpp.

## ~LastActivity()

~LastActivity | ( |  | ) |

virtual

Virtual destructor.

Definition at line 80 of file lastactivity.cpp.

## Member Function Documentation

## handleIq()

bool handleIq | ( | const IQ & | iq | ) |

virtual

Reimplement this function if you want to be notified about incoming IQs.

Parameters

  iq | The complete IQ stanza.

Returns
  Indicates whether a request of type 'get' or 'set' has been handled. This includes the obligatory 'result' answer. If you return false, an 'error' will be sent back.

Since
  1.0

Implements IqHandler.

Definition at line 97 of file lastactivity.cpp.

## handleIqID()

void handleIqID | ( | const IQ & | iq,
|  | int | context )

virtual

Reimplement this function if you want to be notified about incoming IQs with a specific value of the `id` attribute. You have to enable tracking of those IDs using Client::trackID(). This is usually useful for IDs that generate a empty positive reply, i.e. <iq type='result' id='reg'/> where a namespace filter wouldn't work.

Parameters

  iq | The complete IQ stanza.
  context | A value to restore context, stored with ClientBase::trackID().

Note
  Only IQ stanzas of type 'result' or 'error' can arrive here.

Since
  1.0

Implements IqHandler.

Definition at line 110 of file lastactivity.cpp.

## query()

void query | ( | const JID & | jid | ) |

Queries the given JID for their last activity. The result can be received by reimplementing handleLastActivityResult() and handleLastActivityError().

Definition at line 90 of file lastactivity.cpp.

## registerLastActivityHandler()

void registerLastActivityHandler | ( | LastActivityHandler * | lah | ) |

inline

Use this function to register an object as handler for incoming results of Last-Activity queries. Only one handler is possible at a time.

Parameters

  lah | The object to register as handler.

Definition at line 134 of file lastactivity.h.

## removeLastActivityHandler()

void removeLastActivityHandler | ( |  | ) |

inline

Use this function to un-register the LastActivityHandler set earlier.

Definition at line 139 of file lastactivity.h.

## resetIdleTimer()

void resetIdleTimer | ( |  | ) |

Use this function to reset the idle timer. By default the number of seconds since the instantiation will be used.

Definition at line 127 of file lastactivity.cpp.

The documentation for this class was generated from the following files:

- lastactivity.h
- lastactivity.cpp