From 26ef0cff00c368487a8a95a5c66dc2b0a85f1efa Mon Sep 17 00:00:00 2001 From: Szymon Tomasz Stefanek Date: Mon, 27 Dec 2010 02:18:43 +0000 Subject: Yet more renaming and cleanup git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5236 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/kvilib/CMakeLists.txt | 6 +- src/kvilib/config/KviBuildInfo.cpp | 100 ++++++ src/kvilib/config/KviBuildInfo.h | 131 ++++++++ src/kvilib/config/kvi_buildinfo.cpp | 100 ------ src/kvilib/config/kvi_buildinfo.h | 131 -------- src/kvilib/config/kvi_debug.h | 36 --- src/kvilib/core/KviCString.h | 25 +- src/kvilib/core/KviError.cpp | 234 ++++++++++++++ src/kvilib/core/KviError.h | 215 +++++++++++++ src/kvilib/core/KviMemory.cpp | 199 +++++++++++- src/kvilib/core/kvi_bswap.h | 83 ----- src/kvilib/core/kvi_error.cpp | 234 -------------- src/kvilib/core/kvi_error.h | 215 ------------- src/kvilib/core/kvi_strasm.h | 194 ------------ src/kvilib/irc/KviIrcNetwork.cpp | 157 ++++++++++ src/kvilib/irc/KviIrcNetwork.h | 342 +++++++++++++++++++++ src/kvilib/irc/KviIrcServer.cpp | 32 +- src/kvilib/irc/KviIrcServer.h | 34 +- src/kvilib/irc/KviIrcServerDataBase.cpp | 74 ++--- src/kvilib/irc/KviIrcServerDataBase.h | 52 ++-- src/kvilib/irc/KviNetwork.cpp | 157 ---------- src/kvilib/irc/KviNetwork.h | 342 --------------------- src/kvilib/net/KviDnsResolver.cpp | 2 +- src/kvilib/net/KviDnsResolver.h | 51 ++- src/kvilib/net/KviHttpRequest.cpp | 2 +- src/kvilib/net/kvi_socket.h | 27 +- src/kvilib/system/KviByteOrder.h | 92 ++++-- src/kvilib/system/KviLocale.cpp | 4 +- src/kvilib/system/KviThread.cpp | 2 +- src/kvilib/system/KviTimeUtils.h | 17 +- src/kvirc/kernel/kvi_app.cpp | 14 +- src/kvirc/kernel/kvi_app.h | 4 +- src/kvirc/kernel/kvi_asynchronousconnectiondata.h | 2 +- src/kvirc/kernel/kvi_coreactions.cpp | 4 +- src/kvirc/kernel/kvi_internalcmd.cpp | 2 +- src/kvirc/kernel/kvi_ircconnection.cpp | 8 +- src/kvirc/kernel/kvi_ircconnection.h | 8 +- src/kvirc/kernel/kvi_ircconnectionserverinfo.h | 2 +- src/kvirc/kernel/kvi_ircconnectionstatedata.h | 2 +- src/kvirc/kernel/kvi_ircconnectiontarget.cpp | 10 +- src/kvirc/kernel/kvi_ircconnectiontarget.h | 18 +- .../kernel/kvi_ircconnectiontargetresolver.cpp | 6 +- src/kvirc/kernel/kvi_ircconnectionuserinfo.h | 2 +- src/kvirc/kernel/kvi_irccontext.cpp | 30 +- src/kvirc/kernel/kvi_irccontext.h | 4 +- src/kvirc/kernel/kvi_irclink.cpp | 4 +- src/kvirc/kernel/kvi_irclink.h | 2 +- src/kvirc/kernel/kvi_ircsocket.cpp | 6 +- src/kvirc/kernel/kvi_ircsocket.h | 6 +- src/kvirc/kernel/kvi_ircurl.cpp | 4 +- src/kvirc/kernel/kvi_ircurl.h | 4 +- src/kvirc/kernel/kvi_main.cpp | 2 +- src/kvirc/kernel/kvi_notifylist.h | 8 +- src/kvirc/kvs/kvi_kvs_asyncdnsoperation.cpp | 2 +- src/kvirc/kvs/kvi_kvs_corefunctions_sz.cpp | 2 +- src/kvirc/kvs/kvi_kvs_coresimplecommands_sz.cpp | 4 +- src/kvirc/kvs/kvi_kvs_dnsmanager.cpp | 2 +- src/kvirc/kvs/kvi_kvs_object.cpp | 2 +- src/kvirc/module/kvi_mexserverimport.h | 2 +- src/kvirc/sparser/kvi_sp_ctcp.cpp | 58 ++-- src/kvirc/sparser/kvi_sp_literal.cpp | 38 +-- src/kvirc/sparser/kvi_sp_numeric.cpp | 150 ++++----- src/kvirc/sparser/kvi_sp_tables.cpp | 10 +- src/kvirc/sparser/kvi_sparser.cpp | 8 +- src/kvirc/sparser/kvi_sparser.h | 14 +- src/kvirc/ui/kvi_console.cpp | 6 +- src/kvirc/ui/kvi_console.h | 4 +- src/kvirc/ui/kvi_frame.h | 2 +- src/kvirc/ui/kvi_mdichild.cpp | 2 +- src/kvirc/ui/kvi_menubar.cpp | 2 +- src/kvirc/ui/kvi_statusbarapplet.cpp | 2 +- src/modules/about/aboutdialog.cpp | 2 +- src/modules/action/libkviaction.cpp | 2 +- src/modules/addon/libkviaddon.cpp | 2 +- src/modules/avatar/libkviavatar.cpp | 2 +- src/modules/context/libkvicontext.cpp | 2 +- src/modules/dcc/broker.cpp | 2 +- src/modules/dcc/canvas.cpp | 2 +- src/modules/dcc/chat.cpp | 2 +- src/modules/dcc/libkvidcc.cpp | 2 +- src/modules/dcc/marshal.cpp | 2 +- src/modules/dcc/requests.cpp | 2 +- src/modules/dcc/send.cpp | 8 +- src/modules/dcc/thread.cpp | 2 +- src/modules/dcc/video.cpp | 2 +- src/modules/dcc/voice.cpp | 4 +- src/modules/dialog/libkvidialog.cpp | 2 +- src/modules/http/libkvihttp.cpp | 2 +- src/modules/mircimport/libkvimircimport.cpp | 4 +- src/modules/objects/class_button.cpp | 2 +- src/modules/objects/class_buttongroup.cpp | 2 +- src/modules/objects/class_checkbox.cpp | 2 +- src/modules/objects/class_combobox.cpp | 2 +- src/modules/objects/class_datetimeedit.cpp | 2 +- src/modules/objects/class_dialog.cpp | 2 +- src/modules/objects/class_file.cpp | 2 +- src/modules/objects/class_ftp.cpp | 2 +- src/modules/objects/class_groupbox.cpp | 2 +- src/modules/objects/class_http.cpp | 2 +- src/modules/objects/class_label.cpp | 2 +- src/modules/objects/class_lcd.cpp | 2 +- src/modules/objects/class_lineedit.cpp | 2 +- src/modules/objects/class_listwidget.cpp | 2 +- src/modules/objects/class_mainwindow.cpp | 2 +- src/modules/objects/class_memorybuffer.cpp | 2 +- src/modules/objects/class_menubar.cpp | 2 +- src/modules/objects/class_multilineedit.cpp | 2 +- src/modules/objects/class_painter.cpp | 2 +- src/modules/objects/class_popupmenu.cpp | 2 +- src/modules/objects/class_process.cpp | 2 +- src/modules/objects/class_progressbar.cpp | 2 +- src/modules/objects/class_radiobutton.cpp | 2 +- src/modules/objects/class_slider.cpp | 2 +- src/modules/objects/class_socket.cpp | 4 +- src/modules/objects/class_spinbox.cpp | 2 +- src/modules/objects/class_tablewidget.cpp | 2 +- src/modules/objects/class_tabwidget.cpp | 2 +- src/modules/objects/class_tbrowser.cpp | 2 +- src/modules/objects/class_toolbar.cpp | 2 +- src/modules/objects/class_toolbutton.cpp | 2 +- src/modules/objects/class_trayicon.cpp | 2 +- src/modules/objects/class_treewidget.cpp | 2 +- src/modules/objects/class_treewidgetitem.cpp | 2 +- src/modules/objects/class_widget.cpp | 2 +- src/modules/objects/class_window.cpp | 2 +- src/modules/objects/class_wizard.cpp | 2 +- src/modules/objects/class_workspace.cpp | 2 +- src/modules/objects/class_wrapper.cpp | 2 +- src/modules/objects/libkviobjects.cpp | 2 +- src/modules/options/instances.cpp | 38 +-- src/modules/options/optw_servers.cpp | 180 +++++------ src/modules/options/optw_servers.h | 68 ++-- src/modules/serverdb/libkviserverdb.cpp | 38 +-- src/modules/theme/libkvitheme.cpp | 2 +- src/modules/toolbar/libkvitoolbar.cpp | 2 +- src/modules/window/libkviwindow.cpp | 2 +- 136 files changed, 2079 insertions(+), 2131 deletions(-) create mode 100644 src/kvilib/config/KviBuildInfo.cpp create mode 100644 src/kvilib/config/KviBuildInfo.h delete mode 100644 src/kvilib/config/kvi_buildinfo.cpp delete mode 100644 src/kvilib/config/kvi_buildinfo.h create mode 100644 src/kvilib/core/KviError.cpp create mode 100644 src/kvilib/core/KviError.h delete mode 100644 src/kvilib/core/kvi_bswap.h delete mode 100644 src/kvilib/core/kvi_error.cpp delete mode 100644 src/kvilib/core/kvi_error.h delete mode 100644 src/kvilib/core/kvi_strasm.h create mode 100644 src/kvilib/irc/KviIrcNetwork.cpp create mode 100644 src/kvilib/irc/KviIrcNetwork.h delete mode 100644 src/kvilib/irc/KviNetwork.cpp delete mode 100644 src/kvilib/irc/KviNetwork.h diff --git a/src/kvilib/CMakeLists.txt b/src/kvilib/CMakeLists.txt index 3aec39b9b..d247f6676 100644 --- a/src/kvilib/CMakeLists.txt +++ b/src/kvilib/CMakeLists.txt @@ -55,8 +55,8 @@ ENDIF() # Please note that the sources have alphabetic order here SET(kvilib_SRCS - config/kvi_buildinfo.cpp - core/kvi_error.cpp + config/KviBuildInfo.cpp + core/KviError.cpp core/KviHeapObject.cpp core/kvi_hstrEqualCIN.cpp core/KviMemory.cpp @@ -92,7 +92,7 @@ SET(kvilib_SRCS irc/KviIrcServerDataBase.cpp irc/KviIrcUserDataBase.cpp irc/KviMircCntrl.cpp - irc/KviNetwork.cpp + irc/KviIrcNetwork.cpp irc/KviNickServRuleSet.cpp irc/KviUserIdentity.cpp net/KviDnsResolver.cpp diff --git a/src/kvilib/config/KviBuildInfo.cpp b/src/kvilib/config/KviBuildInfo.cpp new file mode 100644 index 000000000..e4064b8f1 --- /dev/null +++ b/src/kvilib/config/KviBuildInfo.cpp @@ -0,0 +1,100 @@ +//============================================================================= +// +// File : KviBuildInfo.cpp +// Creation date : Sat 19 Apr 2008 17:01:57 by Szymon Stefanek +// +// This file is part of the KVIrc IRC Client distribution +// Copyright (C) 2008 Szymon Stefanek +// Copyright (C) 2008 Elvio Basello +// +// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//============================================================================= + +#include "KviBuildInfo.h" +#include "kvi_sourcesdate.h" +#include "kvi_sysbuildinfo.h" + +namespace KviBuildInfo +{ + QString buildDate() + { + return QString(KVIRC_BUILD_DATE); + } + + QString buildSourcesDate() + { + return QString(KVI_SOURCES_DATE); + } + + QString buildCommand() + { + return QString(KVIRC_BUILD_COMMAND); + } + + QString buildFlags() + { + return QString(KVIRC_BUILD_FLAGS); + } + + QString buildSystem() + { + return QString(KVIRC_BUILD_SYSTEM); + } + + QString buildSystemName() + { + #ifdef COMPILE_ON_WINDOWS + return QString(); + #else + return QString(KVIRC_BUILD_SYSTEM_NAME); + #endif + } + + QString buildSystemVersion() + { + #ifdef COMPILE_ON_WINDOWS + return QString(); + #else + return QString(KVIRC_BUILD_SYSTEM_VERSION); + #endif + } + + QString buildCPU() + { + return QString(KVIRC_BUILD_CPU); + } + + QString buildCompiler() + { + return QString(KVIRC_BUILD_COMPILER); + } + + QString buildCompilerFlags() + { + QString flags = QString(KVIRC_BUILD_COMPILER_FLAGS); + if(flags.isEmpty()) return "N/A"; + else return flags; + } + + QString buildRevision() + { + QString rev; + #ifdef KVIRC_BUILD_REVISION + rev = QString(KVIRC_BUILD_REVISION); + #endif + return rev; + } +} diff --git a/src/kvilib/config/KviBuildInfo.h b/src/kvilib/config/KviBuildInfo.h new file mode 100644 index 000000000..12299ebde --- /dev/null +++ b/src/kvilib/config/KviBuildInfo.h @@ -0,0 +1,131 @@ +#ifndef _KVI_BUILDINFO_H_ +#define _KVI_BUILDINFO_H_ +//============================================================================= +// +// File : KviBuildInfo.h +// Creation date : Sat 19 Apr 2008 17:01:57 by Szymon Stefanek +// +// This file is part of the KVIrc IRC Client distribution +// Copyright (C) 2008 Szymon Stefanek +// Copyright (C) 2008 Elvio Basello +// +// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//============================================================================= + +/** +* \file KviBuildInfo.h +* \author Szymon Stefanek +* \brief Useful functions which returns compilation and runtime info +*/ + +#include "kvi_settings.h" +#include "kvi_sourcesdate.h" + +#include + +/** +* \namespace KviBuildInfo +* \brief This namespace contains information gathered at KVIrc build time. +* +* This, in fact, is the last time that "cmake" ran and successfully generated the +* kvilib Makefile. Since kvilib is generally built with the kvirc +* executable, then you can assume that the information returned +* from this namespace strictly applies also to kvirc. +*/ +namespace KviBuildInfo +{ + /** + * \brief Retrieve the latest kvilib/kvirc build date. + * \return QString + */ + extern KVILIB_API QString buildDate(); + + /** + * \brief Returns the date tag applied to the currently compiled SVN sources. + * \return QString + */ + extern KVILIB_API QString buildSourcesDate(); + + /** + * \brief Returns the build command used by cmake to create the KVIrc executable. + * \return QString + */ + extern KVILIB_API QString buildCommand(); + + /** + * \brief Returns the build flags + * + * The build flags were worked out by CMake at compilation time. + * \return QString + */ + extern KVILIB_API QString buildFlags(); + + /** + * \brief Returns a description of the system + * + * The system refers to the one used to build the KVIrc executable. + * \return QString + */ + extern KVILIB_API QString buildSystem(); + + /** + * \brief Returns the name part of the system + * + * The system name refers to the one used to build the KVIrc executable. + * \return QString + */ + extern KVILIB_API QString buildSystemName(); + + /** + * \brief Returns the version part of the system + * + * The system version refers to the one used to build the KVIrc executable. + * \return QString + */ + extern KVILIB_API QString buildSystemVersion(); + + /** + * \brief Returns a description of the CPU + * + * The CPU refers to the one used to build the KVIrc executable. + * \return QString + */ + extern KVILIB_API QString buildCPU(); + + /** + * \brief Returns a description of the compiler + * + * The compiler refers to the one used to build the KVIrc executable. + * \return QString + */ + extern KVILIB_API QString buildCompiler(); + + /** + * \brief Returns a description of the compiler flags + * + * The flags refer to the ones used to build the KVIrc executable. + * \return QString + */ + extern KVILIB_API QString buildCompilerFlags(); + + /** + * \brief Returns the SVN revision number of the local repository + * \return QString + */ + extern KVILIB_API QString buildRevision(); +} + +#endif //!_KVI_BUILDINFO_H_ diff --git a/src/kvilib/config/kvi_buildinfo.cpp b/src/kvilib/config/kvi_buildinfo.cpp deleted file mode 100644 index 4ea7a19de..000000000 --- a/src/kvilib/config/kvi_buildinfo.cpp +++ /dev/null @@ -1,100 +0,0 @@ -//============================================================================= -// -// File : kvi_buildinfo.cpp -// Creation date : Sat 19 Apr 2008 17:01:57 by Szymon Stefanek -// -// This file is part of the KVIrc IRC Client distribution -// Copyright (C) 2008 Szymon Stefanek -// Copyright (C) 2008 Elvio Basello -// -// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -//============================================================================= - -#include "kvi_buildinfo.h" -#include "kvi_sourcesdate.h" -#include "kvi_sysbuildinfo.h" - -namespace KviBuildInfo -{ - QString buildDate() - { - return QString(KVIRC_BUILD_DATE); - } - - QString buildSourcesDate() - { - return QString(KVI_SOURCES_DATE); - } - - QString buildCommand() - { - return QString(KVIRC_BUILD_COMMAND); - } - - QString buildFlags() - { - return QString(KVIRC_BUILD_FLAGS); - } - - QString buildSystem() - { - return QString(KVIRC_BUILD_SYSTEM); - } - - QString buildSystemName() - { - #ifdef COMPILE_ON_WINDOWS - return QString(); - #else - return QString(KVIRC_BUILD_SYSTEM_NAME); - #endif - } - - QString buildSystemVersion() - { - #ifdef COMPILE_ON_WINDOWS - return QString(); - #else - return QString(KVIRC_BUILD_SYSTEM_VERSION); - #endif - } - - QString buildCPU() - { - return QString(KVIRC_BUILD_CPU); - } - - QString buildCompiler() - { - return QString(KVIRC_BUILD_COMPILER); - } - - QString buildCompilerFlags() - { - QString flags = QString(KVIRC_BUILD_COMPILER_FLAGS); - if(flags.isEmpty()) return "N/A"; - else return flags; - } - - QString buildRevision() - { - QString rev; - #ifdef KVIRC_BUILD_REVISION - rev = QString(KVIRC_BUILD_REVISION); - #endif - return rev; - } -} diff --git a/src/kvilib/config/kvi_buildinfo.h b/src/kvilib/config/kvi_buildinfo.h deleted file mode 100644 index b1450ee2f..000000000 --- a/src/kvilib/config/kvi_buildinfo.h +++ /dev/null @@ -1,131 +0,0 @@ -#ifndef _KVI_BUILDINFO_H_ -#define _KVI_BUILDINFO_H_ -//============================================================================= -// -// File : kvi_buildinfo.h -// Creation date : Sat 19 Apr 2008 17:01:57 by Szymon Stefanek -// -// This file is part of the KVIrc IRC Client distribution -// Copyright (C) 2008 Szymon Stefanek -// Copyright (C) 2008 Elvio Basello -// -// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -//============================================================================= - -/** -* \file kvi_buildinfo.h -* \author Szymon Stefanek -* \brief Useful functions which returns compilation and runtime info -*/ - -#include "kvi_settings.h" -#include "kvi_sourcesdate.h" - -#include - -/** -* \namespace KviBuildInfo -* \brief This namespace contains information gathered at KVIrc build time. -* -* This, in fact, is the last time that "cmake" ran and successfully generated the -* kvilib Makefile. Since kvilib is generally built with the kvirc -* executable, then you can assume that the information returned -* from this namespace strictly applies also to kvirc. -*/ -namespace KviBuildInfo -{ - /** - * \brief Retrieve the latest kvilib/kvirc build date. - * \return QString - */ - extern KVILIB_API QString buildDate(); - - /** - * \brief Returns the date tag applied to the currently compiled SVN sources. - * \return QString - */ - extern KVILIB_API QString buildSourcesDate(); - - /** - * \brief Returns the build command used by cmake to create the KVIrc executable. - * \return QString - */ - extern KVILIB_API QString buildCommand(); - - /** - * \brief Returns the build flags - * - * The build flags were worked out by CMake at compilation time. - * \return QString - */ - extern KVILIB_API QString buildFlags(); - - /** - * \brief Returns a description of the system - * - * The system refers to the one used to build the KVIrc executable. - * \return QString - */ - extern KVILIB_API QString buildSystem(); - - /** - * \brief Returns the name part of the system - * - * The system name refers to the one used to build the KVIrc executable. - * \return QString - */ - extern KVILIB_API QString buildSystemName(); - - /** - * \brief Returns the version part of the system - * - * The system version refers to the one used to build the KVIrc executable. - * \return QString - */ - extern KVILIB_API QString buildSystemVersion(); - - /** - * \brief Returns a description of the CPU - * - * The CPU refers to the one used to build the KVIrc executable. - * \return QString - */ - extern KVILIB_API QString buildCPU(); - - /** - * \brief Returns a description of the compiler - * - * The compiler refers to the one used to build the KVIrc executable. - * \return QString - */ - extern KVILIB_API QString buildCompiler(); - - /** - * \brief Returns a description of the compiler flags - * - * The flags refer to the ones used to build the KVIrc executable. - * \return QString - */ - extern KVILIB_API QString buildCompilerFlags(); - - /** - * \brief Returns the SVN revision number of the local repository - * \return QString - */ - extern KVILIB_API QString buildRevision(); -} - -#endif //!_KVI_BUILDINFO_H_ diff --git a/src/kvilib/config/kvi_debug.h b/src/kvilib/config/kvi_debug.h index 1b03dfdae..8919ad909 100644 --- a/src/kvilib/config/kvi_debug.h +++ b/src/kvilib/config/kvi_debug.h @@ -33,43 +33,8 @@ * \file kvi_debug.h * \author Szymon Stefanek * \brief This file contains the definition of the debug macros; -* You can enable ALL the debugging output by uncommenting the line that defines _KVI_DEBUG_CHECK_RANGE_ */ -#if 0 - -//============================================================================= -// -// You can enable ALL the debugging output by uncommenting the next line -// #define _KVI_DEBUG_CHECK_RANGE_ -// -//============================================================================= - -/** -* \brief Debug macros -* -* \def KVI_ASSERT Assert that ensures that its parameter is true -* \def __range_invalid Assert that ensures that its parameter is false -* \def __ASSERT Assert that ensures that its parameter is true; enabled only if _KVI_DEBUG_or __KVI_DEBUG__ is defined -*/ - -#ifdef _KVI_DEBUG_CHECK_RANGE_ - #define KVI_ASSERT(_expr) if(!(_expr))qDebug("[kvirc]: ASSERT FAILED: \"%s\" is false in %s (%d)",#_expr,__FILE__,__LINE__) - #define __range_invalid(_expr) if(_expr)qDebug("[kvirc]: ASSERT FAILED: \"%s\" is true in %s (%d)",#_expr,__FILE__,__LINE__) -#else - #define KVI_ASSERT(_expr) - #define __range_invalid(_expr) -#endif - -#if defined(_KVI_DEBUG_) || defined(__KVI_DEBUG__) - #define __ASSERT(_expr) if(!(_expr))qDebug("[kvirc]: ASSERT FAILED: \"%s\" is false in %s (%d)",#_expr,__FILE__,__LINE__) -#else - #define __ASSERT(_expr) -#endif - -#endif - - #include // abort #ifdef __GNUC__ @@ -90,7 +55,6 @@ #endif //!__GNUC__ - #ifdef COMPILE_DEBUG_MODE #define KVI_ASSERT(__condition__) \ diff --git a/src/kvilib/core/KviCString.h b/src/kvilib/core/KviCString.h index c226d295c..ccc114e5b 100644 --- a/src/kvilib/core/KviCString.h +++ b/src/kvilib/core/KviCString.h @@ -61,20 +61,17 @@ __KVI_EXTERN KVILIB_API bool kvi_qstringEqualCI(const QString &s1,const QString // Include inlined assembly implementations if required -#ifdef COMPILE_ix86_ASM - #include "kvi_strasm.h" -#else - // Returns true if the string str1 is equal to str2. case sensitive. - __KVI_EXTERN KVILIB_API bool kvi_strEqualCS(const char *str1,const char *str2); - // Returns true if the forst len characters of string str1 are equal to str2. - // case sensitive. - // Note that if str1 or str2 are shorter than len characters then are considered as NOT equal! - __KVI_EXTERN KVILIB_API bool kvi_strEqualCSN(const char *str1,const char *str2,int len); - // no such tricks in non-asm - #define kvi_strEqualNoLocaleCI(str1,str2) kvi_strEqualCI(str1,str2) - #define kvi_strEqualNoLocaleCIN(str1,str2,len) kvi_strEqualCIN(str1,str2,len) - #define kvi_strLen(str) strlen(str) -#endif + +// Returns true if the string str1 is equal to str2. case sensitive. +__KVI_EXTERN KVILIB_API bool kvi_strEqualCS(const char *str1,const char *str2); +// Returns true if the forst len characters of string str1 are equal to str2. +// case sensitive. +// Note that if str1 or str2 are shorter than len characters then are considered as NOT equal! +__KVI_EXTERN KVILIB_API bool kvi_strEqualCSN(const char *str1,const char *str2,int len); +// no such tricks in non-asm +#define kvi_strEqualNoLocaleCI(str1,str2) kvi_strEqualCI(str1,str2) +#define kvi_strEqualNoLocaleCIN(str1,str2,len) kvi_strEqualCIN(str1,str2,len) +#define kvi_strLen(str) strlen(str) // Returns true if the string str1 is equal to str2. // case insensitive. diff --git a/src/kvilib/core/KviError.cpp b/src/kvilib/core/KviError.cpp new file mode 100644 index 000000000..599c990ec --- /dev/null +++ b/src/kvilib/core/KviError.cpp @@ -0,0 +1,234 @@ +//============================================================================= +// +// File : KviError.cpp +// Creation date : Sun Jul 02 2000 18:37:02 by Szymon Stefanek +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2000-2010 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//============================================================================= + + +#define _KVI_ERROR_CPP_ + +#include "KviLocale.h" +#include "KviError.h" +#include "kvi_settings.h" + + +#if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) + #include // for the WSAE* error codes +#endif + +#include + +#ifdef HAVE_STRERROR + #include // for strerror() +#endif + +// FIXME: This stuff should basically die and be eventually replaced with some +// helper functions for handling ONLY system errors. +// +// WARNING: getDescription() is not even thread safe... it will die in the near future + +const char * g_errorTable[KVI_NUM_ERRORS]= +{ + __tr_no_lookup("Success"), // 000: success + __tr_no_lookup("Unknown error"), // 001: unkonwnError + __tr_no_lookup("Internal error"), // 002: internalError + __tr_no_lookup("Unknown command"), // 003: unknownCommand + __tr_no_lookup("Missing closing brace"), // 004: missingClosingBrace + __tr_no_lookup("Unexpected end of command in string"), // 005: unexpectedEndInString + __tr_no_lookup("Unexpected end of command in dictionary key"), // 006: unexpectedEndInDictionaryKey + __tr_no_lookup("Switch dash without switch letter"), // 007: switchDashWithoutSwitchLetter + __tr_no_lookup("Unknown function"), // 008: unknownFunction + __tr_no_lookup("Unexpected end of command in parenthesis"), // 009: unexpectedEndInParenthesis + __tr_no_lookup("Unexpected end of command in function parameters"), // 010: unexpectedEndInFunctionParams + __tr_no_lookup("Missing variable name"), // 011: missingVariableName + __tr_no_lookup("Variable or identifier expected"), // 012: variableOrIdentifierExpected + __tr_no_lookup("Left operand is not a number"), // 013: leftOperandIsNotANumber + __tr_no_lookup("Multiple operations not supported for numeric operators"), // 014: multipleOpsNotSupportedForOperator + __tr_no_lookup("Division by zero"), // 015: divisionByZero + __tr_no_lookup("Modulo by zero"), // 016: moduloByZero + __tr_no_lookup("Right operand is not a number"), // 017: rightOperandIsNotANumber + __tr_no_lookup("Unterminated expression (missing ')' ?)"), // 018: unterminatedExpression + __tr_no_lookup("Unterminated subexpression (Parenthesis mismatch)"), // 019: unterminatedSubexpression + __tr_no_lookup("Unexpected character"), // 020: unexpectedCharacter + __tr_no_lookup("Unknown operator"), // 021: unknownOperator + __tr_no_lookup("No host to resolve"), // 022 + __tr_no_lookup("(DNS Internal) Unsupported address family"), // 023 + __tr_no_lookup("Valid name but the host has no IP address"), // 024 + __tr_no_lookup("Unrecoverable nameserver error (crashed ?)"), // 025 + __tr_no_lookup("Dns temporaneous fault (try again)"), // 026 + __tr_no_lookup("(DNS Internal) Bad flags"), // 027 + __tr_no_lookup("(DNS Internal) Out of memory"), // 028 + __tr_no_lookup("(DNS Internal) Service not supported"), // 029 + __tr_no_lookup("Unknown node (host not found)"), // 030 + __tr_no_lookup("(DNS Internal) Unsupported socket type"), // 031 + __tr_no_lookup("Dns query failed"), // 032 + __tr_no_lookup("This KVIrc executable has no IPV6 support"), // 033 + __tr_no_lookup("Host not found"), // 034 + __tr_no_lookup("(DNS Internal) IPC failure (slave data corrupted)"), // 035 + __tr_no_lookup("Another connection in progress"), // 036 + __tr_no_lookup("Invalid IP address"), // 037 + __tr_no_lookup("Socket creation failed"), // 038 + __tr_no_lookup("Failed to put the socket in non blocking mode"), // 039 + __tr_no_lookup("Bad file descriptor"), // 040 + __tr_no_lookup("Out of address space"), // 041 + __tr_no_lookup("Connection refused"), // 042 + __tr_no_lookup("Kernel networking panic"), // 043 + __tr_no_lookup("Connection timed out"), // 044 + __tr_no_lookup("Network is unreachable"), // 045 + __tr_no_lookup("Broken pipe"), // 046 + __tr_no_lookup("Invalid proxy address"), // 047 + __tr_no_lookup("Remote end has closed the connection"), // 048 + __tr_no_lookup("Invalid irc context id"), // 049 + __tr_no_lookup("Error in loading module"), // 050 + __tr_no_lookup("No such module command"), // 051 + __tr_no_lookup("No such module function"), // 052 + __tr_no_lookup("Left operand is not a dictionary reference"), // 053 + __tr_no_lookup("Right operand is not a dictionary reference"), // 054 + __tr_no_lookup("Missing object class name"), // 055 + __tr_no_lookup("No such object class"), // 056 + __tr_no_lookup("No such object"), // 057 + __tr_no_lookup("No such object function"), // 058 + __tr_no_lookup("Invalid left operand"), // 059 + __tr_no_lookup("Not enough parameters"), // 060 + __tr_no_lookup("Integer parameter expected"), // 061 + __tr_no_lookup("Invalid parameter"), // 062 + __tr_no_lookup("No such file"), // 063 + __tr_no_lookup("Open parenthesis expected"), // 064 + __tr_no_lookup("Open brace expected"), // 065 + __tr_no_lookup("Can't kill a builtin class"), // 066 + __tr_no_lookup("The SOCKSv4 protocol lacks IPv6 support"), // 067 + __tr_no_lookup("Unrecognized proxy reply"), // 068 + __tr_no_lookup("Proxy response: auth failed: access denied"), + __tr_no_lookup("Proxy response: No acceptable auth method: request rejected"), + __tr_no_lookup("Proxy response: request failed"), + __tr_no_lookup("Proxy response: ident failed"), + __tr_no_lookup("Proxy response: ident not matching"), + __tr_no_lookup("Proxy response: general SOCKS failure"), + __tr_no_lookup("Proxy response: connection not allowed"), + __tr_no_lookup("Proxy response: network unreachable"), + __tr_no_lookup("Proxy response: host unreachable"), + __tr_no_lookup("Proxy response: connection refused"), + __tr_no_lookup("Proxy response: TTL expired"), + __tr_no_lookup("Proxy response: command not supported"), + __tr_no_lookup("Proxy response: address type not supported"), + __tr_no_lookup("Proxy response: invalid address"), + __tr_no_lookup("Invalid port number"), + __tr_no_lookup("Socket not connected"), + __tr_no_lookup("Insufficient resources to complete the operation"), + __tr_no_lookup("Can't setup a listening socket : bind failed"), + __tr_no_lookup("Can't resolve the localhost name"), + __tr_no_lookup("Unsupported image format"), + __tr_no_lookup("Can't open file for appending"), + __tr_no_lookup("Can't open file for writing"), + __tr_no_lookup("File I/O error"), + __tr_no_lookup("Acknowledge error"), + __tr_no_lookup("Can't open file for reading"), + __tr_no_lookup("Can't send a zero-size file"), + __tr_no_lookup("Missing popup name"), + __tr_no_lookup("'item', 'popup', 'label' or 'separator' keyword expected"), + __tr_no_lookup("Self modification not allowed"), + __tr_no_lookup("UNUSED"), + __tr_no_lookup("Feature not available"), + __tr_no_lookup("Unexpected characters in array index"), + __tr_no_lookup("Unexpected end in expression"), + __tr_no_lookup("Unexpected end in array index"), + __tr_no_lookup("Connection thru HTTP proxy failed"), + __tr_no_lookup("Case, match, regexp, default or break keyword expected"), + __tr_no_lookup("Access denied"), + __tr_no_lookup("Address already in use"), + __tr_no_lookup("Can't assign the requested address"), + __tr_no_lookup("Connection reset by peer"), + __tr_no_lookup("Host unreachable (no route to host)"), + __tr_no_lookup("Variable expected"), + __tr_no_lookup("Invalid array index: positive integer expected"), + __tr_no_lookup("listen() call failed"), + __tr_no_lookup("This executable has been compiled without SSL support"), + __tr_no_lookup("Secure Socket Layer error"), + __tr_no_lookup("Slash (/) character expected"), + __tr_no_lookup("Unknown string manipulation operation"), + __tr_no_lookup("Operation aborted"), + __tr_no_lookup("Unexpected token"), + __tr_no_lookup("Scope object already defined (unexpected @)"), + __tr_no_lookup("There is no $this pointer in this scope (unexpected @)") +}; + +namespace KviError +{ + const char * getUntranslatedDescription(int iErrorCode) + { + if((iErrorCode < KVI_NUM_ERRORS) && (iErrorCode >= 0)) + return g_errorTable[iErrorCode]; +#ifdef HAVE_STRERROR + if(iErrorCode < 0)return strerror(-iErrorCode); +#endif + return g_errorTable[KviError_unknownError]; + } + + QString getDescription(int iErrorCode) + { + return __tr2qs_no_xgettext(getUntranslatedDescription(iErrorCode)); + } + + int translateSystemError(int iErrNo) + { +#if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) + switch(iErrNo) + { + case EBADF: return KviError_badFileDescriptor; break; + case WSAEINVAL: + case WSAEFAULT: + case EFAULT: return KviError_outOfAddressSpace; break; + case WSAECONNREFUSED: return KviError_connectionRefused; break; + case WSAENOTSOCK: return KviError_kernelNetworkingPanic; break; + case WSAETIMEDOUT: return KviError_connectionTimedOut; break; + case WSAENETUNREACH: return KviError_networkUnreachable; break; + case EPIPE: return KviError_brokenPipe; break; + case WSAENOTCONN: return KviError_socketNotConnected; break; + case WSAEACCES: return KviError_accessDenied; break; + case WSAEADDRINUSE: return KviError_addressAlreadyInUse; break; + case WSAEADDRNOTAVAIL: return KviError_cantAssignRequestedAddress; break; + case WSAEAFNOSUPPORT: return KviError_unsupportedAddressFamily; break; + case WSAECONNRESET: return KviError_connectionResetByPeer; break; + case WSAEHOSTUNREACH: return KviError_hostUnreachable; break; + + //case ENOBUFS: return KviError_insufficientResources; break; + // Unhandled error...pass errno to the strerror function + default: return -iErrNo; break; + } +#else + switch(iErrNo) + { + case EBADF: return KviError_badFileDescriptor; break; + case EFAULT: return KviError_outOfAddressSpace; break; + case ECONNREFUSED: return KviError_connectionRefused; break; + case ENOTSOCK: return KviError_kernelNetworkingPanic; break; + case ETIMEDOUT: return KviError_connectionTimedOut; break; + case ENETUNREACH: return KviError_networkUnreachable; break; + case EPIPE: return KviError_brokenPipe; break; + case ENOTCONN: return KviError_socketNotConnected; break; + case ENOBUFS: return KviError_insufficientResources; break; + case EHOSTUNREACH: return KviError_hostUnreachable; break; + // Unhandled error...pass errno to the strerror function + default: return -iErrNo; break; + } +#endif + } +} diff --git a/src/kvilib/core/KviError.h b/src/kvilib/core/KviError.h new file mode 100644 index 000000000..849dcde52 --- /dev/null +++ b/src/kvilib/core/KviError.h @@ -0,0 +1,215 @@ +#ifndef _KVI_ERROR_H_ +#define _KVI_ERROR_H_ +//============================================================================= +// +// File : KviError.h +// Creation date : Sun Jul 02 2000 18:35:56 by Szymon Stefanek +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2000-2010 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//============================================================================= + +/** +* \file KviError.h +* \author Szymon Stefanek +* \brief Error List +*/ + +#include "kvi_settings.h" +#include "KviQString.h" + +#define KviError_success 0 +#define KviError_unknownError 1 +#define KviError_internalError 2 +#define KviError_unknownCommand 3 +#define KviError_missingClosingBrace 4 +#define KviError_unexpectedEndInString 5 +#define KviError_unexpectedEndInDictionaryKey 6 +#define KviError_switchDashWithoutSwitchLetter 7 +#define KviError_unknownFunction 8 +#define KviError_unexpectedEndInParenthesis 9 +#define KviError_unexpectedEndInFunctionParams 10 +#define KviError_missingVariableName 11 +#define KviError_variableOrIdentifierExpected 12 +#define KviError_leftOperandIsNotANumber 13 +#define KviError_multipleOpsNotSupportedForOperator 14 +#define KviError_divisionByZero 15 +#define KviError_moduloByZero 16 +#define KviError_rightOperandIsNotANumber 17 +#define KviError_unterminatedExpression 18 +#define KviError_unterminatedSubexpression 19 +#define KviError_unexpectedCharacter 20 +#define KviError_unknownOperator 21 + +#define KviError_noHostToResolve 22 +#define KviError_unsupportedAddressFamily 23 +#define KviError_validNameButNoIpAddress 24 +#define KviError_unrecoverableNameserverError 25 +#define KviError_dnsTemporaneousFault 26 +#define KviError_dnsInternalErrorBadFlags 27 +#define KviError_dnsInternalErrorOutOfMemory 28 +#define KviError_dnsInternalErrorServiceNotSupported 29 +#define KviError_dnsNoName 30 +#define KviError_dnsInternalErrorUnsupportedSocketType 31 +#define KviError_dnsQueryFailed 32 +#define KviError_noIPv6Support 33 +#define KviError_hostNotFound 34 +#define KviError_dnsInternalIPCFailure 35 + +#define KviError_anotherConnectionInProgress 36 +#define KviError_invalidIpAddress 37 +#define KviError_socketCreationFailed 38 +#define KviError_asyncSocketFailed 39 +#define KviError_badFileDescriptor 40 +#define KviError_outOfAddressSpace 41 +#define KviError_connectionRefused 42 +#define KviError_kernelNetworkingPanic 43 +#define KviError_connectionTimedOut 44 +#define KviError_networkUnreachable 45 +#define KviError_brokenPipe 46 +#define KviError_invalidProxyAddress 47 +#define KviError_remoteEndClosedConnection 48 + +#define KviError_invalidIrcContextId 49 +#define KviError_errorInLoadingModule 50 +#define KviError_noSuchModuleCommand 51 +#define KviError_noSuchModuleFunction 52 + +#define KviError_leftOperandIsNotADictionaryReference 53 +#define KviError_rightOperandIsNotADictionaryReference 54 + +#define KviError_missingObjectClassName 55 +#define KviError_noSuchObjectClass 56 +#define KviError_noSuchObject 57 +#define KviError_noSuchObjectFunction 58 + +#define KviError_invalidLeftOperand 59 + +#define KviError_notEnoughParameters 60 +#define KviError_integerParameterExpected 61 +#define KviError_invalidParameter 62 + +#define KviError_noSuchFile 63 + +#define KviError_openParenthesisExpected 64 +#define KviError_openBraceExpected 65 + +#define KviError_cantKillABuiltinClass 66 +#define KviError_socksV4LacksIPv6Support 67 +#define KviError_unrecognizedProxyReply 68 +#define KviError_proxyAuthFailed 69 +#define KviError_proxyNoAcceptableAuthMethod 70 + +#define KviError_proxyReply91RequestFailed 71 +#define KviError_proxyReply92IdentFailed 72 +#define KviError_proxyReply93IdentNotMatching 73 +#define KviError_proxyReply01GeneralSOCKSFailure 74 +#define KviError_proxyReply02ConnectionNotAllowed 75 +#define KviError_proxyReply03NetworkUnreachable 76 +#define KviError_proxyReply04HostUnreachable 77 +#define KviError_proxyReply05ConnectionRefused 78 +#define KviError_proxyReply06TTLExpired 79 +#define KviError_proxyReply07CommandNotSupported 80 +#define KviError_proxyReply08AddressTypeNotSupported 81 +#define KviError_proxyReply09InvalidAddress 82 + +#define KviError_invalidPortNumber 83 +#define KviError_socketNotConnected 84 +#define KviError_insufficientResources 85 +#define KviError_bindFailed 86 +#define KviError_cantResolveLocalhost 87 + +#define KviError_unsupportedImageFormat 88 + +#define KviError_cantOpenFileForAppending 89 +#define KviError_cantOpenFileForWriting 90 +#define KviError_fileIOError 91 +#define KviError_acknowledgeError 92 +#define KviError_cantOpenFileForReading 93 +#define KviError_cantSendAZeroSizeFile 94 + +#define KviError_missingPopupName 95 +#define KviError_itemPopupOrSeparatorExpected 96 +#define KviError_selfModificationNotAllowed 97 + +//#define KviError_recursionTooDeep 98 +#define KviError_featureNotAvailable 99 + +#define KviError_unexpectedCharactersInArrayIndex 100 +#define KviError_unexpectedEndInExpression 101 +#define KviError_unexpectedEndInArrayIndex 102 + +#define KviError_proxyHttpFailure 103 +#define KviError_caseMatchRegexpDefaultOrBreakExpected 104 + + +#define KviError_accessDenied 105 +#define KviError_addressAlreadyInUse 106 +#define KviError_cantAssignRequestedAddress 107 +#define KviError_connectionResetByPeer 108 +#define KviError_hostUnreachable 109 + +#define KviError_variableExpected 110 +#define KviError_invalidArrayIndex 111 + +#define KviError_listenFailed 112 + +#define KviError_noSSLSupport 113 +#define KviError_SSLError 114 + +#define KviError_slashCharacterExpected 115 +#define KviError_unknownStringManipulationOperator 116 + +#define KviError_operationAborted 117 + +#define KviError_unexpectedToken 118 + +#define KviError_scopeObjectAlreadyDefined 119 +#define KviError_noThisObject 120 + +#define KVI_NUM_ERRORS 121 + +/** +* \namespace KviError +* \brief This namespace handle the error codes +*/ +namespace KviError +{ + /** + * \brief Returns the description of the error + * \param iErrorCode The code number of the error + * \return QString + */ + KVILIB_API QString getDescription(int iErrorCode); + + /** + * \brief Returns an untranslated description of the error + * \param iErrorCode The code number of the error + * \return const char * + */ + KVILIB_API const char * getUntranslatedDescription(int iErrorCode); + + /** + * \brief Gets system errors and returns their code number + * \param iErrNo The code number of the system error + * \return int + */ + KVILIB_API int translateSystemError(int iErrNo); +} + +#endif //_KVI_ERROR_H_ diff --git a/src/kvilib/core/KviMemory.cpp b/src/kvilib/core/KviMemory.cpp index e4fc98f59..25426280e 100644 --- a/src/kvilib/core/KviMemory.cpp +++ b/src/kvilib/core/KviMemory.cpp @@ -208,10 +208,11 @@ namespace KviMemory // memmove and memcpy implementations. // // Modern compilers coupled with decent C library implementations we have these days - // can do better than plain assembler. The glibc memcpy implementation, for instance, - // can copy entire pages of memory at very low cost by using virtual address manipulation - // tricks. 64bit architectures can move bytes in larger chunks too. - + // can do better than plain assembler. The i586 glibc memcpy implementation, for instance, + // will keep the cache well-filled and both pipelines of the pentium busy at the same time + // while the mach implementation can even copy entire pages of memory at very low cost by + // using virtual address manipulationtricks. 64bit architectures can move bytes in larger + // chunks and there are MXX and SSE optimisations available. #ifdef COMPILE_ix86_ASM @@ -396,6 +397,196 @@ namespace KviMemory return dst_ptr; } + //============================================================================= + // + // File : kvi_strasm.h + // Creation date : Sun Jun 18 2000 18:38:26 by Szymon Stefanek + // + // This file is part of the KVirc irc client distribution + // Copyright (C) 2000-2010 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + // + //============================================================================= + + //============================================================================= + // + // Inline assembly implementations of the commonly used string functions + // These will work only on i386 based machines and can be compiled + // only by gcc + // + //============================================================================= + + inline bool kvi_strEqualCS(const char * pcStr1, const char * pcStr2) + { + // An instruction pattern is really useful in this case. + // When inlining, GCC can optimize to load esi and edi + // directly with the strings, without pushing and getting it + // from the stack... + register bool bEax; + __asm__ __volatile__ ( + " cld\n" + "1:\n" + " lodsb %%ds:(%%esi),%%al\n" + " scasb %%es:(%%edi),%%al\n" + " jne 2f\n" + " testb %%al,%%al\n" + " jne 1b\n" + " movl $0x1,%%eax\n" + " jmp 3f\n" + "2:\n" + " xorl %%eax,%%eax\n" + "3:" + : "=a" (bEax), "=&S" (pcStr1), "=&D" (pcStr2) + : "1" (pcStr1), "2" (pcStr2) + ); + return bEax; + } + + inline bool kvi_strEqualCSN(const char * pcStr1, const char * pcStr2, int iLen) + { + register bool bEax; + __asm__ __volatile__ ( + "1:\n" + " decl %3\n" + " js 2f\n" + " movb (%1),%%al\n" + " incl %1\n" + " cmpb %%al,(%2)\n" + " jne 3f\n" + " incl %2\n" + " testb %%al,%%al\n" + " jne 1b\n" + "2:\n" + " movl $0x1,%%eax\n" + " jmp 4f\n" + "3:\n" + " xorl %%eax,%%eax\n" + "4:\n" + : "=a" (bEax), "=r" (pcStr1), "=r" (pcStr2), "=r" (iLen) + : "1" (pcStr1), "2" (pcStr2), "3" (iLen) + ); + return bEax; + } + + // OPTIMIZATION + // The following two functions are used to compare a variable string with one in that + // only A-Z<->a-z case insensivity is significant. + // For example + // kvi_strEqualNoLocalCI("a string that does not contain any strange char",str2) + // will always give the correct result + // These will NOT work with localizable characters: + // 'a' with umlaut will be not equal to 'A' with umlaut + + inline bool kvi_strEqualNoLocaleCI(const char * pcStr1, const char * pcStr2) + { + // Trivial implementation + // Ignores completely locales....only A-Z chars are transformed to a-z + // Anyway...it will work for IRC :) + register int iReg; + register bool bEax; + __asm__ __volatile__ ( + "1:\n" + " movb (%2),%%al\n" + " cmpb $65,%%al\n" + " jb 2f\n" + " cmpb $90,%%al\n" + " ja 2f\n" + " addb $32,%%al\n" + "2:\n" + " movb (%3),%b1\n" + " cmpb $65,%b1\n" + " jb 3f\n" + " cmpb $90,%b1\n" + " ja 3f\n" + " addb $32,%b1\n" + "3:\n" + " cmpb %%al,%b1\n" + " jne 4f\n" + " incl %2\n" + " incl %3\n" + " testb %%al,%%al\n" + " jne 1b\n" + " movl $1,%%eax\n" + " jmp 5f\n" + "4:\n" + " xorl %%eax,%%eax\n" + "5:\n" + : "=a" (bEax), "=q" (iReg), "=r" (pcStr1), "=r" (pcStr2) + : "2" (pcStr1), "3" (pcStr2) + ); + return bEax; + } + + inline bool kvi_strEqualNoLocaleCIN(const char * pcStr1, const char * pcStr2, int iLen) + { + + register int iReg; + register bool bEax; + __asm__ __volatile__ ( + "1:\n" + " decl %4\n" + " js 4f\n" + " movb (%2),%%al\n" + " cmpb $65,%%al\n" + " jb 2f\n" + " cmpb $90,%%al\n" + " ja 2f\n" + " addb $32,%%al\n" + "2:\n" + " movb (%3),%b1\n" + " cmpb $65,%b1\n" + " jb 3f\n" + " cmpb $90,%b1\n" + " ja 3f\n" + " addb $32,%b1\n" + "3:\n" + " cmpb %%al,%b1\n" + " jne 5f\n" + " incl %2\n" + " incl %3\n" + " testb %%al,%%al\n" + " jne 1b\n" + "4:\n" + " movl $1,%%eax\n" + " jmp 6f\n" + "5:\n" + " xorl %%eax,%%eax\n" + "6:\n" + : "=a" (bEax), "=q" (iReg), "=r" (pcStr1), "=r" (pcStr2), "=r" (iLen) + : "2" (pcStr1), "3" (pcStr2), "4" (iLen) + ); + return bEax; + } + + inline int kvi_strLen(const char * pcStr) + { + register int iEcx; + __asm__ __volatile__( + " cld\n" + " repne\n" + " scasb\n" + " notl %0\n" + " decl %0" + : "=c" (iEcx), "=&D" (pcStr) + : "0" (0xffffffff), "1" (pcStr), "a" (0) + ); + return iEcx; + } + + #endif //0 } diff --git a/src/kvilib/core/kvi_bswap.h b/src/kvilib/core/kvi_bswap.h deleted file mode 100644 index 0f6060481..000000000 --- a/src/kvilib/core/kvi_bswap.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef _KVI_BSWAP_H_ -#define _KVI_BSWAP_H_ - -//============================================================================= -// -// File : kvi_bswap.h -// Creation date : Fri Mar 19 1999 03:15:21 CEST by Szymon Stefanek -// -// This file is part of the KVirc irc client distribution -// Copyright (C) 1999-2010 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -//============================================================================= - -/** -* \file kvi_bswap.h -* \author Szymon Stefanek -* \brief Bit Swap functions -*/ - -#include "kvi_settings.h" -#include "kvi_inttypes.h" - -// KVILIB_API has been removed from these two functions -// these should always go inlined - -/** -* \brief Swaps the endianess of a kvi_u64_t -* -* \param i the original value -* \return kvi_u64_t -*/ -inline kvi_u64_t kvi_swap64(kvi_u64_t i) -{ - // abcdefgh to hgfedcba - return ((i << 56) | /* h to a */ - ((i & 0xff00) << 40) | /* g to b */ - ((i & 0xff0000) << 24) | /* f to c */ - ((i & 0xff000000) << 8) | /* e to d */ - ((i >> 8) & 0xff000000) | /* d to e */ - ((i >> 24) & 0xff0000) | /* c to f */ - ((i >> 40) & 0xff00) | /* b to g */ - (i >> 56)); /* a to h */ -} - -/** -* \brief Swaps the endianess of a kvi_u32_t -* -* \param i the original value -* \return kvi_u32_t -*/ -inline kvi_u32_t kvi_swap32(kvi_u32_t i) -{ - // abcd to dcba - return ((i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24)); -} - -/** -* \brief Swaps the endianess of a kvi_u16_t -* -* \param i the original value -* \return kvi_u16_t -*/ -inline kvi_u16_t kvi_swap16(kvi_u16_t i) -{ - // ab to ba - return ((i << 8) | (i >> 8)); -} - -#endif // !_KVI_BSWAP_H_ diff --git a/src/kvilib/core/kvi_error.cpp b/src/kvilib/core/kvi_error.cpp deleted file mode 100644 index 83e84f4f7..000000000 --- a/src/kvilib/core/kvi_error.cpp +++ /dev/null @@ -1,234 +0,0 @@ -//============================================================================= -// -// File : kvi_error.cpp -// Creation date : Sun Jul 02 2000 18:37:02 by Szymon Stefanek -// -// This file is part of the KVirc irc client distribution -// Copyright (C) 2000-2010 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -//============================================================================= - - -#define _KVI_ERROR_CPP_ - -#include "KviLocale.h" -#include "kvi_error.h" -#include "kvi_settings.h" - - -#if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) - #include // for the WSAE* error codes -#endif - -#include - -#ifdef HAVE_STRERROR - #include // for strerror() -#endif - -// FIXME: This stuff should basically die and be eventually replaced with some -// helper functions for handling ONLY system errors. -// -// WARNING: getDescription() is not even thread safe... it will die in the near future - -const char * g_errorTable[KVI_NUM_ERRORS]= -{ - __tr_no_lookup("Success"), // 000: success - __tr_no_lookup("Unknown error"), // 001: unkonwnError - __tr_no_lookup("Internal error"), // 002: internalError - __tr_no_lookup("Unknown command"), // 003: unknownCommand - __tr_no_lookup("Missing closing brace"), // 004: missingClosingBrace - __tr_no_lookup("Unexpected end of command in string"), // 005: unexpectedEndInString - __tr_no_lookup("Unexpected end of command in dictionary key"), // 006: unexpectedEndInDictionaryKey - __tr_no_lookup("Switch dash without switch letter"), // 007: switchDashWithoutSwitchLetter - __tr_no_lookup("Unknown function"), // 008: unknownFunction - __tr_no_lookup("Unexpected end of command in parenthesis"), // 009: unexpectedEndInParenthesis - __tr_no_lookup("Unexpected end of command in function parameters"), // 010: unexpectedEndInFunctionParams - __tr_no_lookup("Missing variable name"), // 011: missingVariableName - __tr_no_lookup("Variable or identifier expected"), // 012: variableOrIdentifierExpected - __tr_no_lookup("Left operand is not a number"), // 013: leftOperandIsNotANumber - __tr_no_lookup("Multiple operations not supported for numeric operators"), // 014: multipleOpsNotSupportedForOperator - __tr_no_lookup("Division by zero"), // 015: divisionByZero - __tr_no_lookup("Modulo by zero"), // 016: moduloByZero - __tr_no_lookup("Right operand is not a number"), // 017: rightOperandIsNotANumber - __tr_no_lookup("Unterminated expression (missing ')' ?)"), // 018: unterminatedExpression - __tr_no_lookup("Unterminated subexpression (Parenthesis mismatch)"), // 019: unterminatedSubexpression - __tr_no_lookup("Unexpected character"), // 020: unexpectedCharacter - __tr_no_lookup("Unknown operator"), // 021: unknownOperator - __tr_no_lookup("No host to resolve"), // 022 - __tr_no_lookup("(DNS Internal) Unsupported address family"), // 023 - __tr_no_lookup("Valid name but the host has no IP address"), // 024 - __tr_no_lookup("Unrecoverable nameserver error (crashed ?)"), // 025 - __tr_no_lookup("Dns temporaneous fault (try again)"), // 026 - __tr_no_lookup("(DNS Internal) Bad flags"), // 027 - __tr_no_lookup("(DNS Internal) Out of memory"), // 028 - __tr_no_lookup("(DNS Internal) Service not supported"), // 029 - __tr_no_lookup("Unknown node (host not found)"), // 030 - __tr_no_lookup("(DNS Internal) Unsupported socket type"), // 031 - __tr_no_lookup("Dns query failed"), // 032 - __tr_no_lookup("This KVIrc executable has no IPV6 support"), // 033 - __tr_no_lookup("Host not found"), // 034 - __tr_no_lookup("(DNS Internal) IPC failure (slave data corrupted)"), // 035 - __tr_no_lookup("Another connection in progress"), // 036 - __tr_no_lookup("Invalid IP address"), // 037 - __tr_no_lookup("Socket creation failed"), // 038 - __tr_no_lookup("Failed to put the socket in non blocking mode"), // 039 - __tr_no_lookup("Bad file descriptor"), // 040 - __tr_no_lookup("Out of address space"), // 041 - __tr_no_lookup("Connection refused"), // 042 - __tr_no_lookup("Kernel networking panic"), // 043 - __tr_no_lookup("Connection timed out"), // 044 - __tr_no_lookup("Network is unreachable"), // 045 - __tr_no_lookup("Broken pipe"), // 046 - __tr_no_lookup("Invalid proxy address"), // 047 - __tr_no_lookup("Remote end has closed the connection"), // 048 - __tr_no_lookup("Invalid irc context id"), // 049 - __tr_no_lookup("Error in loading module"), // 050 - __tr_no_lookup("No such module command"), // 051 - __tr_no_lookup("No such module function"), // 052 - __tr_no_lookup("Left operand is not a dictionary reference"), // 053 - __tr_no_lookup("Right operand is not a dictionary reference"), // 054 - __tr_no_lookup("Missing object class name"), // 055 - __tr_no_lookup("No such object class"), // 056 - __tr_no_lookup("No such object"), // 057 - __tr_no_lookup("No such object function"), // 058 - __tr_no_lookup("Invalid left operand"), // 059 - __tr_no_lookup("Not enough parameters"), // 060 - __tr_no_lookup("Integer parameter expected"), // 061 - __tr_no_lookup("Invalid parameter"), // 062 - __tr_no_lookup("No such file"), // 063 - __tr_no_lookup("Open parenthesis expected"), // 064 - __tr_no_lookup("Open brace expected"), // 065 - __tr_no_lookup("Can't kill a builtin class"), // 066 - __tr_no_lookup("The SOCKSv4 protocol lacks IPv6 support"), // 067 - __tr_no_lookup("Unrecognized proxy reply"), // 068 - __tr_no_lookup("Proxy response: auth failed: access denied"), - __tr_no_lookup("Proxy response: No acceptable auth method: request rejected"), - __tr_no_lookup("Proxy response: request failed"), - __tr_no_lookup("Proxy response: ident failed"), - __tr_no_lookup("Proxy response: ident not matching"), - __tr_no_lookup("Proxy response: general SOCKS failure"), - __tr_no_lookup("Proxy response: connection not allowed"), - __tr_no_lookup("Proxy response: network unreachable"), - __tr_no_lookup("Proxy response: host unreachable"), - __tr_no_lookup("Proxy response: connection refused"), - __tr_no_lookup("Proxy response: TTL expired"), - __tr_no_lookup("Proxy response: command not supported"), - __tr_no_lookup("Proxy response: address type not supported"), - __tr_no_lookup("Proxy response: invalid address"), - __tr_no_lookup("Invalid port number"), - __tr_no_lookup("Socket not connected"), - __tr_no_lookup("Insufficient resources to complete the operation"), - __tr_no_lookup("Can't setup a listening socket : bind failed"), - __tr_no_lookup("Can't resolve the localhost name"), - __tr_no_lookup("Unsupported image format"), - __tr_no_lookup("Can't open file for appending"), - __tr_no_lookup("Can't open file for writing"), - __tr_no_lookup("File I/O error"), - __tr_no_lookup("Acknowledge error"), - __tr_no_lookup("Can't open file for reading"), - __tr_no_lookup("Can't send a zero-size file"), - __tr_no_lookup("Missing popup name"), - __tr_no_lookup("'item', 'popup', 'label' or 'separator' keyword expected"), - __tr_no_lookup("Self modification not allowed"), - __tr_no_lookup("UNUSED"), - __tr_no_lookup("Feature not available"), - __tr_no_lookup("Unexpected characters in array index"), - __tr_no_lookup("Unexpected end in expression"), - __tr_no_lookup("Unexpected end in array index"), - __tr_no_lookup("Connection thru HTTP proxy failed"), - __tr_no_lookup("Case, match, regexp, default or break keyword expected"), - __tr_no_lookup("Access denied"), - __tr_no_lookup("Address already in use"), - __tr_no_lookup("Can't assign the requested address"), - __tr_no_lookup("Connection reset by peer"), - __tr_no_lookup("Host unreachable (no route to host)"), - __tr_no_lookup("Variable expected"), - __tr_no_lookup("Invalid array index: positive integer expected"), - __tr_no_lookup("listen() call failed"), - __tr_no_lookup("This executable has been compiled without SSL support"), - __tr_no_lookup("Secure Socket Layer error"), - __tr_no_lookup("Slash (/) character expected"), - __tr_no_lookup("Unknown string manipulation operation"), - __tr_no_lookup("Operation aborted"), - __tr_no_lookup("Unexpected token"), - __tr_no_lookup("Scope object already defined (unexpected @)"), - __tr_no_lookup("There is no $this pointer in this scope (unexpected @)") -}; - -namespace KviError -{ - const char * getUntranslatedDescription(int iErrorCode) - { - if((iErrorCode < KVI_NUM_ERRORS) && (iErrorCode >= 0)) - return g_errorTable[iErrorCode]; -#ifdef HAVE_STRERROR - if(iErrorCode < 0)return strerror(-iErrorCode); -#endif - return g_errorTable[KviError_unknownError]; - } - - QString getDescription(int iErrorCode) - { - return __tr2qs_no_xgettext(getUntranslatedDescription(iErrorCode)); - } - - int translateSystemError(int iErrNo) - { -#if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) - switch(iErrNo) - { - case EBADF: return KviError_badFileDescriptor; break; - case WSAEINVAL: - case WSAEFAULT: - case EFAULT: return KviError_outOfAddressSpace; break; - case WSAECONNREFUSED: return KviError_connectionRefused; break; - case WSAENOTSOCK: return KviError_kernelNetworkingPanic; break; - case WSAETIMEDOUT: return KviError_connectionTimedOut; break; - case WSAENETUNREACH: return KviError_networkUnreachable; break; - case EPIPE: return KviError_brokenPipe; break; - case WSAENOTCONN: return KviError_socketNotConnected; break; - case WSAEACCES: return KviError_accessDenied; break; - case WSAEADDRINUSE: return KviError_addressAlreadyInUse; break; - case WSAEADDRNOTAVAIL: return KviError_cantAssignRequestedAddress; break; - case WSAEAFNOSUPPORT: return KviError_unsupportedAddressFamily; break; - case WSAECONNRESET: return KviError_connectionResetByPeer; break; - case WSAEHOSTUNREACH: return KviError_hostUnreachable; break; - - //case ENOBUFS: return KviError_insufficientResources; break; - // Unhandled error...pass errno to the strerror function - default: return -iErrNo; break; - } -#else - switch(iErrNo) - { - case EBADF: return KviError_badFileDescriptor; break; - case EFAULT: return KviError_outOfAddressSpace; break; - case ECONNREFUSED: return KviError_connectionRefused; break; - case ENOTSOCK: return KviError_kernelNetworkingPanic; break; - case ETIMEDOUT: return KviError_connectionTimedOut; break; - case ENETUNREACH: return KviError_networkUnreachable; break; - case EPIPE: return KviError_brokenPipe; break; - case ENOTCONN: return KviError_socketNotConnected; break; - case ENOBUFS: return KviError_insufficientResources; break; - case EHOSTUNREACH: return KviError_hostUnreachable; break; - // Unhandled error...pass errno to the strerror function - default: return -iErrNo; break; - } -#endif - } -} diff --git a/src/kvilib/core/kvi_error.h b/src/kvilib/core/kvi_error.h deleted file mode 100644 index a103f34fe..000000000 --- a/src/kvilib/core/kvi_error.h +++ /dev/null @@ -1,215 +0,0 @@ -#ifndef _KVI_ERROR_H_ -#define _KVI_ERROR_H_ -//============================================================================= -// -// File : kvi_error.h -// Creation date : Sun Jul 02 2000 18:35:56 by Szymon Stefanek -// -// This file is part of the KVirc irc client distribution -// Copyright (C) 2000-2010 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -//============================================================================= - -/** -* \file kvi_error.h -* \author Szymon Stefanek -* \brief Error List -*/ - -#include "kvi_settings.h" -#include "KviQString.h" - -#define KviError_success 0 -#define KviError_unknownError 1 -#define KviError_internalError 2 -#define KviError_unknownCommand 3 -#define KviError_missingClosingBrace 4 -#define KviError_unexpectedEndInString 5 -#define KviError_unexpectedEndInDictionaryKey 6 -#define KviError_switchDashWithoutSwitchLetter 7 -#define KviError_unknownFunction 8 -#define KviError_unexpectedEndInParenthesis 9 -#define KviError_unexpectedEndInFunctionParams 10 -#define KviError_missingVariableName 11 -#define KviError_variableOrIdentifierExpected 12 -#define KviError_leftOperandIsNotANumber 13 -#define KviError_multipleOpsNotSupportedForOperator 14 -#define KviError_divisionByZero 15 -#define KviError_moduloByZero 16 -#define KviError_rightOperandIsNotANumber 17 -#define KviError_unterminatedExpression 18 -#define KviError_unterminatedSubexpression 19 -#define KviError_unexpectedCharacter 20 -#define KviError_unknownOperator 21 - -#define KviError_noHostToResolve 22 -#define KviError_unsupportedAddressFamily 23 -#define KviError_validNameButNoIpAddress 24 -#define KviError_unrecoverableNameserverError 25 -#define KviError_dnsTemporaneousFault 26 -#define KviError_dnsInternalErrorBadFlags 27 -#define KviError_dnsInternalErrorOutOfMemory 28 -#define KviError_dnsInternalErrorServiceNotSupported 29 -#define KviError_dnsNoName 30 -#define KviError_dnsInternalErrorUnsupportedSocketType 31 -#define KviError_dnsQueryFailed 32 -#define KviError_noIPv6Support 33 -#define KviError_hostNotFound 34 -#define KviError_dnsInternalIPCFailure 35 - -#define KviError_anotherConnectionInProgress 36 -#define KviError_invalidIpAddress 37 -#define KviError_socketCreationFailed 38 -#define KviError_asyncSocketFailed 39 -#define KviError_badFileDescriptor 40 -#define KviError_outOfAddressSpace 41 -#define KviError_connectionRefused 42 -#define KviError_kernelNetworkingPanic 43 -#define KviError_connectionTimedOut 44 -#define KviError_networkUnreachable 45 -#define KviError_brokenPipe 46 -#define KviError_invalidProxyAddress 47 -#define KviError_remoteEndClosedConnection 48 - -#define KviError_invalidIrcContextId 49 -#define KviError_errorInLoadingModule 50 -#define KviError_noSuchModuleCommand 51 -#define KviError_noSuchModuleFunction 52 - -#define KviError_leftOperandIsNotADictionaryReference 53 -#define KviError_rightOperandIsNotADictionaryReference 54 - -#define KviError_missingObjectClassName 55 -#define KviError_noSuchObjectClass 56 -#define KviError_noSuchObject 57 -#define KviError_noSuchObjectFunction 58 - -#define KviError_invalidLeftOperand 59 - -#define KviError_notEnoughParameters 60 -#define KviError_integerParameterExpected 61 -#define KviError_invalidParameter 62 - -#define KviError_noSuchFile 63 - -#define KviError_openParenthesisExpected 64 -#define KviError_openBraceExpected 65 - -#define KviError_cantKillABuiltinClass 66 -#define KviError_socksV4LacksIPv6Support 67 -#define KviError_unrecognizedProxyReply 68 -#define KviError_proxyAuthFailed 69 -#define KviError_proxyNoAcceptableAuthMethod 70 - -#define KviError_proxyReply91RequestFailed 71 -#define KviError_proxyReply92IdentFailed 72 -#define KviError_proxyReply93IdentNotMatching 73 -#define KviError_proxyReply01GeneralSOCKSFailure 74 -#define KviError_proxyReply02ConnectionNotAllowed 75 -#define KviError_proxyReply03NetworkUnreachable 76 -#define KviError_proxyReply04HostUnreachable 77 -#define KviError_proxyReply05ConnectionRefused 78 -#define KviError_proxyReply06TTLExpired 79 -#define KviError_proxyReply07CommandNotSupported 80 -#define KviError_proxyReply08AddressTypeNotSupported 81 -#define KviError_proxyReply09InvalidAddress 82 - -#define KviError_invalidPortNumber 83 -#define KviError_socketNotConnected 84 -#define KviError_insufficientResources 85 -#define KviError_bindFailed 86 -#define KviError_cantResolveLocalhost 87 - -#define KviError_unsupportedImageFormat 88 - -#define KviError_cantOpenFileForAppending 89 -#define KviError_cantOpenFileForWriting 90 -#define KviError_fileIOError 91 -#define KviError_acknowledgeError 92 -#define KviError_cantOpenFileForReading 93 -#define KviError_cantSendAZeroSizeFile 94 - -#define KviError_missingPopupName 95 -#define KviError_itemPopupOrSeparatorExpected 96 -#define KviError_selfModificationNotAllowed 97 - -//#define KviError_recursionTooDeep 98 -#define KviError_featureNotAvailable 99 - -#define KviError_unexpectedCharactersInArrayIndex 100 -#define KviError_unexpectedEndInExpression 101 -#define KviError_unexpectedEndInArrayIndex 102 - -#define KviError_proxyHttpFailure 103 -#define KviError_caseMatchRegexpDefaultOrBreakExpected 104 - - -#define KviError_accessDenied 105 -#define KviError_addressAlreadyInUse 106 -#define KviError_cantAssignRequestedAddress 107 -#define KviError_connectionResetByPeer 108 -#define KviError_hostUnreachable 109 - -#define KviError_variableExpected 110 -#define KviError_invalidArrayIndex 111 - -#define KviError_listenFailed 112 - -#define KviError_noSSLSupport 113 -#define KviError_SSLError 114 - -#define KviError_slashCharacterExpected 115 -#define KviError_unknownStringManipulationOperator 116 - -#define KviError_operationAborted 117 - -#define KviError_unexpectedToken 118 - -#define KviError_scopeObjectAlreadyDefined 119 -#define KviError_noThisObject 120 - -#define KVI_NUM_ERRORS 121 - -/** -* \namespace KviError -* \brief This namespace handle the error codes -*/ -namespace KviError -{ - /** - * \brief Returns the description of the error - * \param iErrorCode The code number of the error - * \return QString - */ - KVILIB_API QString getDescription(int iErrorCode); - - /** - * \brief Returns an untranslated description of the error - * \param iErrorCode The code number of the error - * \return const char * - */ - KVILIB_API const char * getUntranslatedDescription(int iErrorCode); - - /** - * \brief Gets system errors and returns their code number - * \param iErrNo The code number of the system error - * \return int - */ - KVILIB_API int translateSystemError(int iErrNo); -} - -#endif //_KVI_ERROR_H_ diff --git a/src/kvilib/core/kvi_strasm.h b/src/kvilib/core/kvi_strasm.h deleted file mode 100644 index a248deca1..000000000 --- a/src/kvilib/core/kvi_strasm.h +++ /dev/null @@ -1,194 +0,0 @@ -#ifndef _KVI_STRASM_H_ -#define _KVI_STRASM_H_ - -//============================================================================= -// -// File : kvi_strasm.h -// Creation date : Sun Jun 18 2000 18:38:26 by Szymon Stefanek -// -// This file is part of the KVirc irc client distribution -// Copyright (C) 2000-2010 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -//============================================================================= - -//============================================================================= -// -// Inline assembly implementations of the commonly used string functions -// These will work only on i386 based machines and can be compiled -// only by gcc -// -//============================================================================= - -extern inline bool kvi_strEqualCS(const char * pcStr1, const char * pcStr2) -{ - // An instruction pattern is really useful in this case. - // When inlining, GCC can optimize to load esi and edi - // directly with the strings, without pushing and getting it - // from the stack... - register bool bEax; - __asm__ __volatile__ ( - " cld\n" - "1:\n" - " lodsb %%ds:(%%esi),%%al\n" - " scasb %%es:(%%edi),%%al\n" - " jne 2f\n" - " testb %%al,%%al\n" - " jne 1b\n" - " movl $0x1,%%eax\n" - " jmp 3f\n" - "2:\n" - " xorl %%eax,%%eax\n" - "3:" - : "=a" (bEax), "=&S" (pcStr1), "=&D" (pcStr2) - : "1" (pcStr1), "2" (pcStr2) - ); - return bEax; -} - -extern inline bool kvi_strEqualCSN(const char * pcStr1, const char * pcStr2, int iLen) -{ - register bool bEax; - __asm__ __volatile__ ( - "1:\n" - " decl %3\n" - " js 2f\n" - " movb (%1),%%al\n" - " incl %1\n" - " cmpb %%al,(%2)\n" - " jne 3f\n" - " incl %2\n" - " testb %%al,%%al\n" - " jne 1b\n" - "2:\n" - " movl $0x1,%%eax\n" - " jmp 4f\n" - "3:\n" - " xorl %%eax,%%eax\n" - "4:\n" - : "=a" (bEax), "=r" (pcStr1), "=r" (pcStr2), "=r" (iLen) - : "1" (pcStr1), "2" (pcStr2), "3" (iLen) - ); - return bEax; -} - -// OPTIMIZATION -// The following two functions are used to compare a variable string with one in that -// only A-Z<->a-z case insensivity is significant. -// For example -// kvi_strEqualNoLocalCI("a string that does not contain any strange char",str2) -// will always give the correct result -// These will NOT work with localizable characters: -// 'a' with umlaut will be not equal to 'A' with umlaut - -extern inline bool kvi_strEqualNoLocaleCI(const char * pcStr1, const char * pcStr2) -{ - // Trivial implementation - // Ignores completely locales....only A-Z chars are transformed to a-z - // Anyway...it will work for IRC :) - register int iReg; - register bool bEax; - __asm__ __volatile__ ( - "1:\n" - " movb (%2),%%al\n" - " cmpb $65,%%al\n" - " jb 2f\n" - " cmpb $90,%%al\n" - " ja 2f\n" - " addb $32,%%al\n" - "2:\n" - " movb (%3),%b1\n" - " cmpb $65,%b1\n" - " jb 3f\n" - " cmpb $90,%b1\n" - " ja 3f\n" - " addb $32,%b1\n" - "3:\n" - " cmpb %%al,%b1\n" - " jne 4f\n" - " incl %2\n" - " incl %3\n" - " testb %%al,%%al\n" - " jne 1b\n" - " movl $1,%%eax\n" - " jmp 5f\n" - "4:\n" - " xorl %%eax,%%eax\n" - "5:\n" - : "=a" (bEax), "=q" (iReg), "=r" (pcStr1), "=r" (pcStr2) - : "2" (pcStr1), "3" (pcStr2) - ); - return bEax; -} - -extern inline bool kvi_strEqualNoLocaleCIN(const char * pcStr1, const char * pcStr2, int iLen) -{ - - register int iReg; - register bool bEax; - __asm__ __volatile__ ( - "1:\n" - " decl %4\n" - " js 4f\n" - " movb (%2),%%al\n" - " cmpb $65,%%al\n" - " jb 2f\n" - " cmpb $90,%%al\n" - " ja 2f\n" - " addb $32,%%al\n" - "2:\n" - " movb (%3),%b1\n" - " cmpb $65,%b1\n" - " jb 3f\n" - " cmpb $90,%b1\n" - " ja 3f\n" - " addb $32,%b1\n" - "3:\n" - " cmpb %%al,%b1\n" - " jne 5f\n" - " incl %2\n" - " incl %3\n" - " testb %%al,%%al\n" - " jne 1b\n" - "4:\n" - " movl $1,%%eax\n" - " jmp 6f\n" - "5:\n" - " xorl %%eax,%%eax\n" - "6:\n" - : "=a" (bEax), "=q" (iReg), "=r" (pcStr1), "=r" (pcStr2), "=r" (iLen) - : "2" (pcStr1), "3" (pcStr2), "4" (iLen) - ); - return bEax; -} - - -extern inline int kvi_strLen(const char * pcStr) -{ - register int iEcx; - __asm__ __volatile__( - " cld\n" - " repne\n" - " scasb\n" - " notl %0\n" - " decl %0" - : "=c" (iEcx), "=&D" (pcStr) - : "0" (0xffffffff), "1" (pcStr), "a" (0) - ); - return iEcx; -} - -#endif //_KVI_STRASM_H_ diff --git a/src/kvilib/irc/KviIrcNetwork.cpp b/src/kvilib/irc/KviIrcNetwork.cpp new file mode 100644 index 000000000..498a90746 --- /dev/null +++ b/src/kvilib/irc/KviIrcNetwork.cpp @@ -0,0 +1,157 @@ +//============================================================================= +// +// File : KviIrcNetwork.cpp +// Creation date : Wed Aug 27 2008 17:44:56 by Alexey Uzhva +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2008 Alexey Uzhva (wizard at opendoor dot ru) +// +// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//============================================================================= + +#include "KviIrcNetwork.h" +#include "KviIrcServer.h" +#include "KviNickServRuleSet.h" + +KviIrcNetwork::KviIrcNetwork(const KviIrcNetwork &src) +{ + m_pChannelList = 0; + m_pNickServRuleSet = 0; + m_pServerList = new KviPointerList; + m_pServerList->setAutoDelete(true); + copyFrom(src); +} + +KviIrcNetwork::KviIrcNetwork(const QString &name) +{ + m_szName = name; + m_pChannelList = 0; + m_pNickServRuleSet = 0; + m_bAutoConnect = false; + m_pServerList = new KviPointerList; + m_pServerList->setAutoDelete(true); + m_pCurrentServer = 0; +} + +KviIrcNetwork::~KviIrcNetwork() +{ + if(m_pChannelList)delete m_pChannelList; + if(m_pNickServRuleSet)delete m_pNickServRuleSet; + delete m_pServerList; +} + +void KviIrcNetwork::setAutoJoinChannelList(QStringList * pNewChannelList) +{ + if(m_pChannelList)delete m_pChannelList; + m_pChannelList = pNewChannelList; +} + +void KviIrcNetwork::setAutoJoinChannelList(const QString & szNewChannelList) +{ + if(m_pChannelList) + delete m_pChannelList; + QStringList lChans = szNewChannelList.split(","); + if(lChans.isEmpty()) + m_pChannelList = NULL; + else + m_pChannelList = new QStringList(lChans); +} + +void KviIrcNetwork::setNickServRuleSet(KviNickServRuleSet * s) +{ + if(m_pNickServRuleSet)delete m_pNickServRuleSet; + m_pNickServRuleSet = s; +} + +void KviIrcNetwork::copyFrom(const KviIrcNetwork &src) +{ + m_szName = src.m_szName; + m_szEncoding = src.m_szEncoding; + m_szTextEncoding = src.m_szTextEncoding; + m_szDescription = src.m_szDescription; + m_szNickName = src.m_szNickName; + m_szRealName = src.m_szRealName; + m_szUserName = src.m_szUserName; + m_szPass = src.m_szPass; + m_bAutoConnect = src.m_bAutoConnect; + m_szUserIdentityId = src.m_szUserIdentityId; + m_szOnConnectCommand = src.m_szOnConnectCommand; + m_szOnLoginCommand = src.m_szOnLoginCommand; + if(m_pChannelList)delete m_pChannelList; + if(src.m_pChannelList)m_pChannelList = new QStringList(*(src.m_pChannelList)); + else m_pChannelList = 0; + if(m_pNickServRuleSet)delete m_pNickServRuleSet; + if(src.m_pNickServRuleSet)m_pNickServRuleSet = new KviNickServRuleSet(*(src.m_pNickServRuleSet)); + else m_pNickServRuleSet = 0; +/* + // We don't copy the server list, since this function is called in KviIrcServerOptionsWidget::commit() + // to recreate the server list from scratch; copying the original servers will mean duplicate servers + // (see bug ticket #300) + for (KviIrcServer *s = src.m_pServerList->first(); s; s = src.m_pServerList->next()) + { + m_pServerList->append(new KviIrcServer(*s)); + } +*/ +} + +void KviIrcNetwork::insertServer(KviIrcServer *srv) +{ + m_pServerList->append(srv); +} + +KviIrcServer * KviIrcNetwork::findServer(const QString & szHostname) +{ + for (KviIrcServer *s = m_pServerList->first(); s; s = m_pServerList->next()) + { + if (KviQString::equalCI(s->m_szHostname, szHostname)) + return s; + } + return 0; +} + +KviIrcServer * KviIrcNetwork::findServer(const KviIrcServer * pServer) +{ + for (KviIrcServer *s = m_pServerList->first(); s; s = m_pServerList->next()) + { + // we better go with the unique id first + if(!s->m_szId.isEmpty()) + { + // at least one of the 2 id is not empty, so if they match we're done + if(KviQString::equalCI(s->m_szId, pServer->m_szId)) + return s; + } else { + // failback on the "check everything" method + + if (KviQString::equalCI(s->m_szHostname, pServer->m_szHostname) + && (s->m_uPort == pServer->m_uPort) && (s->useSSL() + == pServer->useSSL()) && (s->isIPv6() == pServer->isIPv6())) + return s; + } + } + return 0; +} + +void KviIrcNetwork::setCurrentServer(KviIrcServer *srv) +{ + if(m_pServerList->findRef(srv) != -1)m_pCurrentServer = srv; +} + +KviIrcServer * KviIrcNetwork::currentServer() +{ + if(m_pCurrentServer)return m_pCurrentServer; + m_pCurrentServer = m_pServerList->first(); + return m_pCurrentServer; +} diff --git a/src/kvilib/irc/KviIrcNetwork.h b/src/kvilib/irc/KviIrcNetwork.h new file mode 100644 index 000000000..06fd1fdce --- /dev/null +++ b/src/kvilib/irc/KviIrcNetwork.h @@ -0,0 +1,342 @@ +#ifndef KVI_NETWORK_H_ +#define KVI_NETWORK_H_ +//============================================================================= +// +// File : KviIrcNetwork.cpp +// Creation date : Wed Aug 27 2008 17:44:56 by Alexey Uzhva +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2008 Alexey Uzhva (wizard at opendoor dot ru) +// +// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +// +//============================================================================= + +/** +* \file KviIrcNetwork.cpp +* \author Alexey Uzhva +* \brief Network handling +*/ + +#include "kvi_settings.h" +#include "KviHeapObject.h" +#include "KviPointerList.h" + +#include +#include + +class KviNickServRuleSet; +class KviIrcServer; +class QStringList; + +/** +* \class KviIrcNetwork +* \brief Network handling class +*/ +class KVILIB_API KviIrcNetwork : public KviHeapObject +{ + friend class KviIrcServerDataBase; +public: + /** + * \brief Construct the network object + * \param name The name of the network + * \return KviIrcNetwork + */ + KviIrcNetwork(const QString & name); + + /** + * \brief Carbon copy + * \param src The source network + * \return KviIrcNetwork + */ + KviIrcNetwork(const KviIrcNetwork & src); + + /** + * \brief Destroys the network object + */ + ~KviIrcNetwork(); +protected: + QString m_szName; + QString m_szDescription; + QString m_szEncoding; // if empty, use system default + QString m_szTextEncoding; // if empty, use system default + QString m_szNickName; // preferred nick name + QString m_szUserName; // preferred user name + QString m_szRealName; // preferred real name + QString m_szPass; // special password + QString m_szOnConnectCommand; // the command to run on connect + QString m_szOnLoginCommand; // the command to run after login + QStringList * m_pChannelList; // Channels to auto join + KviNickServRuleSet * m_pNickServRuleSet; // set of nick serv rules + bool m_bAutoConnect; // autoconnect + QString m_szUserIdentityId; // The user identity to use for this server: if empty + // Then use the global primary identity + //moved from KviIrcServerDataBaseRecord + KviPointerList * m_pServerList; + KviIrcServer * m_pCurrentServer; +public: + /** + * \brief Returns the name of the network + * \return const QString & + */ + inline const QString & name() const { return m_szName; }; + + /** + * \brief Returns the encoding of the network + * + * Some information as nickname and channel names are encoded when + * communicating with the server + * \return const QString & + */ + inline const QString & encoding() const { return m_szEncoding; }; + + /** + * \brief Returns the text encoding of the network + * + * This is the default encoding when talking on channels or queries + * \return const QString & + */ + inline const QString & textEncoding() const { return m_szTextEncoding; }; + + /** + * \brief Returns the description of the network + * \return const QString & + */ + inline const QString & description() const { return m_szDescription; }; + + /** + * \brief Returns the nickname of the user associated to the network + * \return const QString & + */ + inline const QString & nickName() const { return m_szNickName; }; + + /** + * \brief Returns the realname of the user associated to the network + * \return const QString & + */ + inline const QString & realName() const { return m_szRealName; }; + + /** + * \brief Returns the username of the user associated to the network + * \return const QString & + */ + inline const QString & userName() const { return m_szUserName; }; + + /** + * \brief Returns the password of the user associated to the network + * \return const QString & + */ + inline const QString & password() const { return m_szPass; }; + + /** + * \brief Returns the commands to run on network login + * \return const QString & + */ + inline const QString & onLoginCommand() const { return m_szOnLoginCommand; }; + + /** + * \brief Returns the commands to run on network connect + * \return const QString & + */ + inline const QString & onConnectCommand() const { return m_szOnConnectCommand; }; + + /** + * \brief Returns the user identity of the user associated to the network + * \return const QString & + */ + inline const QString & userIdentityId() const { return m_szUserIdentityId; }; + + /** + * \brief Returns true if the network has the autoconnect state on + * \return bool + */ + inline bool autoConnect() const { return m_bAutoConnect; }; + + /** + * \brief Returns the list of channels with autojoin flag + * \return QStringList * + */ + inline QStringList * autoJoinChannelList(){ return m_pChannelList; }; + + /** + * \brief Returns the list of channels with autojoin flag as a string + * \return const QString & + */ + inline const QString autoJoinChannelListAsString(){ return m_pChannelList ? m_pChannelList->join(",") : ""; }; + + /** + * \brief Returns a set of rules for the NickServ + * \return KviNickServRuleSet * + */ + inline KviNickServRuleSet * nickServRuleSet(){ return m_pNickServRuleSet; }; + + /** + * \brief Sets the rules for NickServ + * \param s The rule set where to add rules + * \return void + */ + void setNickServRuleSet(KviNickServRuleSet * s); + + /** + * \brief Carbon copy + * \param d The source network to copy from + * \return void + */ + void copyFrom(const KviIrcNetwork & d); + + /** + * \brief Sets the name of the network + * \param szName The name of the network + * \return void + */ + inline void setName(const QString & szName){ m_szName = szName; }; + + /** + * \brief Sets the encondig of the network + * + * Some information as nickname and channel names are encoded when + * communicating with the server + * \param szEncoding The encoding of the network + * \return void + */ + inline void setEncoding(const QString & szEncoding){ m_szEncoding = szEncoding; }; + + /** + * \brief Sets the text encondig of the network + * + * This is the default encoding when talking on channels or queries + * \param szEncoding The text encoding of the network + * \return void + */ + inline void setTextEncoding(const QString & szEncoding){ m_szTextEncoding = szEncoding; }; + + /** + * \brief Sets the description of the network + * \param szDescription The description of the network + * \return void + */ + inline void setDescription(const QString & szDescription){ m_szDescription = szDescription; }; + + /** + * \brief Sets the list of commands to run on network connection + * \param cmd The commands list to run + * \return void + */ + inline void setOnConnectCommand(const QString & cmd){ m_szOnConnectCommand = cmd; }; + + /** + * \brief Sets the list of commands to run on network login + * \param cmd The commands list to run + * \return void + */ + inline void setOnLoginCommand(const QString & cmd){ m_szOnLoginCommand = cmd; }; + + /** + * \brief Sets the nickname of the user associated to the network + * \param n The nickname + * \return void + */ + inline void setNickName(const QString & n){ m_szNickName = n; }; + + /** + * \brief Sets the realname of the user associated to the network + * \param r The realname + * \return void + */ + inline void setRealName(const QString & r){ m_szRealName = r; }; + + /** + * \brief Sets the username of the user associated to the network + * \param u The username + * \return void + */ + inline void setUserName(const QString & u){ m_szUserName = u; }; + + /** + * \brief Sets the password of the user associated to the network + * \return void + */ + inline void setPassword(const QString & p){ m_szPass = p; }; + + /** + * \brief Sets the list of channels to mark for autojoin + * \param pNewChannelList The channel list + * \return void + */ + void setAutoJoinChannelList(QStringList * pNewChannelList); + + /** + * \brief Sets the list of channels to mark for autojoin + * \param szNewChannelList A comma separated list of channels + * \return void + */ + void setAutoJoinChannelList(const QString & szNewChannelList); + + /** + * \brief Sets the autoconnect flag + * \param bAutoConnect The state of the autoconnect flag + * \return void + */ + inline void setAutoConnect(bool bAutoConnect){ m_bAutoConnect = bAutoConnect; }; + + /** + * \brief Sets the user identity id of the user associated to the network + * \param szUserIdentityId The user identity + * \return void + */ + inline void setUserIdentityId(const QString & szUserIdentityId){ m_szUserIdentityId = szUserIdentityId; }; + + /** + * \brief Returns a list of servers associated to the network + * \return KviPointerList * + */ + inline KviPointerList * serverList(){ return m_pServerList; }; + + /** + * \brief Returns the current server + * \return KviIrcServer + */ + KviIrcServer * currentServer(); + + /** + * \brief Adds a new server to the network + * \param srv The source server to add + * \return void + */ + void insertServer(KviIrcServer * srv); + + /** + * \brief Searches for a server in the network + * \param szHostname The hostname of the server to find + * \return KviIrcServer + */ + KviIrcServer * findServer(const QString & szHostname); + + /** + * \brief Searches for a server in the network + * \param pServer The server to find + * \return KviIrcServer + */ + KviIrcServer * findServer(const KviIrcServer * pServer); + + /** + * \brief Sets the current server + * \param srv The source server + * \return void + */ + void setCurrentServer(KviIrcServer * srv); +}; + +#endif // KVI_NETWORK_H_ diff --git a/src/kvilib/irc/KviIrcServer.cpp b/src/kvilib/irc/KviIrcServer.cpp index 0456a67e7..c036cedb0 100644 --- a/src/kvilib/irc/KviIrcServer.cpp +++ b/src/kvilib/irc/KviIrcServer.cpp @@ -43,7 +43,7 @@ //extern KVIRC_API KviProxyDataBase * g_pProxyDataBase; -KviServer::KviServer() +KviIrcServer::KviIrcServer() { m_pReconnectInfo = 0; m_uFlags = 0; @@ -53,7 +53,7 @@ KviServer::KviServer() m_iProxy = -1; } -KviProxy * KviServer::proxyServer(KviProxyDataBase * pDb) +KviProxy * KviIrcServer::proxyServer(KviProxyDataBase * pDb) { int i = 0; if(proxy() < 0) return 0; @@ -66,7 +66,7 @@ KviProxy * KviServer::proxyServer(KviProxyDataBase * pDb) return 0; } -KviServer::KviServer(const KviServer & serv) +KviIrcServer::KviIrcServer(const KviIrcServer & serv) { m_szHostname = serv.m_szHostname; m_szIp = serv.m_szIp; @@ -95,11 +95,11 @@ KviServer::KviServer(const KviServer & serv) else m_pAutoJoinChannelList = 0; if(serv.m_pReconnectInfo) - m_pReconnectInfo = new KviServerReconnectInfo(*(serv.m_pReconnectInfo)); + m_pReconnectInfo = new KviIrcServerReconnectInfo(*(serv.m_pReconnectInfo)); else m_pReconnectInfo = 0; } -void KviServer::operator=(const KviServer & serv) +void KviIrcServer::operator=(const KviIrcServer & serv) { m_szHostname = serv.m_szHostname; m_szIp = serv.m_szIp; @@ -130,11 +130,11 @@ void KviServer::operator=(const KviServer & serv) if(m_pReconnectInfo) delete m_pReconnectInfo; if(serv.m_pReconnectInfo) - m_pReconnectInfo = new KviServerReconnectInfo(*(serv.m_pReconnectInfo)); + m_pReconnectInfo = new KviIrcServerReconnectInfo(*(serv.m_pReconnectInfo)); else m_pReconnectInfo = 0; } -KviServer::~KviServer() +KviIrcServer::~KviIrcServer() { if(m_pAutoJoinChannelList) { @@ -148,14 +148,14 @@ KviServer::~KviServer() } } -void KviServer::generateUniqueId() +void KviIrcServer::generateUniqueId() { struct timeval tv; kvi_gettimeofday(&tv,0); KviQString::sprintf(m_szId,"myserver%d%d%d",tv.tv_usec,rand() % 1000,rand() % 1000); } -QString KviServer::ircUri() +QString KviIrcServer::ircUri() { QString szUri("irc"); if(useSSL()) szUri += "s"; @@ -173,14 +173,14 @@ QString KviServer::ircUri() return szUri; } -void KviServer::setAutoJoinChannelList(QStringList * pNewChannelList) +void KviIrcServer::setAutoJoinChannelList(QStringList * pNewChannelList) { if(m_pAutoJoinChannelList) delete m_pAutoJoinChannelList; m_pAutoJoinChannelList = pNewChannelList; } -void KviServer::setAutoJoinChannelList(const QString & szNewChannelList) +void KviIrcServer::setAutoJoinChannelList(const QString & szNewChannelList) { if(m_pAutoJoinChannelList) delete m_pAutoJoinChannelList; @@ -191,7 +191,7 @@ void KviServer::setAutoJoinChannelList(const QString & szNewChannelList) m_pAutoJoinChannelList = new QStringList(lChans); } -bool KviServer::load(KviConfigurationFile * cfg, const QString & szPrefix) +bool KviIrcServer::load(KviConfigurationFile * cfg, const QString & szPrefix) { QString szTmp; KviQString::sprintf(szTmp,"%QHostname",&szPrefix); @@ -257,7 +257,7 @@ bool KviServer::load(KviConfigurationFile * cfg, const QString & szPrefix) return true; } -void KviServer::save(KviConfigurationFile * cfg, const QString & szPrefix) +void KviIrcServer::save(KviConfigurationFile * cfg, const QString & szPrefix) { QString szTmp; KviQString::sprintf(szTmp,"%QHostname",&szPrefix); @@ -392,16 +392,16 @@ void KviServer::save(KviConfigurationFile * cfg, const QString & szPrefix) } -KviServerReconnectInfo::KviServerReconnectInfo() +KviIrcServerReconnectInfo::KviIrcServerReconnectInfo() { m_bIsAway = false; } -KviServerReconnectInfo::~KviServerReconnectInfo() +KviIrcServerReconnectInfo::~KviIrcServerReconnectInfo() { } -KviServerReconnectInfo::KviServerReconnectInfo(const KviServerReconnectInfo & info) +KviIrcServerReconnectInfo::KviIrcServerReconnectInfo(const KviIrcServerReconnectInfo & info) { m_szNick = info.m_szNick; m_szPass = info.m_szPass; diff --git a/src/kvilib/irc/KviIrcServer.h b/src/kvilib/irc/KviIrcServer.h index 73d260def..f3633dba7 100644 --- a/src/kvilib/irc/KviIrcServer.h +++ b/src/kvilib/irc/KviIrcServer.h @@ -47,7 +47,7 @@ class KviConfigurationFile; class KviNickServRuleSet; class KviProxy; class KviProxyDataBase; -class KviServer; +class KviIrcServer; #define KVI_IRCSERVER_FLAG_IPV6 1 #define KVI_IRCSERVER_FLAG_CACHEIP 2 @@ -57,29 +57,29 @@ class KviServer; #define KVI_IRCSERVER_FLAG_CAP 32 /** -* \class KviServerReconnectInfo +* \class KviIrcServerReconnectInfo * \brief A class for reconnecting purposes */ -class KVILIB_API KviServerReconnectInfo +class KVILIB_API KviIrcServerReconnectInfo { public: /** * \brief Constructs the server reconnect info object - * \return KviServerReconnectInfo + * \return KviIrcServerReconnectInfo */ - KviServerReconnectInfo(); + KviIrcServerReconnectInfo(); /** * \brief Carbon copy * \param info The object to copy the info from - * \return KviServerReconnectInfo + * \return KviIrcServerReconnectInfo */ - KviServerReconnectInfo(const KviServerReconnectInfo & info); + KviIrcServerReconnectInfo(const KviIrcServerReconnectInfo & info); /** * \brief Destroys the server reconnect info object */ - ~KviServerReconnectInfo(); + ~KviIrcServerReconnectInfo(); public: QString m_szNick; QString m_szPass; @@ -90,31 +90,31 @@ public: }; /** -* \class KviServer +* \class KviIrcServer * \brief The class which manages the irc servers */ -class KVILIB_API KviServer : public KviHeapObject +class KVILIB_API KviIrcServer : public KviHeapObject { public: /** * \brief Constructs the server object - * \return KviServer + * \return KviIrcServer */ - KviServer(); + KviIrcServer(); /** * \brief Carbon copy * \param serv The irc server - * \return KviServer + * \return KviIrcServer */ - KviServer(const KviServer & serv); + KviIrcServer(const KviIrcServer & serv); /** * \brief Destroys the server object */ - ~KviServer(); + ~KviIrcServer(); public: - KviServerReconnectInfo * m_pReconnectInfo; + KviIrcServerReconnectInfo * m_pReconnectInfo; QString m_szHostname; // the server hostname (or ip eventually) QString m_szIp; // the server's cached ip (if we're caching) QString m_szDescription; // the server description @@ -580,7 +580,7 @@ public: * \param s The server to copy * \return void */ - void operator=(const KviServer & s); + void operator=(const KviIrcServer & s); }; #endif //_KVI_IRCSERVER_H_ diff --git a/src/kvilib/irc/KviIrcServerDataBase.cpp b/src/kvilib/irc/KviIrcServerDataBase.cpp index 5aae7b1d8..b3de29559 100644 --- a/src/kvilib/irc/KviIrcServerDataBase.cpp +++ b/src/kvilib/irc/KviIrcServerDataBase.cpp @@ -34,15 +34,15 @@ #include #include -KviServerDataBase::KviServerDataBase() +KviIrcServerDataBase::KviIrcServerDataBase() { - m_pRecords = new KviPointerHashTable(17,false); + m_pRecords = new KviPointerHashTable(17,false); m_pRecords->setAutoDelete(true); m_pAutoConnectOnStartupServers = 0; m_pAutoConnectOnStartupNetworks = 0; } -KviServerDataBase::~KviServerDataBase() +KviIrcServerDataBase::~KviIrcServerDataBase() { delete m_pRecords; if(m_pAutoConnectOnStartupServers) @@ -51,7 +51,7 @@ KviServerDataBase::~KviServerDataBase() delete m_pAutoConnectOnStartupNetworks; } -void KviServerDataBase::clearAutoConnectOnStartupServers() +void KviIrcServerDataBase::clearAutoConnectOnStartupServers() { if(!m_pAutoConnectOnStartupServers) return; @@ -60,7 +60,7 @@ void KviServerDataBase::clearAutoConnectOnStartupServers() m_pAutoConnectOnStartupServers = 0; } -void KviServerDataBase::clearAutoConnectOnStartupNetworks() +void KviIrcServerDataBase::clearAutoConnectOnStartupNetworks() { if(!m_pAutoConnectOnStartupNetworks) return; @@ -69,32 +69,32 @@ void KviServerDataBase::clearAutoConnectOnStartupNetworks() m_pAutoConnectOnStartupNetworks = 0; } -void KviServerDataBase::clear() +void KviIrcServerDataBase::clear() { m_pRecords->clear(); m_szCurrentNetwork = ""; } -void KviServerDataBase::addNetwork(KviNetwork * n) +void KviIrcServerDataBase::addNetwork(KviIrcNetwork * n) { m_pRecords->replace(n->name(),n); } -KviNetwork * KviServerDataBase::findNetwork(const QString & szName) +KviIrcNetwork * KviIrcServerDataBase::findNetwork(const QString & szName) { - KviNetwork * r = m_pRecords->find(szName); + KviIrcNetwork * r = m_pRecords->find(szName); return r; } -unsigned int KviServerDataBase::networkCount() const +unsigned int KviIrcServerDataBase::networkCount() const { return m_pRecords->count(); } -KviNetwork * KviServerDataBase::currentNetwork() +KviIrcNetwork * KviIrcServerDataBase::currentNetwork() { - KviNetwork * r = 0; + KviIrcNetwork * r = 0; if(!m_szCurrentNetwork.isEmpty()) r = m_pRecords->find(m_szCurrentNetwork); if(r) @@ -103,7 +103,7 @@ KviNetwork * KviServerDataBase::currentNetwork() return 0; } -bool KviServerDataBase::makeCurrentBestServerInNetwork(const QString & szNetName, KviNetwork * r, QString & szError) +bool KviIrcServerDataBase::makeCurrentBestServerInNetwork(const QString & szNetName, KviIrcNetwork * r, QString & szError) { m_szCurrentNetwork = szNetName; // find a round-robin server in that network @@ -114,7 +114,7 @@ bool KviServerDataBase::makeCurrentBestServerInNetwork(const QString & szNetName return false; } - for(KviServer * s = r->m_pServerList->first(); s; s = r->m_pServerList->next()) + for(KviIrcServer * s = r->m_pServerList->first(); s; s = r->m_pServerList->next()) { if(s->m_szDescription.contains("random",Qt::CaseInsensitive) || (s->m_szDescription.contains("round",Qt::CaseInsensitive) && @@ -133,7 +133,7 @@ bool KviServerDataBase::makeCurrentBestServerInNetwork(const QString & szNetName KviQString::sprintf(szTryAlso2,"irc.%Q.net",&szNetName); KviQString::sprintf(szTryAlso3,"irc.%Q.com",&szNetName); - for(KviServer * ss = r->m_pServerList->first(); ss; ss = r->m_pServerList->next()) + for(KviIrcServer * ss = r->m_pServerList->first(); ss; ss = r->m_pServerList->next()) { if(KviQString::equalCI(ss->m_szHostname,szTryAlso1) || KviQString::equalCI(ss->m_szHostname,szTryAlso2) || @@ -148,20 +148,20 @@ bool KviServerDataBase::makeCurrentBestServerInNetwork(const QString & szNetName return true; } -bool KviServerDataBase::makeCurrentServer(KviServerDefinition * d, QString & szError) +bool KviIrcServerDataBase::makeCurrentServer(KviIrcServerDefinition * d, QString & szError) { - KviServer * pServer = 0; + KviIrcServer * pServer = 0; - KviPointerHashTableIterator it(*m_pRecords); - KviNetwork * r = 0; - KviServer * srv; + KviPointerHashTableIterator it(*m_pRecords); + KviIrcNetwork * r = 0; + KviIrcServer * srv; if(KviQString::equalCIN(d->szServer,"net:",4)) { // net:networkname form QString szNet = d->szServer; szNet.remove(0,4); - KviNetwork * r = m_pRecords->find(szNet); + KviIrcNetwork * r = m_pRecords->find(szNet); if(r)return makeCurrentBestServerInNetwork(szNet,r,szError); szError = __tr2qs("The server specification seems to be in the net: but the network couln't be found in the database"); return false; @@ -272,7 +272,7 @@ search_finished: if(!d->szServer.contains('.')) { // assume it is a network name! - KviNetwork * r = m_pRecords->find(d->szServer); + KviIrcNetwork * r = m_pRecords->find(d->szServer); if(r)return makeCurrentBestServerInNetwork(d->szServer,r,szError); // else probably not a network name } @@ -283,11 +283,11 @@ search_finished: r = m_pRecords->find(__tr2qs("Standalone Servers")); if(!r) { - r = new KviNetwork(__tr2qs("Standalone Servers")); + r = new KviIrcNetwork(__tr2qs("Standalone Servers")); m_pRecords->replace(r->name(),r); } - KviServer * s = new KviServer(); + KviIrcServer * s = new KviIrcServer(); s->m_szHostname = d->szServer; if(bIsValidIPv4) { @@ -354,7 +354,7 @@ QString & szDescription,QString & szHost,QString & szPort,bool & bSsl,kvi_u32_t } } -void KviServerDataBase::importFromMircIni(const QString & filename, const QString & szMircIni, QStringList & recentServers) +void KviIrcServerDataBase::importFromMircIni(const QString & filename, const QString & szMircIni, QStringList & recentServers) { clear(); recentServers.clear(); @@ -418,14 +418,14 @@ void KviServerDataBase::importFromMircIni(const QString & filename, const QStrin parseMircServerRecord(entry,szNet, szDescription,szHost,szPort,bSsl,uPort); - KviNetwork * r = findNetwork(szNet); + KviIrcNetwork * r = findNetwork(szNet); if(!r) { - r = new KviNetwork(szNet); + r = new KviIrcNetwork(szNet); addNetwork(r); } - KviServer *s = new KviServer(); + KviIrcServer *s = new KviIrcServer(); s->m_szHostname = szHost; s->m_szDescription = szDescription; s->m_uPort = uPort; @@ -442,7 +442,7 @@ void KviServerDataBase::importFromMircIni(const QString & filename, const QStrin } } -void KviServerDataBase::load(const QString & filename) +void KviIrcServerDataBase::load(const QString & filename) { clear(); KviConfigurationFile cfg(filename,KviConfigurationFile::Read); @@ -455,7 +455,7 @@ void KviServerDataBase::load(const QString & filename) { if(it.current()->count() > 0) { - KviNetwork * pNewNet = new KviNetwork(it.currentKey()); + KviIrcNetwork * pNewNet = new KviIrcNetwork(it.currentKey()); addNetwork(pNewNet); cfg.setGroup(it.currentKey()); pNewNet->m_szEncoding = cfg.readEntry("Encoding"); @@ -474,7 +474,7 @@ void KviServerDataBase::load(const QString & filename) { if(!m_pAutoConnectOnStartupNetworks) { - m_pAutoConnectOnStartupNetworks = new KviPointerList; + m_pAutoConnectOnStartupNetworks = new KviPointerList; m_pAutoConnectOnStartupNetworks->setAutoDelete(false); } m_pAutoConnectOnStartupNetworks->append(pNewNet); @@ -487,7 +487,7 @@ void KviServerDataBase::load(const QString & filename) int nServers = cfg.readIntEntry("NServers",0); for(int i=0;i < nServers;i++) { - KviServer *s = new KviServer(); + KviIrcServer *s = new KviIrcServer(); KviQString::sprintf(tmp,"%d_",i); if(s->load(&cfg,tmp)) { @@ -498,7 +498,7 @@ void KviServerDataBase::load(const QString & filename) { if(!m_pAutoConnectOnStartupServers) { - m_pAutoConnectOnStartupServers = new KviPointerList; + m_pAutoConnectOnStartupServers = new KviPointerList; m_pAutoConnectOnStartupServers->setAutoDelete(false); } m_pAutoConnectOnStartupServers->append(s); @@ -511,17 +511,17 @@ void KviServerDataBase::load(const QString & filename) } } -void KviServerDataBase::save(const QString &filename) +void KviIrcServerDataBase::save(const QString &filename) { KviConfigurationFile cfg(filename,KviConfigurationFile::Write); cfg.clear(); // clear any old entry - KviPointerHashTableIterator it(*m_pRecords); + KviPointerHashTableIterator it(*m_pRecords); QString tmp; - while(KviNetwork * pNetwork = it.current()) + while(KviIrcNetwork * pNetwork = it.current()) { cfg.setGroup(pNetwork->name()); cfg.writeEntry("NServers",pNetwork->m_pServerList->count()); @@ -552,7 +552,7 @@ void KviServerDataBase::save(const QString &filename) if(!pNetwork->m_szUserIdentityId.isEmpty()) cfg.writeEntry("UserIdentityId",pNetwork->m_szUserIdentityId); int i=0; - for(KviServer *s = pNetwork->m_pServerList->first();s;s = pNetwork->m_pServerList->next()) + for(KviIrcServer *s = pNetwork->m_pServerList->first();s;s = pNetwork->m_pServerList->next()) { KviQString::sprintf(tmp,"%d_",i); s->save(&cfg,tmp); diff --git a/src/kvilib/irc/KviIrcServerDataBase.h b/src/kvilib/irc/KviIrcServerDataBase.h index cf542e130..a2c2d04dd 100644 --- a/src/kvilib/irc/KviIrcServerDataBase.h +++ b/src/kvilib/irc/KviIrcServerDataBase.h @@ -33,15 +33,15 @@ #include "kvi_settings.h" #include "KviQString.h" #include "KviIrcServer.h" -#include "KviNetwork.h" +#include "KviIrcNetwork.h" #include "KviPointerHashTable.h" /** -* \typedef KviServerDefinition -* \struct _KviServerDefinition +* \typedef KviIrcServerDefinition +* \struct _KviIrcServerDefinition * \brief Server definition */ -typedef struct _KviServerDefinition +typedef struct _KviIrcServerDefinition { QString szServer; kvi_u32_t uPort; @@ -54,30 +54,30 @@ typedef struct _KviServerDefinition QString szNick; QString szInitUMode; QString szId; -} KviServerDefinition; +} KviIrcServerDefinition; /** -* \class KviServerDataBase +* \class KviIrcServerDataBase * \brief Irc server database handling class */ -class KVILIB_API KviServerDataBase +class KVILIB_API KviIrcServerDataBase { public: /** * \brief Constructs the server database object - * \return KviServerDataBase + * \return KviIrcServerDataBase */ - KviServerDataBase(); + KviIrcServerDataBase(); /** * \brief Destroys the server database object */ - ~KviServerDataBase(); + ~KviIrcServerDataBase(); private: - KviPointerHashTable * m_pRecords; + KviPointerHashTable * m_pRecords; QString m_szCurrentNetwork; - KviPointerList * m_pAutoConnectOnStartupServers; - KviPointerList * m_pAutoConnectOnStartupNetworks; + KviPointerList * m_pAutoConnectOnStartupServers; + KviPointerList * m_pAutoConnectOnStartupNetworks; public: /** * \brief Deletes the database @@ -87,9 +87,9 @@ public: /** * \brief Returns the record dictionary of the database - * \return KviPointerHashTable * + * \return KviPointerHashTable * */ - inline KviPointerHashTable * recordDict(){ return m_pRecords; }; + inline KviPointerHashTable * recordDict(){ return m_pRecords; }; /** * \brief Returns a list of servers to connect on startup @@ -99,9 +99,9 @@ public: * only during the startup phase because it contains shallow pointers to the * servers really contained in the server/network list and it is never updated * later. - * \return KviPointerList * + * \return KviPointerList * */ - inline KviPointerList * autoConnectOnStartupServers(){ return m_pAutoConnectOnStartupServers; }; + inline KviPointerList * autoConnectOnStartupServers(){ return m_pAutoConnectOnStartupServers; }; /** * \brief Returns a list of networks to connect on startup @@ -111,9 +111,9 @@ public: * only during the startup phase because it contains shallow pointers to the * networks really contained in the server/network list and it is never * updated later. - * \return KviPointerList * + * \return KviPointerList * */ - inline KviPointerList * autoConnectOnStartupNetworks(){ return m_pAutoConnectOnStartupNetworks; }; + inline KviPointerList * autoConnectOnStartupNetworks(){ return m_pAutoConnectOnStartupNetworks; }; /** * \brief Deletes the list of autoconnect servers @@ -142,23 +142,23 @@ public: /** * \brief Returns the current network - * \return KviNetwork + * \return KviIrcNetwork */ - KviNetwork * currentNetwork(); + KviIrcNetwork * currentNetwork(); /** * \brief Adds a network to the database * \param n The source network * \return void */ - void addNetwork(KviNetwork * n); + void addNetwork(KviIrcNetwork * n); /** * \brief Searches for a network * \param name The name of the network to find - * \return KviNetwork + * \return KviIrcNetwork */ - KviNetwork * findNetwork(const QString & name); + KviIrcNetwork * findNetwork(const QString & name); /** * \brief Returns the number of networks @@ -195,7 +195,7 @@ public: * \param szError The container for a possible error * \return bool */ - bool makeCurrentServer(KviServerDefinition * d, QString & szError); + bool makeCurrentServer(KviIrcServerDefinition * d, QString & szError); /** * \brief Marks the current servers as the best in the network @@ -204,7 +204,7 @@ public: * \param szError The container for a possible error * \return bool */ - bool makeCurrentBestServerInNetwork(const QString & szNetName, KviNetwork * d, QString & szError); + bool makeCurrentBestServerInNetwork(const QString & szNetName, KviIrcNetwork * d, QString & szError); }; #endif //_KVI_IRCSERVERDB_H_ diff --git a/src/kvilib/irc/KviNetwork.cpp b/src/kvilib/irc/KviNetwork.cpp deleted file mode 100644 index 6457b93b0..000000000 --- a/src/kvilib/irc/KviNetwork.cpp +++ /dev/null @@ -1,157 +0,0 @@ -//============================================================================= -// -// File : KviNetwork.cpp -// Creation date : Wed Aug 27 2008 17:44:56 by Alexey Uzhva -// -// This file is part of the KVirc irc client distribution -// Copyright (C) 2008 Alexey Uzhva (wizard at opendoor dot ru) -// -// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -//============================================================================= - -#include "KviNetwork.h" -#include "KviIrcServer.h" -#include "KviNickServRuleSet.h" - -KviNetwork::KviNetwork(const KviNetwork &src) -{ - m_pChannelList = 0; - m_pNickServRuleSet = 0; - m_pServerList = new KviPointerList; - m_pServerList->setAutoDelete(true); - copyFrom(src); -} - -KviNetwork::KviNetwork(const QString &name) -{ - m_szName = name; - m_pChannelList = 0; - m_pNickServRuleSet = 0; - m_bAutoConnect = false; - m_pServerList = new KviPointerList; - m_pServerList->setAutoDelete(true); - m_pCurrentServer = 0; -} - -KviNetwork::~KviNetwork() -{ - if(m_pChannelList)delete m_pChannelList; - if(m_pNickServRuleSet)delete m_pNickServRuleSet; - delete m_pServerList; -} - -void KviNetwork::setAutoJoinChannelList(QStringList * pNewChannelList) -{ - if(m_pChannelList)delete m_pChannelList; - m_pChannelList = pNewChannelList; -} - -void KviNetwork::setAutoJoinChannelList(const QString & szNewChannelList) -{ - if(m_pChannelList) - delete m_pChannelList; - QStringList lChans = szNewChannelList.split(","); - if(lChans.isEmpty()) - m_pChannelList = NULL; - else - m_pChannelList = new QStringList(lChans); -} - -void KviNetwork::setNickServRuleSet(KviNickServRuleSet * s) -{ - if(m_pNickServRuleSet)delete m_pNickServRuleSet; - m_pNickServRuleSet = s; -} - -void KviNetwork::copyFrom(const KviNetwork &src) -{ - m_szName = src.m_szName; - m_szEncoding = src.m_szEncoding; - m_szTextEncoding = src.m_szTextEncoding; - m_szDescription = src.m_szDescription; - m_szNickName = src.m_szNickName; - m_szRealName = src.m_szRealName; - m_szUserName = src.m_szUserName; - m_szPass = src.m_szPass; - m_bAutoConnect = src.m_bAutoConnect; - m_szUserIdentityId = src.m_szUserIdentityId; - m_szOnConnectCommand = src.m_szOnConnectCommand; - m_szOnLoginCommand = src.m_szOnLoginCommand; - if(m_pChannelList)delete m_pChannelList; - if(src.m_pChannelList)m_pChannelList = new QStringList(*(src.m_pChannelList)); - else m_pChannelList = 0; - if(m_pNickServRuleSet)delete m_pNickServRuleSet; - if(src.m_pNickServRuleSet)m_pNickServRuleSet = new KviNickServRuleSet(*(src.m_pNickServRuleSet)); - else m_pNickServRuleSet = 0; -/* - // We don't copy the server list, since this function is called in KviServerOptionsWidget::commit() - // to recreate the server list from scratch; copying the original servers will mean duplicate servers - // (see bug ticket #300) - for (KviServer *s = src.m_pServerList->first(); s; s = src.m_pServerList->next()) - { - m_pServerList->append(new KviServer(*s)); - } -*/ -} - -void KviNetwork::insertServer(KviServer *srv) -{ - m_pServerList->append(srv); -} - -KviServer * KviNetwork::findServer(const QString & szHostname) -{ - for (KviServer *s = m_pServerList->first(); s; s = m_pServerList->next()) - { - if (KviQString::equalCI(s->m_szHostname, szHostname)) - return s; - } - return 0; -} - -KviServer * KviNetwork::findServer(const KviServer * pServer) -{ - for (KviServer *s = m_pServerList->first(); s; s = m_pServerList->next()) - { - // we better go with the unique id first - if(!s->m_szId.isEmpty()) - { - // at least one of the 2 id is not empty, so if they match we're done - if(KviQString::equalCI(s->m_szId, pServer->m_szId)) - return s; - } else { - // failback on the "check everything" method - - if (KviQString::equalCI(s->m_szHostname, pServer->m_szHostname) - && (s->m_uPort == pServer->m_uPort) && (s->useSSL() - == pServer->useSSL()) && (s->isIPv6() == pServer->isIPv6())) - return s; - } - } - return 0; -} - -void KviNetwork::setCurrentServer(KviServer *srv) -{ - if(m_pServerList->findRef(srv) != -1)m_pCurrentServer = srv; -} - -KviServer * KviNetwork::currentServer() -{ - if(m_pCurrentServer)return m_pCurrentServer; - m_pCurrentServer = m_pServerList->first(); - return m_pCurrentServer; -} diff --git a/src/kvilib/irc/KviNetwork.h b/src/kvilib/irc/KviNetwork.h deleted file mode 100644 index bf71a968c..000000000 --- a/src/kvilib/irc/KviNetwork.h +++ /dev/null @@ -1,342 +0,0 @@ -#ifndef KVI_NETWORK_H_ -#define KVI_NETWORK_H_ -//============================================================================= -// -// File : KviNetwork.cpp -// Creation date : Wed Aug 27 2008 17:44:56 by Alexey Uzhva -// -// This file is part of the KVirc irc client distribution -// Copyright (C) 2008 Alexey Uzhva (wizard at opendoor dot ru) -// -// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -// -//============================================================================= - -/** -* \file KviNetwork.cpp -* \author Alexey Uzhva -* \brief Network handling -*/ - -#include "kvi_settings.h" -#include "KviHeapObject.h" -#include "KviPointerList.h" - -#include -#include - -class KviNickServRuleSet; -class KviServer; -class QStringList; - -/** -* \class KviNetwork -* \brief Network handling class -*/ -class KVILIB_API KviNetwork : public KviHeapObject -{ - friend class KviServerDataBase; -public: - /** - * \brief Construct the network object - * \param name The name of the network - * \return KviNetwork - */ - KviNetwork(const QString & name); - - /** - * \brief Carbon copy - * \param src The source network - * \return KviNetwork - */ - KviNetwork(const KviNetwork & src); - - /** - * \brief Destroys the network object - */ - ~KviNetwork(); -protected: - QString m_szName; - QString m_szDescription; - QString m_szEncoding; // if empty, use system default - QString m_szTextEncoding; // if empty, use system default - QString m_szNickName; // preferred nick name - QString m_szUserName; // preferred user name - QString m_szRealName; // preferred real name - QString m_szPass; // special password - QString m_szOnConnectCommand; // the command to run on connect - QString m_szOnLoginCommand; // the command to run after login - QStringList * m_pChannelList; // Channels to auto join - KviNickServRuleSet * m_pNickServRuleSet; // set of nick serv rules - bool m_bAutoConnect; // autoconnect - QString m_szUserIdentityId; // The user identity to use for this server: if empty - // Then use the global primary identity - //moved from KviServerDataBaseRecord - KviPointerList * m_pServerList; - KviServer * m_pCurrentServer; -public: - /** - * \brief Returns the name of the network - * \return const QString & - */ - inline const QString & name() const { return m_szName; }; - - /** - * \brief Returns the encoding of the network - * - * Some information as nickname and channel names are encoded when - * communicating with the server - * \return const QString & - */ - inline const QString & encoding() const { return m_szEncoding; }; - - /** - * \brief Returns the text encoding of the network - * - * This is the default encoding when talking on channels or queries - * \return const QString & - */ - inline const QString & textEncoding() const { return m_szTextEncoding; }; - - /** - * \brief Returns the description of the network - * \return const QString & - */ - inline const QString & description() const { return m_szDescription; }; - - /** - * \brief Returns the nickname of the user associated to the network - * \return const QString & - */ - inline const QString & nickName() const { return m_szNickName; }; - - /** - * \brief Returns the realname of the user associated to the network - * \return const QString & - */ - inline const QString & realName() const { return m_szRealName; }; - - /** - * \brief Returns the username of the user associated to the network - * \return const QString & - */ - inline const QString & userName() const { return m_szUserName; }; - - /** - * \brief Returns the password of the user associated to the network - * \return const QString & - */ - inline const QString & password() const { return m_szPass; }; - - /** - * \brief Returns the commands to run on network login - * \return const QString & - */ - inline const QString & onLoginCommand() const { return m_szOnLoginCommand; }; - - /** - * \brief Returns the commands to run on network connect - * \return const QString & - */ - inline const QString & onConnectCommand() const { return m_szOnConnectCommand; }; - - /** - * \brief Returns the user identity of the user associated to the network - * \return const QString & - */ - inline const QString & userIdentityId() const { return m_szUserIdentityId; }; - - /** - * \brief Returns true if the network has the autoconnect state on - * \return bool - */ - inline bool autoConnect() const { return m_bAutoConnect; }; - - /** - * \brief Returns the list of channels with autojoin flag - * \return QStringList * - */ - inline QStringList * autoJoinChannelList(){ return m_pChannelList; }; - - /** - * \brief Returns the list of channels with autojoin flag as a string - * \return const QString & - */ - inline const QString autoJoinChannelListAsString(){ return m_pChannelList ? m_pChannelList->join(",") : ""; }; - - /** - * \brief Returns a set of rules for the NickServ - * \return KviNickServRuleSet * - */ - inline KviNickServRuleSet * nickServRuleSet(){ return m_pNickServRuleSet; }; - - /** - * \brief Sets the rules for NickServ - * \param s The rule set where to add rules - * \return void - */ - void setNickServRuleSet(KviNickServRuleSet * s); - - /** - * \brief Carbon copy - * \param d The source network to copy from - * \return void - */ - void copyFrom(const KviNetwork & d); - - /** - * \brief Sets the name of the network - * \param szName The name of the network - * \return void - */ - inline void setName(const QString & szName){ m_szName = szName; }; - - /** - * \brief Sets the encondig of the network - * - * Some information as nickname and channel names are encoded when - * communicating with the server - * \param szEncoding The encoding of the network - * \return void - */ - inline void setEncoding(const QString & szEncoding){ m_szEncoding = szEncoding; }; - - /** - * \brief Sets the text encondig of the network - * - * This is the default encoding when talking on channels or queries - * \param szEncoding The text encoding of the network - * \return void - */ - inline void setTextEncoding(const QString & szEncoding){ m_szTextEncoding = szEncoding; }; - - /** - * \brief Sets the description of the network - * \param szDescription The description of the network - * \return void - */ - inline void setDescription(const QString & szDescription){ m_szDescription = szDescription; }; - - /** - * \brief Sets the list of commands to run on network connection - * \param cmd The commands list to run - * \return void - */ - inline void setOnConnectCommand(const QString & cmd){ m_szOnConnectCommand = cmd; }; - - /** - * \brief Sets the list of commands to run on network login - * \param cmd The commands list to run - * \return void - */ - inline void setOnLoginCommand(const QString & cmd){ m_szOnLoginCommand = cmd; }; - - /** - * \brief Sets the nickname of the user associated to the network - * \param n The nickname - * \return void - */ - inline void setNickName(const QString & n){ m_szNickName = n; }; - - /** - * \brief Sets the realname of the user associated to the network - * \param r The realname - * \return void - */ - inline void setRealName(const QString & r){ m_szRealName = r; }; - - /** - * \brief Sets the username of the user associated to the network - * \param u The username - * \return void - */ - inline void setUserName(const QString & u){ m_szUserName = u; }; - - /** - * \brief Sets the password of the user associated to the network - * \return void - */ - inline void setPassword(const QString & p){ m_szPass = p; }; - - /** - * \brief Sets the list of channels to mark for autojoin - * \param pNewChannelList The channel list - * \return void - */ - void setAutoJoinChannelList(QStringList * pNewChannelList); - - /** - * \brief Sets the list of channels to mark for autojoin - * \param szNewChannelList A comma separated list of channels - * \return void - */ - void setAutoJoinChannelList(const QString & szNewChannelList); - - /** - * \brief Sets the autoconnect flag - * \param bAutoConnect The state of the autoconnect flag - * \return void - */ - inline void setAutoConnect(bool bAutoConnect){ m_bAutoConnect = bAutoConnect; }; - - /** - * \brief Sets the user identity id of the user associated to the network - * \param szUserIdentityId The user identity - * \return void - */ - inline void setUserIdentityId(const QString & szUserIdentityId){ m_szUserIdentityId = szUserIdentityId; }; - - /** - * \brief Returns a list of servers associated to the network - * \return KviPointerList * - */ - inline KviPointerList * serverList(){ return m_pServerList; }; - - /** - * \brief Returns the current server - * \return KviServer - */ - KviServer * currentServer(); - - /** - * \brief Adds a new server to the network - * \param srv The source server to add - * \return void - */ - void insertServer(KviServer * srv); - - /** - * \brief Searches for a server in the network - * \param szHostname The hostname of the server to find - * \return KviServer - */ - KviServer * findServer(const QString & szHostname); - - /** - * \brief Searches for a server in the network - * \param pServer The server to find - * \return KviServer - */ - KviServer * findServer(const KviServer * pServer); - - /** - * \brief Sets the current server - * \param srv The source server - * \return void - */ - void setCurrentServer(KviServer * srv); -}; - -#endif // KVI_NETWORK_H_ diff --git a/src/kvilib/net/KviDnsResolver.cpp b/src/kvilib/net/KviDnsResolver.cpp index ef4cfcefb..8004633e6 100644 --- a/src/kvilib/net/KviDnsResolver.cpp +++ b/src/kvilib/net/KviDnsResolver.cpp @@ -23,7 +23,7 @@ //============================================================================= #include "KviDnsResolver.h" -#include "kvi_error.h" +#include "KviError.h" #include "KviNetUtils.h" #include diff --git a/src/kvilib/net/KviDnsResolver.h b/src/kvilib/net/KviDnsResolver.h index bf3552179..9de5a1726 100644 --- a/src/kvilib/net/KviDnsResolver.h +++ b/src/kvilib/net/KviDnsResolver.h @@ -30,8 +30,7 @@ #include "KviThread.h" #include "KviQString.h" - -class KviDnsResolverThread; // not part of the API +class KviDnsResolverThread; class KVILIB_API KviDnsResolverResult : public KviHeapObject @@ -43,20 +42,44 @@ protected: public: ~KviDnsResolverResult(); protected: - int m_iError; + int m_iError; KviPointerList * m_pHostnameList; KviPointerList * m_pIpAddressList; - QString m_szQuery; + QString m_szQuery; public: - int error(){ return m_iError; }; + int error() + { + return m_iError; + } + // never store nor delete these pointers! // (these are NEVER 0) - KviPointerList * hostnameList(){ return m_pHostnameList; }; - KviPointerList * ipAddressList(){ return m_pIpAddressList; }; - const QString &query(){ return m_szQuery; }; + KviPointerList * hostnameList() + { + return m_pHostnameList; + } + + KviPointerList * ipAddressList() + { + return m_pIpAddressList; + } + + const QString &query() + { + return m_szQuery; + } + protected: - void setError(int iError){ m_iError = iError; }; - void setQuery(const QString &query){ m_szQuery = query; }; + void setError(int iError) + { + m_iError = iError; + } + + void setQuery(const QString &query) + { + m_szQuery = query; + } + void appendHostname(const QString &host); void appendAddress(const QString &addr); }; @@ -69,15 +92,15 @@ class KVILIB_API KviDnsResolver : public QObject, public KviHeapObject Q_PROPERTY(bool blockingDelete READ isRunning) public: KviDnsResolver(); - ~KviDnsResolver(); + virtual ~KviDnsResolver(); public: enum QueryType { IPv4, IPv6, Any }; enum State { Idle, Busy, Failure, Success }; protected: - void * m_pAuxData; + void * m_pAuxData; KviDnsResolverThread * m_pSlaveThread; KviDnsResolverResult * m_pDnsResult; - State m_state; + State m_state; public: ///////////////////////////////////////////////////////////////////////////////////////////////////// // @@ -125,7 +148,7 @@ class KviDnsResolverThread : public KviThread friend class KviDnsResolver; protected: KviDnsResolverThread(KviDnsResolver * pDns); - ~KviDnsResolverThread(); + virtual ~KviDnsResolverThread(); protected: QString m_szQuery; KviDnsResolver::QueryType m_queryType; diff --git a/src/kvilib/net/KviHttpRequest.cpp b/src/kvilib/net/KviHttpRequest.cpp index 1dfd59acc..3dd84ebfb 100644 --- a/src/kvilib/net/KviHttpRequest.cpp +++ b/src/kvilib/net/KviHttpRequest.cpp @@ -32,7 +32,7 @@ #include "KviLocale.h" #include "KviNetUtils.h" #include "KviDnsResolver.h" -#include "kvi_error.h" +#include "KviError.h" #include "kvi_debug.h" #include "kvi_socket.h" #include "KviTimeUtils.h" diff --git a/src/kvilib/net/kvi_socket.h b/src/kvilib/net/kvi_socket.h index d0f3067d7..8c0f61ba8 100644 --- a/src/kvilib/net/kvi_socket.h +++ b/src/kvilib/net/kvi_socket.h @@ -46,22 +46,23 @@ #define KVI_INVALID_SOCKET INVALID_SOCKET - //every decent win version should contain IPPROTO_IPV6 + //every decent win version should contain IPPROTO_IPV6 - //old mingw win32 headers doesn't contain this - #ifndef IPV6_PROTECTION_LEVEL - # define IPV6_PROTECTION_LEVEL 23 - # define PROTECTION_LEVEL_UNRESTRICTED 10 /* for peer-to-peer apps */ - # define PROTECTION_LEVEL_DEFAULT 20 /* default level */ - # define PROTECTION_LEVEL_RESTRICTED 30 /* for Intranet apps */ - #endif + //old mingw win32 headers doesn't contain this + #ifndef IPV6_PROTECTION_LEVEL + #define IPV6_PROTECTION_LEVEL 23 + #define PROTECTION_LEVEL_UNRESTRICTED 10 /* for peer-to-peer apps */ + #define PROTECTION_LEVEL_DEFAULT 20 /* default level */ + #define PROTECTION_LEVEL_RESTRICTED 30 /* for Intranet apps */ + #endif #define KVI_IPV6_PROTECTION_LEVEL IPV6_PROTECTION_LEVEL #define KVI_PROTECTION_LEVEL_RESTRICTED PROTECTION_LEVEL_RESTRICTED #define KVI_PROTECTION_LEVEL_DEFAULT PROTECTION_LEVEL_DEFAULT #define KVI_PROTECTION_LEVEL_UNRESTRICTED PROTECTION_LEVEL_UNRESTRICTED - #define KVI_IPPROTO_IPV6 IPPROTO_IPV6 -#else + #define KVI_IPPROTO_IPV6 IPPROTO_IPV6 + +#else //!(defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW)) #include #include @@ -72,14 +73,12 @@ #include #define KVI_INVALID_SOCKET (-1) -#endif +#endif //!(defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW)) #ifndef MSG_NOSIGNAL // At least solaris seems to not have it #define MSG_NOSIGNAL 0 -#endif - -//#include "kvi_socketcalls.h" +#endif //!MSG_NOSIGNAL //================================================================================================ diff --git a/src/kvilib/system/KviByteOrder.h b/src/kvilib/system/KviByteOrder.h index c7d1b56d6..6fcc50308 100644 --- a/src/kvilib/system/KviByteOrder.h +++ b/src/kvilib/system/KviByteOrder.h @@ -5,9 +5,11 @@ // // File : KviByteOrder.h // Creation date : Mon Dec 25 2006 19:56:16 CEST by Szymon Stefanek +// Based on file : kvi_bswap.h +// Creation date : Fri Mar 19 1999 03:15:21 CEST by Szymon Stefanek // // This file is part of the KVirc irc client distribution -// Copyright (C) 2006-2010 Szymon Stefanek (pragma at kvirc dot net) +// Copyright (C) 1999-2010 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 @@ -26,57 +28,100 @@ //============================================================================= #include "kvi_settings.h" -#include "kvi_bswap.h" #include "kvi_inttypes.h" namespace KviByteOrder { + /** + * \brief Swaps the endianess of a kvi_u64_t + * + * \param i the original value + * \return kvi_u64_t + */ + inline kvi_u64_t swap64(kvi_u64_t i) + { + // abcdefgh to hgfedcba + return ((i << 56) | /* h to a */ + ((i & 0xff00) << 40) | /* g to b */ + ((i & 0xff0000) << 24) | /* f to c */ + ((i & 0xff000000) << 8) | /* e to d */ + ((i >> 8) & 0xff000000) | /* d to e */ + ((i >> 24) & 0xff0000) | /* c to f */ + ((i >> 40) & 0xff00) | /* b to g */ + (i >> 56)); /* a to h */ + } + + /** + * \brief Swaps the endianess of a kvi_u32_t + * + * \param i the original value + * \return kvi_u32_t + */ + inline kvi_u32_t swap32(kvi_u32_t i) + { + // abcd to dcba + return ((i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24)); + } + + /** + * \brief Swaps the endianess of a kvi_u16_t + * + * \param i the original value + * \return kvi_u16_t + */ + inline kvi_u16_t swap16(kvi_u16_t i) + { + // ab to ba + return ((i << 8) | (i >> 8)); + } + -// -// Byte Orders Reminder -// Number 0xaabbccdd -// Little Endian Stores 0xdd 0xcc 0xbb 0xaa -// Big Endian Stores 0xaa 0xbb 0xcc 0xdd -// Perverse Middle Endian 0xbb 0xaa 0xdd 0xcc or another braindamaged combination (unsupported) -// Network Byte Order is Big Endian -// Intel Stuff uses Little Endian -// PPC is Big Endian -// Universal binaries on MacOSX use both Big and Little Endian -// + // + // Byte Orders Reminder + // Number 0xaabbccdd + // Little Endian Stores 0xdd 0xcc 0xbb 0xaa + // Big Endian Stores 0xaa 0xbb 0xcc 0xdd + // Perverse Middle Endian 0xbb 0xaa 0xdd 0xcc or another braindamaged combination (unsupported) + // Network Byte Order is Big Endian + // Intel Stuff uses Little Endian + // PPC is Big Endian + // Universal binaries on MacOSX use both Big and Little Endian + // #ifdef BIG_ENDIAN_MACHINE_BYTE_ORDER inline kvi_u16_t localCpuToLittleEndian16(kvi_u16_t u) { - return kvi_swap16(u); + return swap16(u); } inline kvi_u32_t localCpuToLittleEndian32(kvi_u32_t u) { - return kvi_swap32(u); + return swap32(u); } inline kvi_u64_t localCpuToLittleEndian64(kvi_u64_t u) { - return kvi_swap64(u); + return swap64(u); } inline kvi_u16_t littleEndianToLocalCpu16(kvi_u16_t u) { - return kvi_swap16(u); + return swap16(u); } inline kvi_u32_t littleEndianToLocalCpu32(kvi_u32_t u) { - return kvi_swap32(u); + return swap32(u); } inline kvi_u64_t littleEndianToLocalCpu64(kvi_u64_t u) { - return kvi_swap64(u); + return swap64(u); } -#else +#else //!BIG_ENDIAN_MACHINE_BYTE_ORDER + // We ASSUME that the local cpu is little endian.. if it isn't.. well :) #define LOCAL_CPU_LITTLE_ENDIAN 1 @@ -110,9 +155,14 @@ namespace KviByteOrder return u; } -#endif +#endif //!BIG_ENDIAN_MACHINE_BYTE_ORDER } // namespace KviByteOrder + + + + + #endif // !_KVI_BYTEORDER_H_ diff --git a/src/kvilib/system/KviLocale.cpp b/src/kvilib/system/KviLocale.cpp index 5fff1d47c..5399a6f5d 100644 --- a/src/kvilib/system/KviLocale.cpp +++ b/src/kvilib/system/KviLocale.cpp @@ -27,7 +27,7 @@ //#define _KVI_DEBUG_CHECK_RANGE_ #include "kvi_debug.h" #include "KviMemory.h" -#include "kvi_bswap.h" +#include "KviByteOrder.h" #define _KVI_LOCALE_CPP_ #include "KviLocale.h" @@ -367,7 +367,7 @@ struct GnuMoStringDescriptor kvi_u32_t offset; }; -#define KVI_SWAP_IF_NEEDED(flag,value) (flag ? kvi_swap32(value) : (value)) +#define KVI_SWAP_IF_NEEDED(flag,value) (flag ? KviByteOrder::swap32(value) : (value)) //////////////////////////////////////////////////////////////////////////////////////// End of gettext.h & gettextP.h ////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/kvilib/system/KviThread.cpp b/src/kvilib/system/KviThread.cpp index 17506a1b0..f44453d96 100644 --- a/src/kvilib/system/KviThread.cpp +++ b/src/kvilib/system/KviThread.cpp @@ -43,7 +43,7 @@ #include "KviCString.h" #include "kvi_settings.h" -#include "kvi_error.h" +#include "KviError.h" #include diff --git a/src/kvilib/system/KviTimeUtils.h b/src/kvilib/system/KviTimeUtils.h index 98c82e4fb..d84a6a121 100644 --- a/src/kvilib/system/KviTimeUtils.h +++ b/src/kvilib/system/KviTimeUtils.h @@ -105,18 +105,11 @@ public: */ namespace KviTimeUtils { - /** \enum FormatTimeSpanFlags */ - enum FormatTimeSpanFlags { - NoLeadingEmptyIntervals = 1, /**< Causes the leading empty intervals to be omitted */ - NoLeadingZeroes = 2, /**< No leading zeroes are printed in hours and seconds */ - FillWithHypens = 4 /**< Uses only -- %d -- %h -- etc.. discards all other flags */ - }; - /** * \brief Returns the current time mills * \return long long */ - long long getCurrentTimeMills(); + KVILIB_API long long getCurrentTimeMills(); /** * \brief Splits the time span uSecs in days, hours, minutes and seconds @@ -130,6 +123,14 @@ namespace KviTimeUtils KVILIB_API void secondsToDaysHoursMinsSecs(unsigned int uSecs, unsigned int * uD, unsigned int * uH, unsigned int * uM, unsigned int * uS); + /** \enum FormatTimeSpanFlags */ + enum FormatTimeSpanFlags + { + NoLeadingEmptyIntervals = 1, /**< Causes the leading empty intervals to be omitted */ + NoLeadingZeroes = 2, /**< No leading zeroes are printed in hours and seconds */ + FillWithHypens = 4 /**< Uses only -- %d -- %h -- etc.. discards all other flags */ + }; + /** * \brief Returns a string formatted like x d x h xx m xx s * \param uSeconds The number of seconds to format diff --git a/src/kvirc/kernel/kvi_app.cpp b/src/kvirc/kernel/kvi_app.cpp index e891e8ca8..b1ec41346 100644 --- a/src/kvirc/kernel/kvi_app.cpp +++ b/src/kvirc/kernel/kvi_app.cpp @@ -131,7 +131,7 @@ DO NOT REMOVE THEM EVEN IF THEY ARE DEFINED ALSO IN kvi_app.h KVIRC_API KviApp * g_pApp = 0; KviConfigurationFile * g_pWinPropertiesConfig = 0; -KVIRC_API KviServerDataBase * g_pServerDataBase = 0; +KVIRC_API KviIrcServerDataBase * g_pServerDataBase = 0; KVIRC_API KviProxyDataBase * g_pProxyDataBase = 0; // Global windows @@ -363,7 +363,7 @@ void KviApp::setup() KVI_SPLASH_SET_PROGRESS(50) // Load the server database - g_pServerDataBase = new KviServerDataBase(); + g_pServerDataBase = new KviIrcServerDataBase(); if(getReadOnlyConfigPath(szTmp,KVI_CONFIGFILE_SERVERDB)) g_pServerDataBase->load(szTmp); @@ -497,7 +497,7 @@ void KviApp::setup() g_pInputPopup = new KviTalPopupMenu(); // create the server parser - g_pServerParser = new KviServerParser(); + g_pServerParser = new KviIrcServerParser(); KVI_SPLASH_SET_PROGRESS(91) @@ -1495,10 +1495,10 @@ void KviApp::saveConfiguration() void KviApp::autoConnectToServers() { - KviPointerList * pList = g_pServerDataBase->autoConnectOnStartupServers(); + KviPointerList * pList = g_pServerDataBase->autoConnectOnStartupServers(); if(pList) { - for(KviServer * pServer = pList->first(); pServer; pServer = pList->next()) + for(KviIrcServer * pServer = pList->first(); pServer; pServer = pList->next()) { QString szCommand = "server -u \"id:"; if(pServer->id().isEmpty()) @@ -1510,10 +1510,10 @@ void KviApp::autoConnectToServers() g_pServerDataBase->clearAutoConnectOnStartupServers(); } - KviPointerList * pListNet = g_pServerDataBase->autoConnectOnStartupNetworks(); + KviPointerList * pListNet = g_pServerDataBase->autoConnectOnStartupNetworks(); if(pListNet) { - for(KviNetwork * pNetwork = pListNet->first(); pNetwork; pNetwork = pListNet->next()) + for(KviIrcNetwork * pNetwork = pListNet->first(); pNetwork; pNetwork = pListNet->next()) { QString szCommandx = "server -u \"net:"; szCommandx += pNetwork->name(); diff --git a/src/kvirc/kernel/kvi_app.h b/src/kvirc/kernel/kvi_app.h index 9f3eac555..01f898507 100644 --- a/src/kvirc/kernel/kvi_app.h +++ b/src/kvirc/kernel/kvi_app.h @@ -59,7 +59,7 @@ class KviConsole; class KviConfigurationFile; class KviRegisteredUser; class KviIrcConnection; -class KviServerDataBase; +class KviIrcServerDataBase; class QPixmap; class QTextCodec; class QDomElement; @@ -377,7 +377,7 @@ signals: #ifndef _KVI_APP_CPP_ extern KVIRC_API KviApp * g_pApp; - extern KVIRC_API KviServerDataBase * g_pServerDataBase; + extern KVIRC_API KviIrcServerDataBase * g_pServerDataBase; #endif #endif //_KVI_APP_H_ diff --git a/src/kvirc/kernel/kvi_asynchronousconnectiondata.h b/src/kvirc/kernel/kvi_asynchronousconnectiondata.h index c4ede9212..a863f2679 100644 --- a/src/kvirc/kernel/kvi_asynchronousconnectiondata.h +++ b/src/kvirc/kernel/kvi_asynchronousconnectiondata.h @@ -50,7 +50,7 @@ public: QString szNick; QString szInitUMode; QString szServerId; - KviServerReconnectInfo * m_pReconnectInfo; + KviIrcServerReconnectInfo * m_pReconnectInfo; }; #endif //!_KVI_ASYNCHRONOUSCONNECTIONDATA_H_ diff --git a/src/kvirc/kernel/kvi_coreactions.cpp b/src/kvirc/kernel/kvi_coreactions.cpp index 44e5f9569..231098808 100644 --- a/src/kvirc/kernel/kvi_coreactions.cpp +++ b/src/kvirc/kernel/kvi_coreactions.cpp @@ -91,7 +91,7 @@ void register_core_actions(KviActionManager * m) SCRIPT_ACTION( KVI_COREACTION_SERVEROPTIONS, - "options.edit -t KviServerOptionsWidget", + "options.edit -t KviIrcServerOptionsWidget", __tr2qs("Configure Servers..."), __tr2qs("Allows you to configure the servers and eventually to connect to them"), KviActionManager::categorySettings(), @@ -857,7 +857,7 @@ KviConnectToServerAction::KviConnectToServerAction(QObject * pParent) : KviSubmenuAction( pParent, QString(KVI_COREACTION_SERVERMENU), - QString("options.edit KviServerOptionsWidget"), + QString("options.edit KviIrcServerOptionsWidget"), __tr2qs("Connect To"), __tr2qs("Shows a popup menu that allows quickly connecting to a server"), KviActionManager::categoryIrc(), diff --git a/src/kvirc/kernel/kvi_internalcmd.cpp b/src/kvirc/kernel/kvi_internalcmd.cpp index 0adb76c33..548c75bdc 100644 --- a/src/kvirc/kernel/kvi_internalcmd.cpp +++ b/src/kvirc/kernel/kvi_internalcmd.cpp @@ -53,7 +53,7 @@ static const char * internalCommandTable[KVI_NUM_INTERNAL_COMMANDS]= "openurl http://www.kvirc.net", "list.open", "if($option(boolShowChannelsJoinDialogAsToplevel))channelsjoin.open -t;else channelsjoin.open", - "if($option(boolShowServersConnectDialogAsToplevel))options.edit -t KviServerOptionsWidget;else options.edit KviServerOptionsWidget", + "if($option(boolShowServersConnectDialogAsToplevel))options.edit -t KviIrcServerOptionsWidget;else options.edit KviIrcServerOptionsWidget", "url.list", "openurl http://www.kvirc.net/?id=themes", "openurl http://www.kvirc.net/?id=mailinglist", diff --git a/src/kvirc/kernel/kvi_ircconnection.cpp b/src/kvirc/kernel/kvi_ircconnection.cpp index 12a007f9a..f3e25eecc 100644 --- a/src/kvirc/kernel/kvi_ircconnection.cpp +++ b/src/kvirc/kernel/kvi_ircconnection.cpp @@ -41,7 +41,7 @@ #include "KviLocale.h" #include "KviIrcServerDataBase.h" #include "KviProxyDataBase.h" -#include "kvi_error.h" +#include "KviError.h" #include "kvi_out.h" #include "kvi_options.h" #include "kvi_console.h" @@ -74,7 +74,7 @@ #include #include -extern KVIRC_API KviServerDataBase * g_pServerDataBase; +extern KVIRC_API KviIrcServerDataBase * g_pServerDataBase; extern KVIRC_API KviProxyDataBase * g_pProxyDataBase; KviIrcConnection::KviIrcConnection(KviIrcContext * pContext,KviIrcConnectionTarget * pTarget,KviUserIdentity * pIdentity) @@ -1146,8 +1146,8 @@ void KviIrcConnection::useProfileData(KviIdentityProfileSet * pSet, const QStrin void KviIrcConnection::loginToIrcServer() { - KviServer * pServer = target()->server(); - KviNetwork * pNet = target()->network(); + KviIrcServer * pServer = target()->server(); + KviIrcNetwork * pNet = target()->network(); // For now this is the only we know m_pServerInfo->setName(pServer->m_szHostname); diff --git a/src/kvirc/kernel/kvi_ircconnection.h b/src/kvirc/kernel/kvi_ircconnection.h index e89eff30f..19f6e3111 100644 --- a/src/kvirc/kernel/kvi_ircconnection.h +++ b/src/kvirc/kernel/kvi_ircconnection.h @@ -41,8 +41,8 @@ class QTimer; class QTextCodec; class KviConsole; -class KviNetworkData; -class KviServer; +class KviIrcNetworkData; +class KviIrcServer; class KviProxy; class KviIrcSocket; class KviIrcLink; @@ -95,7 +95,7 @@ class KVIRC_API KviIrcConnection : public QObject friend class KviConsole; friend class KviIrcContext; friend class KviIrcLink; - friend class KviServerParser; + friend class KviIrcServerParser; Q_OBJECT protected: /** @@ -723,7 +723,7 @@ protected: void loginToIrcServer(); // - // KviServerParser interface + // KviIrcServerParser interface // /** diff --git a/src/kvirc/kernel/kvi_ircconnectionserverinfo.h b/src/kvirc/kernel/kvi_ircconnectionserverinfo.h index a11f48243..e61841155 100644 --- a/src/kvirc/kernel/kvi_ircconnectionserverinfo.h +++ b/src/kvirc/kernel/kvi_ircconnectionserverinfo.h @@ -158,7 +158,7 @@ public: class KVIRC_API KviIrcConnectionServerInfo { friend class KviConsole; // for now - friend class KviServerParser; + friend class KviIrcServerParser; friend class KviIrcConnection; protected: KviIrcConnectionServerInfo(); diff --git a/src/kvirc/kernel/kvi_ircconnectionstatedata.h b/src/kvirc/kernel/kvi_ircconnectionstatedata.h index 2fe613b99..3a8f6507a 100644 --- a/src/kvirc/kernel/kvi_ircconnectionstatedata.h +++ b/src/kvirc/kernel/kvi_ircconnectionstatedata.h @@ -40,7 +40,7 @@ class KVIRC_API KviIrcConnectionStateData { friend class KviIrcConnection; - friend class KviServerParser; + friend class KviIrcServerParser; friend class KviUserParser; public: KviIrcConnectionStateData(); diff --git a/src/kvirc/kernel/kvi_ircconnectiontarget.cpp b/src/kvirc/kernel/kvi_ircconnectiontarget.cpp index fdcf9a2e6..344ba1b37 100644 --- a/src/kvirc/kernel/kvi_ircconnectiontarget.cpp +++ b/src/kvirc/kernel/kvi_ircconnectiontarget.cpp @@ -26,18 +26,18 @@ #include "kvi_ircconnectiontarget.h" #include "KviIrcServer.h" -#include "KviNetwork.h" +#include "KviIrcNetwork.h" #include "KviProxyDataBase.h" KviIrcConnectionTarget::KviIrcConnectionTarget( - const KviNetwork * pNetwork, - const KviServer * pServer, + const KviIrcNetwork * pNetwork, + const KviIrcServer * pServer, const KviProxy * pProxy, const QString &szBindAddress ) { - m_pNetwork = new KviNetwork(*pNetwork); - m_pServer = new KviServer(*pServer); + m_pNetwork = new KviIrcNetwork(*pNetwork); + m_pServer = new KviIrcServer(*pServer); m_pProxy = pProxy ? new KviProxy(*pProxy) : NULL; m_szBindAddress = szBindAddress; } diff --git a/src/kvirc/kernel/kvi_ircconnectiontarget.h b/src/kvirc/kernel/kvi_ircconnectiontarget.h index 6db18e7b5..bc9b537b0 100644 --- a/src/kvirc/kernel/kvi_ircconnectiontarget.h +++ b/src/kvirc/kernel/kvi_ircconnectiontarget.h @@ -28,8 +28,8 @@ #include "KviQString.h" #include "KviHeapObject.h" -class KviNetwork; -class KviServer; +class KviIrcNetwork; +class KviIrcServer; class KviProxy; class KVIRC_API KviIrcConnectionTarget : public KviHeapObject @@ -39,26 +39,26 @@ public: // pServer is a shallow pointer: this class makes a copy of it internally, must NOT be null // pProxy may be null if a proxy is not desired. this class makes a copy of it internally KviIrcConnectionTarget( - const KviNetwork * pNetwork, - const KviServer * pServer, + const KviIrcNetwork * pNetwork, + const KviIrcServer * pServer, const KviProxy * pProxy = 0, const QString &szBindAddress = QString() ); ~KviIrcConnectionTarget(); private: - KviNetwork * m_pNetwork; // owned, never null, it's a COPY of the entry in the db - KviServer * m_pServer; // owned, never null, it's a COPY of the entry in the db + KviIrcNetwork * m_pNetwork; // owned, never null, it's a COPY of the entry in the db + KviIrcServer * m_pServer; // owned, never null, it's a COPY of the entry in the db KviProxy * m_pProxy; // owned, may be null, it's a COPY of the entry in the db QString m_szBindAddress; // forced bind address public: - KviServer * server() + KviIrcServer * server() { return m_pServer; } - KviNetwork * network() + KviIrcNetwork * network() { return m_pNetwork; } @@ -82,7 +82,7 @@ public: const QString & networkName(); // this allows to force the network name: it should be used only by KviConsole - // but it's KviServerParser (kvi_sp_numeric.cpp) that first + // but it's KviIrcServerParser (kvi_sp_numeric.cpp) that first // gets the new network name... thus we make it public // to remove one level of indirection. void setNetworkName(const QString &szNetName); diff --git a/src/kvirc/kernel/kvi_ircconnectiontargetresolver.cpp b/src/kvirc/kernel/kvi_ircconnectiontargetresolver.cpp index 8185436d7..438f6d471 100644 --- a/src/kvirc/kernel/kvi_ircconnectiontargetresolver.cpp +++ b/src/kvirc/kernel/kvi_ircconnectiontargetresolver.cpp @@ -29,7 +29,7 @@ #include "KviLocale.h" #include "KviIrcServerDataBase.h" #include "KviProxyDataBase.h" -#include "kvi_error.h" +#include "KviError.h" #include "kvi_out.h" #include "kvi_options.h" #include "kvi_ircsocket.h" @@ -45,14 +45,14 @@ #include "kvi_ircconnection.h" #include "kvi_ircconnectiontarget.h" #include "kvi_ircsocket.h" -#include "kvi_error.h" +#include "KviError.h" #include "kvi_debug.h" #include #include -extern KVIRC_API KviServerDataBase * g_pServerDataBase; +extern KVIRC_API KviIrcServerDataBase * g_pServerDataBase; extern KVIRC_API KviProxyDataBase * g_pProxyDataBase; //extern KVIRC_API KviGarbageCollector * g_pGarbageCollector; diff --git a/src/kvirc/kernel/kvi_ircconnectionuserinfo.h b/src/kvirc/kernel/kvi_ircconnectionuserinfo.h index 694c33359..ab4a707f2 100644 --- a/src/kvirc/kernel/kvi_ircconnectionuserinfo.h +++ b/src/kvirc/kernel/kvi_ircconnectionuserinfo.h @@ -31,7 +31,7 @@ class KVIRC_API KviIrcConnectionUserInfo { friend class KviIrcConnection; - friend class KviServerParser; + friend class KviIrcServerParser; friend class KviConsole; protected: KviIrcConnectionUserInfo(); diff --git a/src/kvirc/kernel/kvi_irccontext.cpp b/src/kvirc/kernel/kvi_irccontext.cpp index fb453d711..ca69c1c1c 100644 --- a/src/kvirc/kernel/kvi_irccontext.cpp +++ b/src/kvirc/kernel/kvi_irccontext.cpp @@ -45,7 +45,7 @@ #include "kvi_options.h" #include "KviLocale.h" #include "kvi_ircdatastreammonitor.h" -#include "kvi_error.h" +#include "KviError.h" #include "KviThread.h" // for KviThread::msleep() #include "kvi_app.h" #include "kvi_kvs_eventtriggers.h" @@ -63,7 +63,7 @@ // the irc context identifiers start from 1 static unsigned int g_uNextIrcContextId = 1; -extern KVIRC_API KviServerDataBase * g_pServerDataBase; +extern KVIRC_API KviIrcServerDataBase * g_pServerDataBase; extern KVIRC_API KviProxyDataBase * g_pProxyDataBase; @@ -435,7 +435,7 @@ void KviIrcContext::connectToCurrentServer() m_pAsynchronousConnectionData->bUseSSL = m_pSavedAsynchronousConnectionData->bUseSSL; m_pAsynchronousConnectionData->bSTARTTLS = m_pSavedAsynchronousConnectionData->bSTARTTLS; if(m_pSavedAsynchronousConnectionData->m_pReconnectInfo) - m_pAsynchronousConnectionData->m_pReconnectInfo = new KviServerReconnectInfo(*(m_pSavedAsynchronousConnectionData->m_pReconnectInfo)); + m_pAsynchronousConnectionData->m_pReconnectInfo = new KviIrcServerReconnectInfo(*(m_pSavedAsynchronousConnectionData->m_pReconnectInfo)); else m_pAsynchronousConnectionData->m_pReconnectInfo = 0; // and the other info, only if not overridden by the user @@ -458,7 +458,7 @@ void KviIrcContext::connectToCurrentServer() // !m_pAsynchronousConnectionData->szServer.isEmpty() // ok, have a server to look for in the db // FIXME: this is a bit ugly... could it be managed in some completly different and nicer way ? - KviServerDefinition d; + KviIrcServerDefinition d; d.szServer = m_pAsynchronousConnectionData->szServer; d.bPortIsValid = m_pAsynchronousConnectionData->bPortIsOk; d.uPort = m_pAsynchronousConnectionData->uPort; @@ -480,15 +480,15 @@ void KviIrcContext::connectToCurrentServer() } // else we just connect to the globally selected irc server in the options dialog } - KviNetwork * net = g_pServerDataBase->currentNetwork(); - KviServer * srv = net ? net->currentServer() : 0; + KviIrcNetwork * net = g_pServerDataBase->currentNetwork(); + KviIrcServer * srv = net ? net->currentServer() : 0; KviProxy * prx = 0; if(!srv) { if(g_pServerDataBase->networkCount()) - KviKvsScript::run("options.edit KviServerOptionsWidget",m_pConsole); + KviKvsScript::run("options.edit KviIrcServerOptionsWidget",m_pConsole); else m_pConsole->outputNoFmt(KVI_OUT_SYSTEMERROR,__tr2qs("No servers available. Check the options dialog or use the /SERVER command")); destroyAsynchronousConnectionData(); @@ -522,7 +522,7 @@ void KviIrcContext::connectToCurrentServer() { szBindAddress = m_pAsynchronousConnectionData->szBindAddress; if(m_pAsynchronousConnectionData->m_pReconnectInfo) - srv->m_pReconnectInfo = new KviServerReconnectInfo(*(m_pAsynchronousConnectionData->m_pReconnectInfo)); + srv->m_pReconnectInfo = new KviIrcServerReconnectInfo(*(m_pAsynchronousConnectionData->m_pReconnectInfo)); } // Find out the identity we'll be using in this connection @@ -581,7 +581,7 @@ void KviIrcContext::connectToCurrentServer() m_pSavedAsynchronousConnectionData->szServerId = srv->id(); m_pSavedAsynchronousConnectionData->szInitUMode = srv->m_szInitUMode; if(srv->m_pReconnectInfo) - m_pSavedAsynchronousConnectionData->m_pReconnectInfo = new KviServerReconnectInfo(*(srv->m_pReconnectInfo)); + m_pSavedAsynchronousConnectionData->m_pReconnectInfo = new KviIrcServerReconnectInfo(*(srv->m_pReconnectInfo)); else m_pSavedAsynchronousConnectionData->m_pReconnectInfo = 0; // this never fails! @@ -623,7 +623,7 @@ void KviIrcContext::connectionFailed(int iError) m_pConsole->outputNoFmt(KVI_OUT_SYSTEMMESSAGE,tmp); } - KviServer oldServer(*(connection()->target()->server())); + KviIrcServer oldServer(*(connection()->target()->server())); QString oldNickname = connection()->userInfo()->isAway() ? connection()->userInfo()->nickNameBeforeAway() : connection()->userInfo()->nickName(); KviAsynchronousConnectionData * d = new KviAsynchronousConnectionData(); @@ -701,22 +701,22 @@ void KviIrcContext::connectionEstabilished() // save the last server this console used //if(m_pLastIrcServer)delete m_pLastIrcServer; - //m_pLastIrcServer = new KviServer(*(connection()->server())); + //m_pLastIrcServer = new KviIrcServer(*(connection()->server())); } void KviIrcContext::connectionTerminated() { if(!m_pConnection)return; // this may happen in the destructor! - KviServer oldServer(*(connection()->target()->server())); + KviIrcServer oldServer(*(connection()->target()->server())); if(oldServer.m_pReconnectInfo) { - KviServerReconnectInfo *pOldInfo = oldServer.m_pReconnectInfo; + KviIrcServerReconnectInfo *pOldInfo = oldServer.m_pReconnectInfo; oldServer.m_pReconnectInfo = 0; delete pOldInfo; } - KviServerReconnectInfo info, *pInfo(&info); + KviIrcServerReconnectInfo info, *pInfo(&info); pInfo->m_szNick = connection()->userInfo()->isAway() ? connection()->userInfo()->nickNameBeforeAway() : connection()->userInfo()->nickName(); pInfo->m_szPass = connection()->userInfo()->password(); pInfo->m_bIsAway = connection()->userInfo()->isAway(); @@ -821,7 +821,7 @@ void KviIrcContext::connectionTerminated() d->bSTARTTLS = oldServer.enabledSTARTTLS(); d->szPass = oldServer.password(); d->szInitUMode = oldServer.m_szInitUMode; - d->m_pReconnectInfo = new KviServerReconnectInfo(*(pInfo)); + d->m_pReconnectInfo = new KviIrcServerReconnectInfo(*(pInfo)); setAsynchronousConnectionData(d); beginAsynchronousConnect(1000 * KVI_OPTION_UINT(KviOption_uintAutoReconnectDelay)); diff --git a/src/kvirc/kernel/kvi_irccontext.h b/src/kvirc/kernel/kvi_irccontext.h index 49d354b14..581b02d16 100644 --- a/src/kvirc/kernel/kvi_irccontext.h +++ b/src/kvirc/kernel/kvi_irccontext.h @@ -39,8 +39,8 @@ class KviIrcDataStreamMonitor; class KviWindow; class QTimer; class KviConsole; -class KviNetwork; -class KviServer; +class KviIrcNetwork; +class KviIrcServer; /* KviIrcContext is the structure that groups the objects and resources usable for a single irc connection: a console, a set of channels and queries, diff --git a/src/kvirc/kernel/kvi_irclink.cpp b/src/kvirc/kernel/kvi_irclink.cpp index 331b2cc12..4c7b77d63 100644 --- a/src/kvirc/kernel/kvi_irclink.cpp +++ b/src/kvirc/kernel/kvi_irclink.cpp @@ -28,7 +28,7 @@ #include "KviLocale.h" #include "KviIrcServerDataBase.h" #include "KviProxyDataBase.h" -#include "kvi_error.h" +#include "KviError.h" #include "kvi_out.h" #include "kvi_options.h" #include "kvi_ircsocket.h" @@ -49,7 +49,7 @@ #include -extern KVIRC_API KviServerDataBase * g_pServerDataBase; +extern KVIRC_API KviIrcServerDataBase * g_pServerDataBase; extern KVIRC_API KviProxyDataBase * g_pProxyDataBase; //extern KVIRC_API KviGarbageCollector * g_pGarbageCollector; diff --git a/src/kvirc/kernel/kvi_irclink.h b/src/kvirc/kernel/kvi_irclink.h index 9989fd81b..719006778 100644 --- a/src/kvirc/kernel/kvi_irclink.h +++ b/src/kvirc/kernel/kvi_irclink.h @@ -36,7 +36,7 @@ #include class KviConsole; -class KviServer; +class KviIrcServer; class KviProxy; class KviIrcSocket; class KviDnsResolver; diff --git a/src/kvirc/kernel/kvi_ircsocket.cpp b/src/kvirc/kernel/kvi_ircsocket.cpp index 7e42e2f71..55ab56cf1 100644 --- a/src/kvirc/kernel/kvi_ircsocket.cpp +++ b/src/kvirc/kernel/kvi_ircsocket.cpp @@ -28,7 +28,7 @@ #include "KviProxyDataBase.h" #include "KviNetUtils.h" #include "kvi_settings.h" -#include "kvi_error.h" +#include "KviError.h" #include "KviLocale.h" #include "KviMemory.h" #include "kvi_debug.h" @@ -251,7 +251,7 @@ void KviIrcSocket::raiseError(int iError) outputSocketError(KviError::getDescription(iError)); } -int KviIrcSocket::startConnection(KviServer * pServer, KviProxy * pProxy, const char * pcBindAddress) +int KviIrcSocket::startConnection(KviIrcServer * pServer, KviProxy * pProxy, const char * pcBindAddress) { // Attempts to estabilish an IRC connection // to the server specified by *srv. @@ -270,7 +270,7 @@ int KviIrcSocket::startConnection(KviServer * pServer, KviProxy * pProxy, const } // Copy the server - m_pIrcServer = new KviServer(*pServer); + m_pIrcServer = new KviIrcServer(*pServer); bool bTargetIPv6 = false; bool bNeedServerIp = !pProxy; diff --git a/src/kvirc/kernel/kvi_ircsocket.h b/src/kvirc/kernel/kvi_ircsocket.h index a7a185d3e..face64d84 100644 --- a/src/kvirc/kernel/kvi_ircsocket.h +++ b/src/kvirc/kernel/kvi_ircsocket.h @@ -40,7 +40,7 @@ class QTimer; class QSocketNotifier; -class KviServer; +class KviIrcServer; class KviProxy; class KviIrcConnection; class KviIrcConnectionTarget; @@ -107,7 +107,7 @@ protected: SocketState m_state; QSocketNotifier * m_pWsn; QSocketNotifier * m_pRsn; - KviServer * m_pIrcServer; + KviIrcServer * m_pIrcServer; KviProxy * m_pProxy; QTimer * m_pTimeoutTimer; unsigned int m_uReadBytes; @@ -195,7 +195,7 @@ public: * \param pcBindAddress The address to bind the connection to * \return int */ - int startConnection(KviServer * pServer, KviProxy * pProxy = 0, const char * pcBindAddress = 0); + int startConnection(KviIrcServer * pServer, KviProxy * pProxy = 0, const char * pcBindAddress = 0); #ifdef COMPILE_SSL_SUPPORT /** diff --git a/src/kvirc/kernel/kvi_ircurl.cpp b/src/kvirc/kernel/kvi_ircurl.cpp index 3cbbba160..f227f4b09 100644 --- a/src/kvirc/kernel/kvi_ircurl.cpp +++ b/src/kvirc/kernel/kvi_ircurl.cpp @@ -212,7 +212,7 @@ void KviIrcUrl::split(QString url, KviIrcUrlParts& result) } -void KviIrcUrl::join(QString &uri, KviServer* server) +void KviIrcUrl::join(QString &uri, KviIrcServer* server) { if(server) { @@ -314,7 +314,7 @@ int KviIrcUrl::run(const QString& text,int contextSpec,KviConsole* pConsole) szCommand.append(QString("%1 %2 ").arg(parts.szHost).arg(parts.iPort)); if(pConsole->connection()) { - KviServer* server = pConsole->connection()->target()->server(); + KviIrcServer* server = pConsole->connection()->target()->server(); if( ( server->hostName() != parts.szHost ) || ( server->port() != parts.iPort ) || diff --git a/src/kvirc/kernel/kvi_ircurl.h b/src/kvirc/kernel/kvi_ircurl.h index e6a8c3647..ddf281134 100644 --- a/src/kvirc/kernel/kvi_ircurl.h +++ b/src/kvirc/kernel/kvi_ircurl.h @@ -28,7 +28,7 @@ #include "KviCString.h" #include "kvi_inttypes.h" -class KviServer; +class KviIrcServer; class KviConsole; #include @@ -72,7 +72,7 @@ namespace KviIrcUrl extern KVIRC_API int run(const QString& url,int contextSpec = FirstFreeContext,KviConsole* pConsole = 0); extern KVIRC_API void split(QString url, KviIrcUrlParts& parts); - extern KVIRC_API void join(QString &url, KviServer* server); + extern KVIRC_API void join(QString &url, KviIrcServer* server); extern KVIRC_API void makeJoinCmd(const QStringList& chans, QString& szJoinCommand); } diff --git a/src/kvirc/kernel/kvi_main.cpp b/src/kvirc/kernel/kvi_main.cpp index a4dddd253..03bcc75c1 100644 --- a/src/kvirc/kernel/kvi_main.cpp +++ b/src/kvirc/kernel/kvi_main.cpp @@ -31,7 +31,7 @@ #include "kvi_defaults.h" #include "kvi_sourcesdate.h" #include "kvi_msgbox.h" -#include "kvi_buildinfo.h" +#include "KviBuildInfo.h" #ifdef COMPILE_DBUS_SUPPORT #ifndef COMPILE_KDE_SUPPORT // 'cause kde adds an interface itself #include "KviDbusAdaptor.h" diff --git a/src/kvirc/kernel/kvi_notifylist.h b/src/kvirc/kernel/kvi_notifylist.h index f3a2e09ee..01ac0963c 100644 --- a/src/kvirc/kernel/kvi_notifylist.h +++ b/src/kvirc/kernel/kvi_notifylist.h @@ -43,7 +43,7 @@ class KVIRC_API KviNotifyListManager : public QObject { friend class KviConsole; friend class KviConnectionInfo; - friend class KviServerParser; + friend class KviIrcServerParser; friend class KviIrcConnection; Q_OBJECT protected: @@ -67,7 +67,7 @@ public: class KVIRC_API KviIsOnNotifyListManager : public KviNotifyListManager { friend class KviConsole; - friend class KviServerParser; + friend class KviIrcServerParser; friend class KviIrcConnection; Q_OBJECT protected: @@ -115,7 +115,7 @@ private slots: class KVIRC_API KviStupidNotifyListManager : public KviNotifyListManager { friend class KviConsole; - friend class KviServerParser; + friend class KviIrcServerParser; friend class KviIrcConnection; Q_OBJECT protected: @@ -140,7 +140,7 @@ private: class KVIRC_API KviWatchNotifyListManager : public KviNotifyListManager { friend class KviConsole; - friend class KviServerParser; + friend class KviIrcServerParser; friend class KviIrcConnection; Q_OBJECT public: diff --git a/src/kvirc/kvs/kvi_kvs_asyncdnsoperation.cpp b/src/kvirc/kvs/kvi_kvs_asyncdnsoperation.cpp index c06bb0c9d..98b6afe3c 100644 --- a/src/kvirc/kvs/kvi_kvs_asyncdnsoperation.cpp +++ b/src/kvirc/kvs/kvi_kvs_asyncdnsoperation.cpp @@ -31,7 +31,7 @@ #include "kvi_app.h" #include "kvi_out.h" #include "KviLocale.h" -#include "kvi_error.h" +#include "KviError.h" #include "kvi_kvs_variantlist.h" #include diff --git a/src/kvirc/kvs/kvi_kvs_corefunctions_sz.cpp b/src/kvirc/kvs/kvi_kvs_corefunctions_sz.cpp index 0217b3f3c..b3b95de72 100644 --- a/src/kvirc/kvs/kvi_kvs_corefunctions_sz.cpp +++ b/src/kvirc/kvs/kvi_kvs_corefunctions_sz.cpp @@ -43,7 +43,7 @@ #include "KviMircCntrl.h" #include "kvi_sourcesdate.h" #include "kvi_socket.h" -#include "kvi_buildinfo.h" +#include "KviBuildInfo.h" #include // rand & srand diff --git a/src/kvirc/kvs/kvi_kvs_coresimplecommands_sz.cpp b/src/kvirc/kvs/kvi_kvs_coresimplecommands_sz.cpp index ec63ba773..c28fea954 100644 --- a/src/kvirc/kvs/kvi_kvs_coresimplecommands_sz.cpp +++ b/src/kvirc/kvs/kvi_kvs_coresimplecommands_sz.cpp @@ -278,7 +278,7 @@ namespace KviKvsCoreSimpleCommands d->szNick = szNick; d->szLinkFilter = szSocketFilter; - d->m_pReconnectInfo = new KviServerReconnectInfo(); + d->m_pReconnectInfo = new KviIrcServerReconnectInfo(); d->m_pReconnectInfo->m_szNick = szNick; d->m_pReconnectInfo->m_szPass = szPassword; @@ -304,7 +304,7 @@ namespace KviKvsCoreSimpleCommands d->szPass = szPassword; d->szNick = szNick; - d->m_pReconnectInfo = new KviServerReconnectInfo(); + d->m_pReconnectInfo = new KviIrcServerReconnectInfo(); d->m_pReconnectInfo->m_szNick = szNick; d->m_pReconnectInfo->m_szPass = szPassword; diff --git a/src/kvirc/kvs/kvi_kvs_dnsmanager.cpp b/src/kvirc/kvs/kvi_kvs_dnsmanager.cpp index 217b18fec..6debb72eb 100644 --- a/src/kvirc/kvs/kvi_kvs_dnsmanager.cpp +++ b/src/kvirc/kvs/kvi_kvs_dnsmanager.cpp @@ -32,7 +32,7 @@ #include "kvi_kvs_variantlist.h" #include "KviCString.h" #include "KviLocale.h" -#include "kvi_error.h" +#include "KviError.h" KviKvsDnsManager * KviKvsDnsManager::m_pInstance = 0; diff --git a/src/kvirc/kvs/kvi_kvs_object.cpp b/src/kvirc/kvs/kvi_kvs_object.cpp index 0cc0247b7..356919a49 100644 --- a/src/kvirc/kvs/kvi_kvs_object.cpp +++ b/src/kvirc/kvs/kvi_kvs_object.cpp @@ -31,7 +31,7 @@ #include "kvi_modulemanager.h" #include "kvi_console.h" #include "KviLocale.h" -#include "kvi_error.h" +#include "KviError.h" #include "kvi_out.h" #include "KviMircCntrl.h" #include "kvi_iconmanager.h" diff --git a/src/kvirc/module/kvi_mexserverimport.h b/src/kvirc/module/kvi_mexserverimport.h index 07a458e38..d096ed5fc 100644 --- a/src/kvirc/module/kvi_mexserverimport.h +++ b/src/kvirc/module/kvi_mexserverimport.h @@ -40,7 +40,7 @@ public: virtual void start() = 0; virtual void die() = 0; signals: - void server(const KviServer &s,const QString &network); + void server(const KviIrcServer &s,const QString &network); }; #endif //!_KVI_MEXSERVERIMPORT_H_ diff --git a/src/kvirc/sparser/kvi_sp_ctcp.cpp b/src/kvirc/sparser/kvi_sp_ctcp.cpp index 33bad23a1..62eae4f44 100644 --- a/src/kvirc/sparser/kvi_sp_ctcp.cpp +++ b/src/kvirc/sparser/kvi_sp_ctcp.cpp @@ -55,7 +55,7 @@ #include "kvi_kvs_script.h" #include "kvi_sourcesdate.h" #include "KviRegisteredUserDataBase.h" -#include "kvi_buildinfo.h" +#include "KviBuildInfo.h" #include @@ -384,7 +384,7 @@ extern KVIRC_API KviCtcpPageDialog * g_pCtcpPageDialog; -void KviServerParser::encodeCtcpParameter(const char * param,KviCString &buffer,bool bSpaceBreaks) +void KviIrcServerParser::encodeCtcpParameter(const char * param,KviCString &buffer,bool bSpaceBreaks) { // // This one encodes a single ctcp parameter with the simplest @@ -455,7 +455,7 @@ void KviServerParser::encodeCtcpParameter(const char * param,KviCString &buffer, if(param != begin)buffer.append(begin,param - begin); } -void KviServerParser::encodeCtcpParameter(const char * parametr,QString &resultBuffer,bool bSpaceBreaks) +void KviIrcServerParser::encodeCtcpParameter(const char * parametr,QString &resultBuffer,bool bSpaceBreaks) { // // This one encodes a single ctcp parameter with the simplest @@ -522,7 +522,7 @@ void KviServerParser::encodeCtcpParameter(const char * parametr,QString &resultB -const char * KviServerParser::decodeCtcpEscape(const char * msg_ptr,KviCString &buffer) +const char * KviIrcServerParser::decodeCtcpEscape(const char * msg_ptr,KviCString &buffer) { // // This one decodes an octal sequence @@ -574,7 +574,7 @@ const char * KviServerParser::decodeCtcpEscape(const char * msg_ptr,KviCString & } -const char * KviServerParser::decodeCtcpEscape(const char * msg_ptr,QByteArray &buffer) +const char * KviIrcServerParser::decodeCtcpEscape(const char * msg_ptr,QByteArray &buffer) { // // This one decodes an octal sequence @@ -624,7 +624,7 @@ const char * KviServerParser::decodeCtcpEscape(const char * msg_ptr,QByteArray & } -const char * KviServerParser::extractCtcpParameter(const char * msg_ptr,KviCString &buffer,bool bSpaceBreaks, bool bSafeOnly) +const char * KviIrcServerParser::extractCtcpParameter(const char * msg_ptr,KviCString &buffer,bool bSpaceBreaks, bool bSafeOnly) { // // This one extracts the "next" ctcp parameter in msg_ptr @@ -712,7 +712,7 @@ const char * KviServerParser::extractCtcpParameter(const char * msg_ptr,KviCStri return msg_ptr; } -const char * KviServerParser::extractCtcpParameter(const char * p_msg_ptr,QString &resultBuffer,bool bSpaceBreaks, bool bSafeOnly) +const char * KviIrcServerParser::extractCtcpParameter(const char * p_msg_ptr,QString &resultBuffer,bool bSpaceBreaks, bool bSafeOnly) { // // This one extracts the "next" ctcp parameter in p_msg_ptr @@ -803,7 +803,7 @@ const char * KviServerParser::extractCtcpParameter(const char * p_msg_ptr,QStrin } -void KviServerParser::parseCtcpRequest(KviCtcpMessage *msg) +void KviIrcServerParser::parseCtcpRequest(KviCtcpMessage *msg) { msg->pData = extractCtcpParameter(msg->pData,msg->szTag); @@ -892,7 +892,7 @@ void KviServerParser::parseCtcpRequest(KviCtcpMessage *msg) echoCtcpRequest(msg); } -void KviServerParser::parseCtcpReply(KviCtcpMessage *msg) +void KviIrcServerParser::parseCtcpReply(KviCtcpMessage *msg) { msg->pData = extractCtcpParameter(msg->pData,msg->szTag); @@ -926,7 +926,7 @@ void KviServerParser::parseCtcpReply(KviCtcpMessage *msg) // Ctcp message handlers -bool KviServerParser::checkCtcpFlood(KviCtcpMessage *msg) +bool KviIrcServerParser::checkCtcpFlood(KviCtcpMessage *msg) { if(!KVI_OPTION_BOOL(KviOption_boolUseCtcpFloodProtection))return false; @@ -953,7 +953,7 @@ bool KviServerParser::checkCtcpFlood(KviCtcpMessage *msg) } -void KviServerParser::replyCtcp(KviCtcpMessage *msg,const QString &data) +void KviIrcServerParser::replyCtcp(KviCtcpMessage *msg,const QString &data) { QByteArray szNick = msg->msg->connection()->encodeText(msg->pSource->nick()); msg->msg->connection()->sendFmtData( @@ -966,7 +966,7 @@ void KviServerParser::replyCtcp(KviCtcpMessage *msg,const QString &data) ); } -void KviServerParser::echoCtcpReply(KviCtcpMessage * msg) +void KviIrcServerParser::echoCtcpReply(KviCtcpMessage * msg) { if(!msg->msg->haltOutput()) { @@ -999,7 +999,7 @@ void KviServerParser::echoCtcpReply(KviCtcpMessage * msg) } -void KviServerParser::echoCtcpRequest(KviCtcpMessage *msg) +void KviIrcServerParser::echoCtcpRequest(KviCtcpMessage *msg) { // FIXME: #warning "DEDICATED CTCP WINDOW...MINIMIZED ?" if(!msg->msg->haltOutput()) @@ -1054,7 +1054,7 @@ void KviServerParser::echoCtcpRequest(KviCtcpMessage *msg) -void KviServerParser::parseCtcpRequestPing(KviCtcpMessage *msg) +void KviIrcServerParser::parseCtcpRequestPing(KviCtcpMessage *msg) { if(!checkCtcpFlood(msg)) { @@ -1067,7 +1067,7 @@ void KviServerParser::parseCtcpRequestPing(KviCtcpMessage *msg) echoCtcpRequest(msg); } -void KviServerParser::parseCtcpReplyPing(KviCtcpMessage * msg) +void KviIrcServerParser::parseCtcpReplyPing(KviCtcpMessage * msg) { if(!msg->msg->haltOutput()) { @@ -1143,7 +1143,7 @@ void KviServerParser::parseCtcpReplyPing(KviCtcpMessage * msg) } -void KviServerParser::parseCtcpRequestVersion(KviCtcpMessage *msg) +void KviIrcServerParser::parseCtcpRequestVersion(KviCtcpMessage *msg) { if(!checkCtcpFlood(msg)) { @@ -1182,7 +1182,7 @@ void KviServerParser::parseCtcpRequestVersion(KviCtcpMessage *msg) echoCtcpRequest(msg); } -void KviServerParser::parseCtcpRequestUserinfo(KviCtcpMessage *msg) +void KviIrcServerParser::parseCtcpRequestUserinfo(KviCtcpMessage *msg) { if(!checkCtcpFlood(msg)) { @@ -1246,7 +1246,7 @@ static const char * ctcpTagTable[][2]= { 0 , 0 } }; -void KviServerParser::parseCtcpRequestClientinfo(KviCtcpMessage *msg) +void KviIrcServerParser::parseCtcpRequestClientinfo(KviCtcpMessage *msg) { // this is completely latin1 if(!checkCtcpFlood(msg)) @@ -1291,7 +1291,7 @@ void KviServerParser::parseCtcpRequestClientinfo(KviCtcpMessage *msg) echoCtcpRequest(msg); } -void KviServerParser::parseCtcpRequestFinger(KviCtcpMessage *msg) +void KviIrcServerParser::parseCtcpRequestFinger(KviCtcpMessage *msg) { // completely latin1 atm if(!checkCtcpFlood(msg)) @@ -1310,7 +1310,7 @@ void KviServerParser::parseCtcpRequestFinger(KviCtcpMessage *msg) echoCtcpRequest(msg); } -void KviServerParser::parseCtcpRequestSource(KviCtcpMessage *msg) +void KviIrcServerParser::parseCtcpRequestSource(KviCtcpMessage *msg) { if(!checkCtcpFlood(msg)) { @@ -1329,7 +1329,7 @@ void KviServerParser::parseCtcpRequestSource(KviCtcpMessage *msg) echoCtcpRequest(msg); } -void KviServerParser::parseCtcpRequestTime(KviCtcpMessage *msg) +void KviIrcServerParser::parseCtcpRequestTime(KviCtcpMessage *msg) { if(!checkCtcpFlood(msg)) { @@ -1356,7 +1356,7 @@ void KviServerParser::parseCtcpRequestTime(KviCtcpMessage *msg) echoCtcpRequest(msg); } -void KviServerParser::parseCtcpRequestPage(KviCtcpMessage *msg) +void KviIrcServerParser::parseCtcpRequestPage(KviCtcpMessage *msg) { if(!checkCtcpFlood(msg)) { @@ -1383,7 +1383,7 @@ void KviServerParser::parseCtcpRequestPage(KviCtcpMessage *msg) echoCtcpRequest(msg); } -void KviServerParser::parseCtcpRequestAction(KviCtcpMessage *msg) +void KviIrcServerParser::parseCtcpRequestAction(KviCtcpMessage *msg) { KviCString szData8; // CTCP ACTION is a special exception... most clients do not encode/decode it. @@ -1503,7 +1503,7 @@ void KviServerParser::parseCtcpRequestAction(KviCtcpMessage *msg) // FIXME: #warning "UTSNAME ?...AND OTHER INFO ?...SYSTEM IDLE TIME ?...KVIRC IDLE TIME ?" -void KviServerParser::parseCtcpRequestAvatar(KviCtcpMessage *msg) +void KviIrcServerParser::parseCtcpRequestAvatar(KviCtcpMessage *msg) { // AVATAR if(!KVI_OPTION_BOOL(KviOption_boolIgnoreCtcpAvatar)) @@ -1567,7 +1567,7 @@ void KviServerParser::parseCtcpRequestAvatar(KviCtcpMessage *msg) } -void KviServerParser::parseCtcpReplyAvatar(KviCtcpMessage *msg) +void KviIrcServerParser::parseCtcpReplyAvatar(KviCtcpMessage *msg) { QString szRemoteFile; QString szGender; @@ -1714,7 +1714,7 @@ typedef void (*dccModuleCtcpDccParseRoutine)(KviDccRequest *par); -void KviServerParser::parseCtcpRequestDcc(KviCtcpMessage *msg) +void KviIrcServerParser::parseCtcpRequestDcc(KviCtcpMessage *msg) { KviDccRequest p; KviCString aux = msg->pData; @@ -1807,7 +1807,7 @@ void KviServerParser::parseCtcpRequestDcc(KviCtcpMessage *msg) } } -void KviServerParser::parseCtcpReplyUserinfo(KviCtcpMessage *msg) +void KviIrcServerParser::parseCtcpReplyUserinfo(KviCtcpMessage *msg) { QString szRemoteFile; QString szGender; @@ -1850,13 +1850,13 @@ void KviServerParser::parseCtcpReplyUserinfo(KviCtcpMessage *msg) echoCtcpReply(msg); } -void KviServerParser::parseCtcpReplyGeneric(KviCtcpMessage *msg) +void KviIrcServerParser::parseCtcpReplyGeneric(KviCtcpMessage *msg) { echoCtcpReply(msg); } -void KviServerParser::parseCtcpReplyLagcheck(KviCtcpMessage * msg) +void KviIrcServerParser::parseCtcpReplyLagcheck(KviCtcpMessage * msg) { // this is an internal CTCP used for checking lag KviCString szTag; diff --git a/src/kvirc/sparser/kvi_sp_literal.cpp b/src/kvirc/sparser/kvi_sp_literal.cpp index b173bd266..54fda159c 100644 --- a/src/kvirc/sparser/kvi_sp_literal.cpp +++ b/src/kvirc/sparser/kvi_sp_literal.cpp @@ -59,7 +59,7 @@ #include "kvi_lagmeter.h" #include "KviIrcServer.h" #include "kvi_kvs_eventtriggers.h" -#include "KviNetwork.h" +#include "KviIrcNetwork.h" #include "kvi_settings.h" #ifdef COMPILE_CRYPT_SUPPORT @@ -83,7 +83,7 @@ extern KviNickServRuleSet * g_pNickServRuleSet; // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void KviServerParser::parseLiteralPing(KviIrcMessage *msg) +void KviIrcServerParser::parseLiteralPing(KviIrcMessage *msg) { // PING // PING : @@ -108,7 +108,7 @@ void KviServerParser::parseLiteralPing(KviIrcMessage *msg) // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void KviServerParser::parseLiteralPong(KviIrcMessage *msg) +void KviIrcServerParser::parseLiteralPong(KviIrcMessage *msg) { QString szPrefix = msg->connection()->decodeText(msg->safePrefix()); QString szAllParams = msg->connection()->decodeText(msg->allParams()); @@ -136,7 +136,7 @@ void KviServerParser::parseLiteralPong(KviIrcMessage *msg) // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void KviServerParser::parseLiteralError(KviIrcMessage *msg) +void KviIrcServerParser::parseLiteralError(KviIrcMessage *msg) { // ERROR // ERROR : @@ -161,7 +161,7 @@ void KviServerParser::parseLiteralError(KviIrcMessage *msg) // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void KviServerParser::parseLiteralJoin(KviIrcMessage *msg) +void KviIrcServerParser::parseLiteralJoin(KviIrcMessage *msg) { // JOIN // : JOIN : @@ -302,7 +302,7 @@ void KviServerParser::parseLiteralJoin(KviIrcMessage *msg) // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void KviServerParser::parseLiteralPart(KviIrcMessage *msg) +void KviIrcServerParser::parseLiteralPart(KviIrcMessage *msg) { // PART // : PART : @@ -401,7 +401,7 @@ void KviServerParser::parseLiteralPart(KviIrcMessage *msg) // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void KviServerParser::parseLiteralQuit(KviIrcMessage *msg) +void KviIrcServerParser::parseLiteralQuit(KviIrcMessage *msg) { // QUIT // : QUIT : @@ -543,7 +543,7 @@ void KviServerParser::parseLiteralQuit(KviIrcMessage *msg) // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void KviServerParser::parseLiteralKick(KviIrcMessage *msg) +void KviIrcServerParser::parseLiteralKick(KviIrcMessage *msg) { // KICK // : KICK : @@ -701,7 +701,7 @@ enum PrivmsgIdentifyMsgCapState }; -void KviServerParser::parseLiteralPrivmsg(KviIrcMessage *msg) +void KviIrcServerParser::parseLiteralPrivmsg(KviIrcMessage *msg) { // PRIVMSG // :source PRIVMSG : @@ -1063,7 +1063,7 @@ void KviServerParser::parseLiteralPrivmsg(KviIrcMessage *msg) } -void KviServerParser::parseLiteralNotice(KviIrcMessage *msg) +void KviIrcServerParser::parseLiteralNotice(KviIrcMessage *msg) { // NOTICE // :source NOTICE : @@ -1407,7 +1407,7 @@ void KviServerParser::parseLiteralNotice(KviIrcMessage *msg) // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void KviServerParser::parseLiteralTopic(KviIrcMessage *msg) +void KviIrcServerParser::parseLiteralTopic(KviIrcMessage *msg) { // TOPIC // : TOPIC : @@ -1458,7 +1458,7 @@ void KviServerParser::parseLiteralTopic(KviIrcMessage *msg) } } -void KviServerParser::parseLiteralNick(KviIrcMessage *msg) +void KviIrcServerParser::parseLiteralNick(KviIrcMessage *msg) { // NICK // :source NICK @@ -1578,7 +1578,7 @@ void KviServerParser::parseLiteralNick(KviIrcMessage *msg) // FIXME: #warning "UPDATE ALL THE OTHER CONNECTION RELATED WINDOW CAPTIONS WHEN bIsMe!!" } -void KviServerParser::parseLiteralInvite(KviIrcMessage *msg) +void KviIrcServerParser::parseLiteralInvite(KviIrcMessage *msg) { // INVITE // :source INVITE @@ -1625,7 +1625,7 @@ void KviServerParser::parseLiteralInvite(KviIrcMessage *msg) } } -void KviServerParser::parseLiteralWallops(KviIrcMessage *msg) +void KviIrcServerParser::parseLiteralWallops(KviIrcMessage *msg) { // WALLOPS // :source WALLOPS :msg @@ -1646,7 +1646,7 @@ void KviServerParser::parseLiteralWallops(KviIrcMessage *msg) } } -void KviServerParser::parseUserMode(KviIrcMessage *msg,const char * modeflptr) +void KviIrcServerParser::parseUserMode(KviIrcMessage *msg,const char * modeflptr) { // changed my user mode bool bSet = true; @@ -1682,7 +1682,7 @@ void KviServerParser::parseUserMode(KviIrcMessage *msg,const char * modeflptr) -void KviServerParser::parseLiteralMode(KviIrcMessage *msg) +void KviIrcServerParser::parseLiteralMode(KviIrcMessage *msg) { // MODE // :source MODE target @@ -1721,7 +1721,7 @@ void KviServerParser::parseLiteralMode(KviIrcMessage *msg) } } -void KviServerParser::parseChannelMode(const QString &szNick,const QString &szUser,const QString &szHost,KviChannel * chan,KviCString &modefl,KviIrcMessage *msg,int curParam) +void KviIrcServerParser::parseChannelMode(const QString &szNick,const QString &szUser,const QString &szHost,KviChannel * chan,KviCString &modefl,KviIrcMessage *msg,int curParam) { bool bSet = true; // bIsMultiMode: +snt @@ -2136,7 +2136,7 @@ void KviServerParser::parseChannelMode(const QString &szNick,const QString &szUs } } -void KviServerParser::parseLiteralCap(KviIrcMessage *msg) +void KviIrcServerParser::parseLiteralCap(KviIrcMessage *msg) { // CAP // CAP LS @@ -2235,7 +2235,7 @@ void KviServerParser::parseLiteralCap(KviIrcMessage *msg) msg->console()->output(KVI_OUT_CAP,__tr2qs("Received unknown extended capability message: %Q %Q"),&szCmd,&szProtocols); } -void KviServerParser::parseLiteralAuthenticate(KviIrcMessage *msg) +void KviIrcServerParser::parseLiteralAuthenticate(KviIrcMessage *msg) { // :AUTHENTICATE + KviCString szAuth(msg->safeParam(0)); diff --git a/src/kvirc/sparser/kvi_sp_numeric.cpp b/src/kvirc/sparser/kvi_sp_numeric.cpp index 1c01fc4ca..d09294576 100644 --- a/src/kvirc/sparser/kvi_sp_numeric.cpp +++ b/src/kvirc/sparser/kvi_sp_numeric.cpp @@ -71,7 +71,7 @@ // FIXME: #warning "IN ALL OUTPUT ADD ESCAPE SEQUENCES!!!!" // FIXME: #warning "parseErrorUnknownModeChar() for modes e and I, parseErrorUnknownCommand for WATCH" -void KviServerParser::parseNumeric001(KviIrcMessage *msg) +void KviIrcServerParser::parseNumeric001(KviIrcMessage *msg) { // 001: RPL_WELCOME // :prefix 001 target :Welcome to the Internet Relay Network @@ -90,7 +90,7 @@ void KviServerParser::parseNumeric001(KviIrcMessage *msg) msg->console()->outputNoFmt(KVI_OUT_SERVERINFO,szText); } -void KviServerParser::parseNumeric002(KviIrcMessage *msg) +void KviIrcServerParser::parseNumeric002(KviIrcMessage *msg) { // 002: RPL_YOURHOST [I,E,U,D] // :prefix 002 target :Your host is , running version @@ -99,7 +99,7 @@ void KviServerParser::parseNumeric002(KviIrcMessage *msg) if(!msg->haltOutput())msg->console()->outputNoFmt(KVI_OUT_SERVERINFO,msg->connection()->decodeText(msg->safeTrailing())); } -void KviServerParser::parseNumeric003(KviIrcMessage *msg) +void KviIrcServerParser::parseNumeric003(KviIrcMessage *msg) { // 003: RPL_CREATED [I,E,U,D] // :prefix 003 target :This server was created @@ -108,7 +108,7 @@ void KviServerParser::parseNumeric003(KviIrcMessage *msg) if(!msg->haltOutput())msg->console()->outputNoFmt(KVI_OUT_SERVERINFO,msg->connection()->decodeText(msg->safeTrailing())); } -void KviServerParser::parseNumeric004(KviIrcMessage *msg) +void KviIrcServerParser::parseNumeric004(KviIrcMessage *msg) { // 004: RPL_MYINFO [I,E,U,D] // :prefix 004 target @@ -201,7 +201,7 @@ void KviServerParser::parseNumeric004(KviIrcMessage *msg) } } -void KviServerParser::parseNumeric005(KviIrcMessage *msg) +void KviIrcServerParser::parseNumeric005(KviIrcMessage *msg) { // 005: RPL_PROTOCTL [D] // :prefix 005 target .... :are available/supported on this server @@ -376,7 +376,7 @@ void KviServerParser::parseNumeric005(KviIrcMessage *msg) // } } -void KviServerParser::parseNumericMotd(KviIrcMessage *msg) +void KviIrcServerParser::parseNumericMotd(KviIrcMessage *msg) { // 372: RPL_MOTD [I,E,U,D] // :prefix 372 target : - @@ -396,7 +396,7 @@ void KviServerParser::parseNumericMotd(KviIrcMessage *msg) } } -void KviServerParser::parseNumericEndOfNames(KviIrcMessage *msg) +void KviIrcServerParser::parseNumericEndOfNames(KviIrcMessage *msg) { // 366: RPL_ENDOFNAMES [I,E,U,D] // :prefix 366 target :End of /NAMES list. @@ -420,7 +420,7 @@ void KviServerParser::parseNumericEndOfNames(KviIrcMessage *msg) } } -void KviServerParser::parseNumeric020(KviIrcMessage *msg) +void KviIrcServerParser::parseNumeric020(KviIrcMessage *msg) { // 020: RPL_CONNECTING //:irc.dotsrc.org 020 * :Please wait while we process your connection. @@ -434,7 +434,7 @@ void KviServerParser::parseNumeric020(KviIrcMessage *msg) } } -void KviServerParser::parseNumericNames(KviIrcMessage *msg) +void KviIrcServerParser::parseNumericNames(KviIrcMessage *msg) { // 353: RPL_NAMREPLY [I,E,U,D] // :prefix 353 target [=|*|@] : @@ -515,7 +515,7 @@ void KviServerParser::parseNumericNames(KviIrcMessage *msg) } } -void KviServerParser::parseNumericTopic(KviIrcMessage *msg) +void KviIrcServerParser::parseNumericTopic(KviIrcMessage *msg) { // 332: RPL_TOPIC [I,E,U,D] // :prefix 332 target : @@ -543,7 +543,7 @@ void KviServerParser::parseNumericTopic(KviIrcMessage *msg) } -void KviServerParser::parseNumericNoTopic(KviIrcMessage *msg) +void KviIrcServerParser::parseNumericNoTopic(KviIrcMessage *msg) { // 331: RPL_NOTOPIC [I,E,U,D] // :prefix 331 target :No topic is set @@ -565,7 +565,7 @@ void KviServerParser::parseNumericNoTopic(KviIrcMessage *msg) } } -void KviServerParser::parseNumericTopicWhoTime(KviIrcMessage *msg) +void KviIrcServerParser::parseNumericTopicWhoTime(KviIrcMessage *msg) { // 333: RPL_TOPICWHOTIME [e,U,D] // :prefix 333 target