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

« back to all changes in this revision

Viewing changes to src/modules/system/Plugin.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 _PLUGIN_H_
 
2
#define _PLUGIN_H_
 
3
 
 
4
//=============================================================================
 
5
//
 
6
//   File : Plugin.h
 
7
//   Creation date : Wed Apr 11 04 2007 00:54:00 GMT+1 by TheXception
 
8
//
 
9
//   This file is part of the KVIrc irc client distribution
 
10
//   Copyright (C) 2007-2008 TheXception
 
11
//
 
12
//   This program is FREE software. You can redistribute it and/or
 
13
//   modify it under the terms of the GNU General Public License
 
14
//   as published by the Free Software Foundation; either version 2
 
15
//   of the License, or (at your opinion) any later version.
 
16
//
 
17
//   This program is distributed in the HOPE that it will be USEFUL,
 
18
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
20
//   See the GNU General Public License for more details.
 
21
//
 
22
//   You should have received a copy of the GNU General Public License
 
23
//   along with this program. If not, write to the Free Software Foundation,
 
24
//   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
25
//
 
26
//=============================================================================
 
27
 
 
28
#include "KviModule.h"
 
29
#include "KviPointerHashTable.h"
 
30
#include <QLibrary>
 
31
 
 
32
typedef int (*plugin_function)(int argc, char* argv[], char ** buffer);
 
33
typedef int (*plugin_unload)();
 
34
typedef int (*plugin_canunload)();
 
35
typedef int (*plugin_load)();
 
36
typedef int (*plugin_free)(char * pBuffer);
 
37
 
 
38
class Plugin
 
39
{
 
40
protected:
 
41
        // You have to create plugin instance by calling Plugin::load()
 
42
        Plugin(QLibrary * pLibrary,const QString& name);
 
43
public:
 
44
        ~Plugin();
 
45
private:
 
46
        // shared
 
47
        // internal
 
48
        QLibrary *m_pLibrary;
 
49
        QString   m_szName;
 
50
public:
 
51
        static Plugin* load(const QString& szFileName);
 
52
        bool pfree(char * pBuffer);
 
53
        bool unload();
 
54
        bool canunload();
 
55
        int call(const QString& szFunctionName, int argc, char * argv[], char ** pBuffer);
 
56
        QString name() const;
 
57
        void setName(const QString& szName);
 
58
protected:
 
59
};
 
60
 
 
61
class PluginManager
 
62
{
 
63
        public:
 
64
                PluginManager();
 
65
                ~PluginManager();
 
66
        private:
 
67
                // shared
 
68
                bool m_bCanUnload;
 
69
                // internal
 
70
                KviPointerHashTable<QString,Plugin> * m_pPluginDict;
 
71
        public:
 
72
                bool pluginCall(KviKvsModuleFunctionCall *c);
 
73
                bool checkUnload();
 
74
                void unloadAll();
 
75
        protected:
 
76
                bool findPlugin(QString& szName);
 
77
                bool isPluginLoaded(const QString& szFileNameOrPathToLoad);
 
78
                bool loadPlugin(const QString& szPluginPath);
 
79
                Plugin * getPlugin(const QString& szPluginPath);
 
80
};
 
81
 
 
82
#endif //_PLUGIN_H_