~ubuntu-branches/ubuntu/trusty/kvirc/trusty

« back to all changes in this revision

Viewing changes to src/kvirc/kvs/KviKvsCallbackObject.h

  • Committer: Bazaar Package Importer
  • Author(s): Kai Wasserbäch, Kai Wasserbäch, Raúl Sánchez Siles
  • Date: 2011-02-12 10:40:21 UTC
  • mfrom: (14.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110212104021-5mh4f75jlku20mnt
The combined "Twisted Experiment" and "Nocturnal Raid" release.

[ Kai Wasserbäch ]
* Synced to upstream's SVN revision 5467.
* debian/rules:
  - Added .PHONY line.
  - Resurrect -DMANUAL_REVISION, got lost somewhere and we build SVN
    revisions again.
  - Replace "-DWITH_NO_EMBEDDED_CODE=YES" with "-DWANT_CRYPTOPP=YES".
  - Change the remaining -DWITH/-DWITHOUT to the new -DWANT syntax.
* debian/control:
  - Removed DMUA, I'm a DD now.
  - Changed my e-mail address.
  - Removed unneeded relationships (no upgrades over two releases are
    supported).
  - Fix Suggests for kvirc-dbg.
  - kvirc-data: Make the "Suggests: kvirc" a Recommends, doesn't make much
    sense to install the -data package without the program.
* debian/source/local-options: Added with "unapply-patches".
* debian/kvirc.lintian-overrides: Updated to work for 4.1.1.
* debian/patches/21_make_shared-mime-info_B-D_superfluous.patch: Updated.
* debian/kvirc-data.install: Added .notifyrc.

[ Raúl Sánchez Siles ]
* Stating the right version where kvirc-data break and replace should happen.
* Fixing link to license file.
* Added French and Portuguese man pages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _KVI_KVS_CALLBACKOBJECT_H_
 
2
#define _KVI_KVS_CALLBACKOBJECT_H_
 
3
//=============================================================================
 
4
//
 
5
//   File : KviKvsCallbackObject.h
 
6
//   Creation date : Mon 21 Nov 2005 01:46:51 by Szymon Stefanek
 
7
//
 
8
//   This file is part of the KVIrc IRC Client distribution
 
9
//   Copyright (C) 2005-2010 Szymon Stefanek <pragma at kvirc dot net>
 
10
//
 
11
//   This program is FREE software. You can redistribute it and/or
 
12
//   modify it under the terms of the GNU General Public License
 
13
//   as published by the Free Software Foundation; either version 2
 
14
//   of the License, or (at your opinion) any later version.
 
15
//
 
16
//   This program is distributed in the HOPE that it will be USEFUL,
 
17
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
18
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
19
//   See the GNU General Public License for more details.
 
20
//
 
21
//   You should have received a copy of the GNU General Public License
 
22
//   along with this program. If not, write to the Free Software Foundation,
 
23
//   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
24
//
 
25
//=============================================================================
 
26
 
 
27
#include "kvi_settings.h"
 
28
#include "KviHeapObject.h"
 
29
 
 
30
#include "KviWindow.h"
 
31
#include "KviQString.h"
 
32
#include "KviKvsVariantList.h"
 
33
#include "KviKvsScript.h"
 
34
 
 
35
 
 
36
//
 
37
// This is a simple callback object useful in stuff like dialog.message(){}
 
38
// You derive a class from KviKvsCallbackObject, pass the callback data (code,window and magic params)
 
39
// and when the time comes ask it to execute the callback (maybe by passing some special parameters)
 
40
//
 
41
//
 
42
 
 
43
class KVIRC_API KviKvsCallbackObject : public KviHeapObject
 
44
{
 
45
public:
 
46
        enum CallbackFlags {
 
47
                // Execute the callback only if the target window exists
 
48
                // If this flag is not used then if the target window dies
 
49
                // the callback is executed in another window (the associated console, if possible, otherwise the first available console)
 
50
                OnlyIfWindowExists = 1
 
51
        };
 
52
        enum CallbackStatus {
 
53
                // succesfull execution
 
54
                Success,
 
55
                // error in command
 
56
                Error,
 
57
                // succesfull execution, but halt encountered
 
58
                HaltEncountered,
 
59
                // execution aborted since OnlyIfWindowExists was passed and the target window is dead
 
60
                TargetWindowDead
 
61
        };
 
62
public:
 
63
        KviKvsCallbackObject(
 
64
                        const QString      &szCallbackSource, // the name of this callback (should identify its source, like "dialog.message"): displayed in error messages
 
65
                        KviWindow         * pTargetWindow,    // the window that this callback should be triggered in (can be zero: to execute in the first available console)
 
66
                        const QString      &szCallbackCode,   // the callback code (may be empty!)
 
67
                        KviKvsVariantList * pMagicParams,     // magic parameters that should be passed to the callback (this class makes a copy of them)
 
68
                        unsigned int        uFlags = 0        // a combination of CallbackFlags
 
69
                );
 
70
        virtual ~KviKvsCallbackObject();
 
71
protected:
 
72
        KviKvsScript      * m_pScript;       // the callback script
 
73
        KviWindow         * m_pTargetWindow;
 
74
        KviWindow         * m_pTargetConsole;
 
75
        KviKvsVariantList * m_pMagicParams;
 
76
        unsigned int        m_uFlags;
 
77
protected:
 
78
        // the parameter list is always shallow!
 
79
        CallbackStatus execute(KviKvsVariantList * pParams = 0,KviKvsVariant * pRetVal = 0);
 
80
};
 
81
 
 
82
 
 
83
 
 
84
#endif //!_KVI_KVS_CALLBACKOBJECT_H_