diff options
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/modules/lamerizer/caps/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | src/modules/rot13/CMakeLists.txt | 17 | ||||
| -rw-r--r-- | src/modules/rot13/caps/CMakeLists.txt | 14 | ||||
| -rw-r--r-- | src/modules/rot13/caps/rot13 | 1 | ||||
| -rw-r--r-- | src/modules/rot13/libkvirot13.cpp | 176 | ||||
| -rw-r--r-- | src/modules/rot13/libkvirot13.h | 48 | ||||
| -rw-r--r-- | src/modules/rot13/rot13_QT4_vc05.vcproj | 254 |
8 files changed, 514 insertions, 4 deletions
diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt index 08761397e..d5827e9bc 100644 --- a/src/modules/CMakeLists.txt +++ b/src/modules/CMakeLists.txt @@ -32,7 +32,7 @@ SUBDIRS( notifier objects options perl perlcore popupeditor proxydb - raweditor regchan reguser rijndael + raweditor regchan reguser rijndael rot13 serverdb setup sharedfile sharedfileswindow snd socketspy spaste str system texticons term theme tip tmphighlight toolbar toolbareditor torrent trayicon upnp diff --git a/src/modules/lamerizer/caps/CMakeLists.txt b/src/modules/lamerizer/caps/CMakeLists.txt index 440b02d86..e526ccf9d 100644 --- a/src/modules/lamerizer/caps/CMakeLists.txt +++ b/src/modules/lamerizer/caps/CMakeLists.txt @@ -4,11 +4,11 @@ SET(CAPSFILE lamerizer) IF(UNIX) IF(APPLE) - INSTALL(FILES ${CAPSFILE} DESTINATION ${CMAKE_INSTALL_PREFIX}/Contents/Resources/modules/caps/lamerizer/) + INSTALL(FILES ${CAPSFILE} DESTINATION ${CMAKE_INSTALL_PREFIX}/Contents/Resources/modules/caps/crypt/) ELSE() # Assume linux - INSTALL(FILES ${CAPSFILE} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/kvirc/${VERSION_BRANCH}/modules/caps/lamerizer/) + INSTALL(FILES ${CAPSFILE} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/kvirc/${VERSION_BRANCH}/modules/caps/crypt/) ENDIF() ELSEIF(WIN32) - INSTALL(FILES ${CAPSFILE} DESTINATION ${CMAKE_INSTALL_PREFIX}/modules/caps/lamerizer/) + INSTALL(FILES ${CAPSFILE} DESTINATION ${CMAKE_INSTALL_PREFIX}/modules/caps/crypt/) ENDIF() diff --git a/src/modules/rot13/CMakeLists.txt b/src/modules/rot13/CMakeLists.txt new file mode 100644 index 000000000..0c570c9ed --- /dev/null +++ b/src/modules/rot13/CMakeLists.txt @@ -0,0 +1,17 @@ +# CMakeLists for src/modules/rot13 + +SUBDIRS(caps) + +SET(kvirot13_MOC_HDRS + libkvirot13.h +) + +SET(kvirot13_SRCS + libkvirot13.cpp +) + +# After this call, files will be moc'ed to moc_kvi_*.cpp +QT4_WRAP_CPP(kvirot13_MOC_SRCS ${kvirot13_MOC_HDRS}) + +SET(kvi_module_name kvirot13) +INCLUDE(${CMAKE_SOURCE_DIR}/cmake/module.rules.txt) diff --git a/src/modules/rot13/caps/CMakeLists.txt b/src/modules/rot13/caps/CMakeLists.txt new file mode 100644 index 000000000..8c1efa8be --- /dev/null +++ b/src/modules/rot13/caps/CMakeLists.txt @@ -0,0 +1,14 @@ +# CMakeLists for ./caps + +SET(CAPSFILE rot13) + +IF(UNIX) + IF(APPLE) + INSTALL(FILES ${CAPSFILE} DESTINATION ${CMAKE_INSTALL_PREFIX}/Contents/Resources/modules/caps/crypt/) + ELSE() + # Assume linux + INSTALL(FILES ${CAPSFILE} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/kvirc/${VERSION_BRANCH}/modules/caps/crypt/) + ENDIF() +ELSEIF(WIN32) + INSTALL(FILES ${CAPSFILE} DESTINATION ${CMAKE_INSTALL_PREFIX}/modules/caps/crypt/) +ENDIF() diff --git a/src/modules/rot13/caps/rot13 b/src/modules/rot13/caps/rot13 new file mode 100644 index 000000000..9788f7023 --- /dev/null +++ b/src/modules/rot13/caps/rot13 @@ -0,0 +1 @@ +timestamp diff --git a/src/modules/rot13/libkvirot13.cpp b/src/modules/rot13/libkvirot13.cpp new file mode 100644 index 000000000..59ef0145e --- /dev/null +++ b/src/modules/rot13/libkvirot13.cpp @@ -0,0 +1,176 @@ +//============================================================================= +// +// File : libkvirot13.cpp +// Creation date : Fri Jan 30 2002 09:25:15 GMT by Aeriana +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2009 Aeriana (aeriana at quasarnet dot org) +// Copyright (C) 2002-2009 Szymon Stefanek (pragma at kvirc dot net) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program is distributed in the HOPE that it will be USEFUL, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//============================================================================= + +#include "libkvirot13.h" + +#include "kvi_module.h" +#include "kvi_debug.h" +#include "kvi_locale.h" + + + +/* + @doc: rot13 + @type: + module + @short: + The ROT13 text transformation engine + @title: + The ROT13 module + @body: + Performs the "rotate by 13 places" substitution. +*/ + + + +#ifdef COMPILE_CRYPT_SUPPORT + + #include "kvi_memmove.h" + #include "kvi_malloc.h" + + #include "kvi_pointerlist.h" + + static KviPointerList<KviCryptEngine> * g_pEngineList = 0; + + KviRot13Engine::KviRot13Engine() + : KviCryptEngine() + { + g_pEngineList->append(this); + } + + KviRot13Engine::~KviRot13Engine() + { + g_pEngineList->removeRef(this); + } + + bool KviRot13Engine::init(const char *,int,const char *,int) + { + return true; + } + + KviCryptEngine::EncryptResult KviRot13Engine::encrypt(const char * plainText,KviStr &outBuffer) + { + outBuffer = plainText; + unsigned char * aux = (unsigned char *)outBuffer.ptr(); + while(*aux) + { + if(isalpha(*aux)) + { + char l = toupper(*aux); + if (l >= 'N' && l <= 'Z') + *aux = *aux - 13; + else if (l >= 'A' && l <= 'M') + *aux = *aux + 13; + } + aux++; + } + + return KviCryptEngine::Encoded; + } + + KviCryptEngine::DecryptResult KviRot13Engine::decrypt(const char * inBuffer,KviStr &plainText) + { + plainText = inBuffer; + return KviCryptEngine::DecryptOkWasPlainText; + } + + static KviCryptEngine * allocRot13Engine() + { + return new KviRot13Engine(); + } + + static void deallocRot13Engine(KviCryptEngine * e) + { + delete e; + } + +#endif + + +// ======================================= +// module routines +// ======================================= +static bool rot13_module_init(KviModule * m) +{ +#ifdef COMPILE_CRYPT_SUPPORT + g_pEngineList = new KviPointerList<KviCryptEngine>; + g_pEngineList->setAutoDelete(false); + + KviCryptEngineDescription * d = new KviCryptEngineDescription; + d->szName = "ROT13"; + d->szAuthor = "Aeriana"; + d->szDescription = __tr2qs("The simple Caesar-cypher encryption that replaces each letter with the one 13 places forward or back along the alphabet; it is used to enclose the text in a sealed wrapper that the reader must choose to open - e.g. for posting things that might offend some readers, or spoilers."); + d->iFlags = KVI_CRYPTENGINE_CAN_ENCRYPT; + d->allocFunc = allocRot13Engine; + d->deallocFunc = deallocRot13Engine; + m->registerCryptEngine(d); + + return true; +#else + return false; +#endif +} + +static bool rot13_module_cleanup(KviModule *m) +{ +#ifdef COMPILE_CRYPT_SUPPORT + while(g_pEngineList->first())delete g_pEngineList->first(); + delete g_pEngineList; + g_pEngineList = 0; + m->unregisterCryptEngines(); + return true; +#else + return false; +#endif +} + +static bool rot13_module_can_unload(KviModule *) +{ +#ifdef COMPILE_CRYPT_SUPPORT + return g_pEngineList->isEmpty(); +#else + return true; +#endif +} + +// ======================================= +// plugin definition structure +// ======================================= +KVIRC_MODULE( + "ROT13 crypt engine", + "4.0.0", + "Aeriana <aeriana at quasarnet dot org>" , + "Exports the ROT13 text transformation engine", + rot13_module_init , + rot13_module_can_unload, + 0, + rot13_module_cleanup +) + +#ifdef COMPILE_CRYPT_SUPPORT + #ifndef COMPILE_USE_STANDALONE_MOC_SOURCES + #include "libkvirot13.moc" + #endif //!COMPILE_USE_STANDALONE_MOC_SOURCES +#endif diff --git a/src/modules/rot13/libkvirot13.h b/src/modules/rot13/libkvirot13.h new file mode 100644 index 000000000..94006f2b8 --- /dev/null +++ b/src/modules/rot13/libkvirot13.h @@ -0,0 +1,48 @@ +#ifndef _LIBKVIROT13_H_ +#define _LIBKVIROT13_H_ +//============================================================================= +// +// File : libkvirot13.h +// Creation date : Sat Now 4 2000 15:41:41 CEST by Szymon Stefanek +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2009 Aeriana (aeriana at quasarnet dot org) +// Copyright (C) 2000 Szymon Stefanek (pragma at kvirc dot net) +// +// This program is FREE software. You can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your opinion) any later version. +// +// This program is distributed in the HOPE that it will be USEFUL, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//============================================================================= + +#include "kvi_settings.h" + +#ifdef COMPILE_CRYPT_SUPPORT + + #include "kvi_crypt.h" + + class KviRot13Engine : public KviCryptEngine + { + Q_OBJECT + public: + KviRot13Engine(); + ~KviRot13Engine(); + public: + virtual bool init(const char *encKey,int encKeyLen,const char *decKey,int decKeyLen); + virtual KviCryptEngine::EncryptResult encrypt(const char * plainText,KviStr &outBuffer); + virtual KviCryptEngine::DecryptResult decrypt(const char * inBuffer,KviStr &plainText); + }; + +#endif // COMPILE_CRYPT_SUPPORT + +#endif // _LIBKVIROT13_H_ diff --git a/src/modules/rot13/rot13_QT4_vc05.vcproj b/src/modules/rot13/rot13_QT4_vc05.vcproj new file mode 100644 index 000000000..7ee7cbe43 --- /dev/null +++ b/src/modules/rot13/rot13_QT4_vc05.vcproj @@ -0,0 +1,254 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="9,00" + Name="rot13" + ProjectGUID="{35EDD5AA-6F36-4F74-8F29-C143C65D29F4}" + RootNamespace="rot13" + Keyword="Win32Proj" + TargetFrameworkVersion="131072" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + OutputDirectory="$(SolutionDir)\win32build\bin\modules\" + IntermediateDirectory="Debug" + ConfigurationType="2" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="0" + AdditionalIncludeDirectories=""$(ProjectDir)\..\..\kvirc\ui";"$(ProjectDir)\..\..\kvilib\core";"$(ProjectDir)\..\..\kvirc\module";"$(ProjectDir)\..\..\kvilib\config";"$(QTDIR)\include";"$(ProjectDir)\..\..\kvilib\system";"$(ProjectDir)\..\..\kvirc\uparser";"$(ProjectDir)\..\..\kvirc\sparser";"$(ProjectDir)\..\..\kvirc\kernel";"$(ProjectDir)\..\..\kvilib\ext";"$(ProjectDir)\..\..\kvilib\irc";"$(ProjectDir)\..\..\kvilib\tal";"$(ProjectDir)\..\..\kvirc\kvs";"$(ProjectDir)\..\..\kvilib\file";"$(ProjectDir)\..\..\kvilib\net";"$(QTDIR)\include\Qt3Support";"$(QTDIR)\include\QtCore\";"$(QTDIR)\include\QtGui";"$(QTDIR)\include\Qt";"$(QTDIR)\include\QtNetwork";"$(QTDIR)\include\QtXml";" + PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;ROT13_EXPORTS;_CRT_SECURE_NO_DEPRECATE;" + MinimalRebuild="true" + BasicRuntimeChecks="3" + RuntimeLibrary="1" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="4" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies=" qtcore4.lib qtgui4.lib qtmain.lib kvilib.lib kvirc.lib" + OutputFile="$(OutDir)/kvi$(ProjectName).dll" + LinkIncremental="2" + AdditionalLibraryDirectories=""$(SSLLIBDIR)";"$(PERLDIR)\lib\CORE";"$(QTDIR)\lib";"$(SolutionDir)\win32build\bin";"$(ZLIBLIBDIR)"" + GenerateManifest="true" + IgnoreAllDefaultLibraries="false" + GenerateDebugInformation="true" + ProgramDatabaseFile="$(OutDir)/rot13.pdb" + SubSystem="2" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TurnOffAssemblyGeneration="true" + ImportLibrary="$(OutDir)/rot13.lib" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + AdditionalManifestFiles="$(SolutionDir)/data/manifests/commctrl.manifest" + EmbedManifest="true" + VerboseOutput="true" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + OutputDirectory="$(SolutionDir)\win32build\bin\modules" + IntermediateDirectory="Release" + ConfigurationType="2" + InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops" + CharacterSet="2" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + Optimization="1" + InlineFunctionExpansion="2" + EnableIntrinsicFunctions="true" + FavorSizeOrSpeed="1" + OmitFramePointers="true" + EnableFiberSafeOptimizations="true" + WholeProgramOptimization="true" + AdditionalIncludeDirectories=""$(ProjectDir)\..\..\kvirc\ui";"$(ProjectDir)\..\..\kvilib\core";"$(ProjectDir)\..\..\kvirc\module";"$(ProjectDir)\..\..\kvilib\config";"$(QTDIR)\include";"$(ProjectDir)\..\..\kvilib\system";"$(ProjectDir)\..\..\kvirc\uparser";"$(ProjectDir)\..\..\kvirc\sparser";"$(ProjectDir)\..\..\kvirc\kernel";"$(ProjectDir)\..\..\kvilib\ext";"$(ProjectDir)\..\..\kvilib\irc";"$(ProjectDir)\..\..\kvilib\tal";"$(ProjectDir)\..\..\kvirc\kvs";"$(ProjectDir)\..\..\kvilib\file";"$(ProjectDir)\..\..\kvilib\net";"$(QTDIR)\include\Qt3Support";"$(QTDIR)\include\QtCore\";"$(QTDIR)\include\QtGui";"$(QTDIR)\include\Qt";"$(QTDIR)\include\QtNetwork";"$(QTDIR)\include\QtXml";" + PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;ROT13_EXPORTS;_CRT_SECURE_NO_DEPRECATE;" + StringPooling="true" + MinimalRebuild="true" + ExceptionHandling="1" + RuntimeLibrary="2" + UsePrecompiledHeader="0" + WarningLevel="3" + Detect64BitPortabilityProblems="false" + DebugInformationFormat="0" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="qtmain.lib kvilib.lib kvirc.lib qtcore4.lib qtgui4.lib" + OutputFile="$(OutDir)/kvi$(ProjectName).dll" + LinkIncremental="1" + AdditionalLibraryDirectories=""$(SSLLIBDIR)";"$(PERLDIR)\lib\CORE";"$(QTDIR)\lib";"$(SolutionDir)\win32build\bin";"$(ZLIBLIBDIR)"" + GenerateManifest="true" + IgnoreAllDefaultLibraries="false" + GenerateDebugInformation="true" + SubSystem="2" + OptimizeReferences="2" + EnableCOMDATFolding="2" + OptimizeForWindows98="1" + LinkTimeCodeGeneration="1" + RandomizedBaseAddress="1" + DataExecutionPrevention="0" + TurnOffAssemblyGeneration="true" + ImportLibrary="$(OutDir)/rot13.lib" + TargetMachine="1" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + AdditionalManifestFiles="$(SolutionDir)/data/manifests/commctrl.manifest" + EmbedManifest="false" + VerboseOutput="true" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\libkvirot13.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\libkvirot13.h" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCustomBuildTool" + CommandLine="$(QTDIR)\bin\moc -DCOMPILE_CRYPT_SUPPORT -o "$(InputDir)\$(InputName).moc" "$(InputDir)\$(InputFileName)"
" + Outputs="$(InputDir)\$(InputName).moc" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCustomBuildTool" + CommandLine="$(QTDIR)\bin\moc -DCOMPILE_CRYPT_SUPPORT -o "$(InputDir)\$(InputName).moc" "$(InputDir)\$(InputFileName)"
" + Outputs="$(InputDir)\$(InputName).moc" + /> + </FileConfiguration> + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> |
