kopete/protocols/messenger/libpapillon
Papillon::Task Class Reference
#include <Papillon/Task>

Detailed Description
Task is the base class for all Task accros Papillon.
Derived class must implement these following methods:
take() - Used to listen and proceed incoming NetworkMessage.
onGo() - Called by go(), start the task.
Devired class may implement these following methods:
forMe() - Used to check if the incoming NetworkMessage is for us.
onDisconnect() - If you need to do something special when a Connection disconnect.
Definition at line 51 of file task.h.
Public Types | |
| enum | StatusCode { ErrorDisconnected } |
| enum | GoParameter { GoNothing, AutoDelete } |
Signals | |
| void | finished (Papillon::Task *task) |
Public Member Functions | |
| Task (Task *parent) | |
| Task (Connection *connection, bool isRoot) | |
| virtual | ~Task () |
| Task * | parent () const |
| Connection * | connection () const |
| NetworkMessage * | networkMessage () const |
| void | setNetworkMessage (NetworkMessage *transfer) |
| bool | success () const |
| int | statusCode () const |
| const QString & | statusString () const |
| void | go (GoParameters args=GoNothing) |
| virtual bool | take (NetworkMessage *transfer) |
| void | safeDelete () |
Protected Member Functions | |
| virtual void | onGo () |
| virtual void | onDisconnect () |
| void | send (NetworkMessage *request) |
| void | setSuccess (int code=0, const QString &str=QLatin1String("")) |
| void | setError (int code=0, const QString &str=QLatin1String("")) |
| void | debug (const QString &) |
| virtual bool | forMe (NetworkMessage *transfer) const |
Member Enumeration Documentation
Constructor & Destructor Documentation
| Papillon::Task::Task | ( | Task * | parent | ) |
| Papillon::Task::Task | ( | Connection * | connection, | |
| bool | isRoot | |||
| ) |
Create a root task.
- Parameters:
-
connection Connection pointer for this task isRoot if the Task is a root one or not.
Member Function Documentation
| Task * Papillon::Task::parent | ( | ) | const |
| Connection * Papillon::Task::connection | ( | ) | const |
| NetworkMessage * Papillon::Task::networkMessage | ( | ) | const |
Get the current transfer if any.
Need to be set with setNetworkMessage().
- Returns:
- the current NetworkMessage or 0 if this Task do not store any NetworkMessage. TODO: Remove ?
| void Papillon::Task::setNetworkMessage | ( | NetworkMessage * | transfer | ) |
Direct setter for Tasks which don't have any fields.
- Parameters:
-
transfer NetworkMessage to set. TODO: Remove ?
| bool Papillon::Task::success | ( | ) | const |
Call this the resulting slot of finished() signal.
Check if the Task was successful or not.
- Returns:
- true if the Task was a success.
| int Papillon::Task::statusCode | ( | ) | const |
| const QString & Papillon::Task::statusString | ( | ) | const |
| void Papillon::Task::go | ( | GoParameters | args = GoNothing |
) |
| bool Papillon::Task::take | ( | NetworkMessage * | transfer | ) | [virtual] |
Allows a task to examine an incoming NetworkMessage and decide whether to 'take' it for further processing.
Reimplemented in Papillon::ChallengeTask, Papillon::LoginTask, Papillon::NotifyMessageTask, Papillon::NotifyPresenceTask, Papillon::NotifyStatusMessageTask, Papillon::SetPersonalInformationTask, Papillon::SetPresenceTask, and Papillon::SetStatusMessageTask.
| void Papillon::Task::safeDelete | ( | ) |
| void Papillon::Task::finished | ( | Papillon::Task * | task | ) | [signal] |
| void Papillon::Task::onGo | ( | ) | [protected, virtual] |
Derived classes should implement this method.
Implements "start" of the Task.
Reimplemented in Papillon::LoginTask, Papillon::SetPersonalInformationTask, Papillon::SetPresenceTask, and Papillon::SetStatusMessageTask.
| void Papillon::Task::onDisconnect | ( | ) | [protected, virtual] |
| void Papillon::Task::send | ( | NetworkMessage * | request | ) | [protected] |
Helper method for derived Task to send a NetworkMessage through the Connection.
| void Papillon::Task::setSuccess | ( | int | code = 0, |
|
| const QString & | str = QLatin1String("") | |||
| ) | [protected] |
| void Papillon::Task::setError | ( | int | code = 0, |
|
| const QString & | str = QLatin1String("") | |||
| ) | [protected] |
| void Papillon::Task::debug | ( | const QString & | str | ) | [protected] |
| bool Papillon::Task::forMe | ( | NetworkMessage * | transfer | ) | const [protected, virtual] |
Used in take() to check if the offered transfer is for this Task.
- Returns:
- true if this Task should take the NetworkMessage. Default impl always returns false.
Reimplemented in Papillon::LoginTask, and Papillon::NotifyPresenceTask.
The documentation for this class was generated from the following files:
KDE 4.0 API Reference