2 task.h - Kopete Groupwise Protocol
4 Copyright (c) 2004 SUSE Linux AG http://www.suse.com
6 Based on Iris, Copyright (C) 2003 Justin Karneges <justin@affinix.com>
8 Kopete (c) 2002-2004 by the Kopete developers <kopete-devel@kde.org>
10 *************************************************************************
12 * This library is free software; you can redistribute it and/or *
13 * modify it under the terms of the GNU Lesser General Public *
14 * License as published by the Free Software Foundation; either *
15 * version 2 of the License, or (at your option) any later version. *
17 *************************************************************************
27 #include "libgroupwise_export.h"
33 class LIBGROUPWISE_EXPORT Task
: public QObject
39 Task( Client
*, bool isRoot
);
43 Client
*client() const;
44 Transfer
*transfer() const;
49 int statusCode() const;
50 const QString
& statusString() const;
52 void go( bool autoDelete
=false );
54 * Allows a task to examine an incoming Transfer and decide whether to 'take' it
55 * for further processing.
57 virtual bool take( Transfer
* transfer
);
65 virtual void onDisconnect();
66 void send( Request
* request
);
67 void setSuccess( int code
=0, const QString
&str
="" );
69 * If an empty string is passed, this sets the error string based on the error code using GroupWise::errorCodeToString
71 void setError( int code
=0, const QString
&str
="" );
72 // void debug( const char *, ... );
73 void debug( const QString
& );
75 * Used in take() to check if the offered transfer is for this Task
76 * @return true if this Task should take the Transfer. Default impl always returns false.
78 virtual bool forMe( const Transfer
* transfer
) const;
80 * Creates a transfer with the given command and field list
82 void createTransfer( const QString
& command
, const Field::FieldList fields
);
84 * Direct setter for Tasks which don't have any fields
86 void setTransfer( Transfer
* transfer
);
88 void clientDisconnected();