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

« back to all changes in this revision

Viewing changes to src/kvirc/kvs/kvi_kvs_treenode_modulecallbackcommand.cpp

  • 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
 
//=============================================================================
2
 
//
3
 
//   File : kvi_kvs_treenode_modulecallbackcommand.cpp
4
 
//   Creation date : Thu 09 Oct 2003 02:09:10 by Szymon Stefanek
5
 
//
6
 
//   This file is part of the KVIrc IRC client distribution
7
 
//   Copyright (C) 2003-2008 Szymon Stefanek <pragma at kvirc dot net>
8
 
//
9
 
//   This program is FREE software. You can redistribute it and/or
10
 
//   modify it under the terms of the GNU General Public License
11
 
//   as published by the Free Software Foundation; either version 2
12
 
//   of the License, or (at your opinion) any later version.
13
 
//
14
 
//   This program is distributed in the HOPE that it will be USEFUL,
15
 
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
 
//   See the GNU General Public License for more details.
18
 
//
19
 
//   You should have received a copy of the GNU General Public License
20
 
//   along with this program. If not, write to the Free Software Foundation,
21
 
//   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
 
//
23
 
//=============================================================================
24
 
 
25
 
#include "kvi_kvs_treenode_modulecallbackcommand.h"
26
 
#include "kvi_kvs_treenode_datalist.h"
27
 
#include "kvi_kvs_treenode_switchlist.h"
28
 
 
29
 
#include "kvi_modulemanager.h"
30
 
#include "kvi_locale.h"
31
 
#include "kvi_kvs_moduleinterface.h"
32
 
#include "kvi_kvs_runtimecontext.h"
33
 
 
34
 
KviKvsTreeNodeModuleCallbackCommand::KviKvsTreeNodeModuleCallbackCommand(const QChar * pLocation,const QString &szModuleName,const QString &szCmdName,KviKvsTreeNodeDataList * params,KviKvsScript * pCallback)
35
 
: KviKvsTreeNodeCallbackCommand(pLocation,szCmdName,params,pCallback)
36
 
{
37
 
        m_szModuleName = szModuleName;
38
 
}
39
 
 
40
 
 
41
 
KviKvsTreeNodeModuleCallbackCommand::~KviKvsTreeNodeModuleCallbackCommand()
42
 
{
43
 
}
44
 
 
45
 
void KviKvsTreeNodeModuleCallbackCommand::contextDescription(QString &szBuffer)
46
 
{
47
 
        szBuffer = "Module Callback Command \"";
48
 
        szBuffer += m_szModuleName;
49
 
        szBuffer += ".";
50
 
        szBuffer += m_szCmdName;
51
 
        szBuffer += "\"";
52
 
}
53
 
 
54
 
void KviKvsTreeNodeModuleCallbackCommand::dump(const char * prefix)
55
 
{
56
 
        qDebug("%s ModuleCallbackCommand(%s.%s)",prefix,m_szModuleName.toUtf8().data(),m_szCmdName.toUtf8().data());
57
 
        dumpSwitchList(prefix);
58
 
        dumpParameterList(prefix);
59
 
        dumpCallback(prefix);
60
 
}
61
 
 
62
 
bool KviKvsTreeNodeModuleCallbackCommand::execute(KviKvsRunTimeContext * c)
63
 
{
64
 
        KviModule * m = g_pModuleManager->getModule(m_szModuleName);
65
 
        if(!m)
66
 
        {
67
 
                QString szErr = g_pModuleManager->lastError();
68
 
                c->error(this,__tr2qs_ctx("Module command call failed: can't load the module '%Q': %Q","kvs"),&m_szModuleName,&szErr);
69
 
                return false;
70
 
        }
71
 
 
72
 
        KviKvsModuleCallbackCommandExecRoutine * proc = m->kvsFindCallbackCommand(m_szCmdName);
73
 
        if(!proc)
74
 
        {
75
 
                c->error(this,__tr2qs_ctx("Module command call failed: the module '%Q' doesn't export a callback command named '%Q'","kvs"),&m_szModuleName,&m_szCmdName);
76
 
                return false;
77
 
        }
78
 
 
79
 
        KviKvsVariantList l;
80
 
        l.setAutoDelete(true);
81
 
        if(!(m_pParams->evaluate(c,&l)))return false;
82
 
 
83
 
        KviKvsSwitchList swl;
84
 
        if(m_pSwitches)
85
 
        {
86
 
                if(!(m_pSwitches->evaluate(c,&swl)))return false;
87
 
        }
88
 
 
89
 
        c->setDefaultReportLocation(this);
90
 
 
91
 
        KviKvsModuleCallbackCommandCall call(m,c,&l,&swl,m_pCallback,m_pParams);
92
 
 
93
 
        return (*proc)(&call);
94
 
}