From 2762acaf2ce4e5faf2ec67100696097fd630e17a Mon Sep 17 00:00:00 2001 From: Szymon Tomasz Stefanek Date: Mon, 27 Dec 2010 05:35:29 +0000 Subject: The kvs directory was way too big. Start reorganizing in subdirs. git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@5240 17fca916-40b9-46aa-a4ea-0a15b648b75c --- src/kvirc/CMakeLists.txt | 162 +- src/kvirc/kvs/KviKvsEvent.cpp | 78 - src/kvirc/kvs/KviKvsEvent.h | 54 - src/kvirc/kvs/KviKvsEventHandler.cpp | 76 - src/kvirc/kvs/KviKvsEventHandler.h | 106 - src/kvirc/kvs/KviKvsEventManager.cpp | 673 ---- src/kvirc/kvs/KviKvsEventManager.h | 123 - src/kvirc/kvs/KviKvsEventTable.cpp | 3804 ------------------- src/kvirc/kvs/KviKvsEventTable.h | 371 -- src/kvirc/kvs/KviKvsEventTriggers.h | 289 -- src/kvirc/kvs/KviKvsObject.cpp | 1814 --------- src/kvirc/kvs/KviKvsObject.h | 199 - src/kvirc/kvs/KviKvsObjectClass.cpp | 235 -- src/kvirc/kvs/KviKvsObjectClass.h | 112 - src/kvirc/kvs/KviKvsObjectController.cpp | 258 -- src/kvirc/kvs/KviKvsObjectController.h | 70 - src/kvirc/kvs/KviKvsObjectFunctionCall.cpp | 26 - src/kvirc/kvs/KviKvsObjectFunctionCall.h | 49 - src/kvirc/kvs/KviKvsObjectFunctionHandler.cpp | 59 - src/kvirc/kvs/KviKvsObjectFunctionHandler.h | 62 - src/kvirc/kvs/KviKvsObjectFunctionHandlerImpl.cpp | 147 - src/kvirc/kvs/KviKvsObjectFunctionHandlerImpl.h | 119 - src/kvirc/kvs/KviKvsParser.cpp | 3909 -------------------- src/kvirc/kvs/KviKvsParser.h | 303 -- src/kvirc/kvs/KviKvsParserMacros.h | 47 - src/kvirc/kvs/KviKvsParser_command.cpp | 348 -- src/kvirc/kvs/KviKvsParser_comment.cpp | 90 - src/kvirc/kvs/KviKvsParser_dollar.cpp | 321 -- src/kvirc/kvs/KviKvsParser_expression.cpp | 629 ---- src/kvirc/kvs/KviKvsParser_lside.cpp | 958 ----- src/kvirc/kvs/KviKvsParser_specialCommands.cpp | 2045 ---------- src/kvirc/kvs/KviKvsTreeNode.h | 378 -- src/kvirc/kvs/KviKvsTreeNodeAliasFunctionCall.cpp | 76 - src/kvirc/kvs/KviKvsTreeNodeAliasFunctionCall.h | 84 - src/kvirc/kvs/KviKvsTreeNodeAliasSimpleCommand.cpp | 122 - src/kvirc/kvs/KviKvsTreeNodeAliasSimpleCommand.h | 83 - src/kvirc/kvs/KviKvsTreeNodeArrayCount.cpp | 82 - src/kvirc/kvs/KviKvsTreeNodeArrayCount.h | 93 - src/kvirc/kvs/KviKvsTreeNodeArrayElement.cpp | 152 - src/kvirc/kvs/KviKvsTreeNodeArrayElement.h | 120 - src/kvirc/kvs/KviKvsTreeNodeArrayOrHashElement.cpp | 43 - src/kvirc/kvs/KviKvsTreeNodeArrayOrHashElement.h | 42 - .../kvs/KviKvsTreeNodeArrayReferenceAssert.cpp | 99 - src/kvirc/kvs/KviKvsTreeNodeArrayReferenceAssert.h | 118 - src/kvirc/kvs/KviKvsTreeNodeBase.cpp | 32 - src/kvirc/kvs/KviKvsTreeNodeBase.h | 102 - .../kvs/KviKvsTreeNodeBaseObjectFunctionCall.cpp | 60 - .../kvs/KviKvsTreeNodeBaseObjectFunctionCall.h | 50 - src/kvirc/kvs/KviKvsTreeNodeCallbackCommand.cpp | 61 - src/kvirc/kvs/KviKvsTreeNodeCallbackCommand.h | 48 - src/kvirc/kvs/KviKvsTreeNodeCommand.cpp | 65 - src/kvirc/kvs/KviKvsTreeNodeCommand.h | 54 - src/kvirc/kvs/KviKvsTreeNodeCommandEvaluation.cpp | 48 - src/kvirc/kvs/KviKvsTreeNodeCommandEvaluation.h | 46 - .../kvs/KviKvsTreeNodeCommandWithParameters.cpp | 58 - .../kvs/KviKvsTreeNodeCommandWithParameters.h | 49 - src/kvirc/kvs/KviKvsTreeNodeCompositeData.cpp | 82 - src/kvirc/kvs/KviKvsTreeNodeCompositeData.h | 46 - src/kvirc/kvs/KviKvsTreeNodeConstantData.cpp | 78 - src/kvirc/kvs/KviKvsTreeNodeConstantData.h | 50 - .../kvs/KviKvsTreeNodeCoreCallbackCommand.cpp | 70 - src/kvirc/kvs/KviKvsTreeNodeCoreCallbackCommand.h | 51 - src/kvirc/kvs/KviKvsTreeNodeCoreFunctionCall.cpp | 60 - src/kvirc/kvs/KviKvsTreeNodeCoreFunctionCall.h | 48 - src/kvirc/kvs/KviKvsTreeNodeCoreSimpleCommand.cpp | 68 - src/kvirc/kvs/KviKvsTreeNodeCoreSimpleCommand.h | 49 - src/kvirc/kvs/KviKvsTreeNodeData.cpp | 104 - src/kvirc/kvs/KviKvsTreeNodeData.h | 62 - src/kvirc/kvs/KviKvsTreeNodeDataList.cpp | 108 - src/kvirc/kvs/KviKvsTreeNodeDataList.h | 55 - src/kvirc/kvs/KviKvsTreeNodeExpression.cpp | 728 ---- src/kvirc/kvs/KviKvsTreeNodeExpression.h | 238 -- src/kvirc/kvs/KviKvsTreeNodeExpressionReturn.cpp | 58 - src/kvirc/kvs/KviKvsTreeNodeExpressionReturn.h | 45 - .../kvs/KviKvsTreeNodeExtendedScopeVariable.cpp | 77 - .../kvs/KviKvsTreeNodeExtendedScopeVariable.h | 45 - src/kvirc/kvs/KviKvsTreeNodeFunctionCall.cpp | 59 - src/kvirc/kvs/KviKvsTreeNodeFunctionCall.h | 47 - src/kvirc/kvs/KviKvsTreeNodeGlobalVariable.cpp | 61 - src/kvirc/kvs/KviKvsTreeNodeGlobalVariable.h | 45 - src/kvirc/kvs/KviKvsTreeNodeHashCount.cpp | 79 - src/kvirc/kvs/KviKvsTreeNodeHashCount.h | 47 - src/kvirc/kvs/KviKvsTreeNodeHashElement.cpp | 148 - src/kvirc/kvs/KviKvsTreeNodeHashElement.h | 52 - .../kvs/KviKvsTreeNodeHashReferenceAssert.cpp | 95 - src/kvirc/kvs/KviKvsTreeNodeHashReferenceAssert.h | 53 - src/kvirc/kvs/KviKvsTreeNodeIndirectData.cpp | 42 - src/kvirc/kvs/KviKvsTreeNodeIndirectData.h | 42 - src/kvirc/kvs/KviKvsTreeNodeInstruction.cpp | 36 - src/kvirc/kvs/KviKvsTreeNodeInstruction.h | 85 - src/kvirc/kvs/KviKvsTreeNodeInstructionBlock.cpp | 85 - src/kvirc/kvs/KviKvsTreeNodeInstructionBlock.h | 55 - src/kvirc/kvs/KviKvsTreeNodeLocalVariable.cpp | 70 - src/kvirc/kvs/KviKvsTreeNodeLocalVariable.h | 45 - .../kvs/KviKvsTreeNodeModuleCallbackCommand.cpp | 94 - .../kvs/KviKvsTreeNodeModuleCallbackCommand.h | 50 - src/kvirc/kvs/KviKvsTreeNodeModuleFunctionCall.cpp | 87 - src/kvirc/kvs/KviKvsTreeNodeModuleFunctionCall.h | 48 - .../kvs/KviKvsTreeNodeModuleSimpleCommand.cpp | 94 - src/kvirc/kvs/KviKvsTreeNodeModuleSimpleCommand.h | 48 - .../KviKvsTreeNodeMultipleParameterIdentifier.cpp | 87 - .../KviKvsTreeNodeMultipleParameterIdentifier.h | 49 - src/kvirc/kvs/KviKvsTreeNodeObjectField.cpp | 67 - src/kvirc/kvs/KviKvsTreeNodeObjectField.h | 47 - src/kvirc/kvs/KviKvsTreeNodeObjectFunctionCall.cpp | 54 - src/kvirc/kvs/KviKvsTreeNodeObjectFunctionCall.h | 45 - src/kvirc/kvs/KviKvsTreeNodeOperation.cpp | 1275 ------- src/kvirc/kvs/KviKvsTreeNodeOperation.h | 296 -- src/kvirc/kvs/KviKvsTreeNodeParameterReturn.cpp | 76 - src/kvirc/kvs/KviKvsTreeNodeParameterReturn.h | 45 - src/kvirc/kvs/KviKvsTreeNodeRebindingSwitch.cpp | 93 - src/kvirc/kvs/KviKvsTreeNodeRebindingSwitch.h | 49 - src/kvirc/kvs/KviKvsTreeNodeScopeOperator.cpp | 144 - src/kvirc/kvs/KviKvsTreeNodeScopeOperator.h | 58 - src/kvirc/kvs/KviKvsTreeNodeSimpleCommand.cpp | 50 - src/kvirc/kvs/KviKvsTreeNodeSimpleCommand.h | 43 - .../KviKvsTreeNodeSingleParameterIdentifier.cpp | 63 - .../kvs/KviKvsTreeNodeSingleParameterIdentifier.h | 50 - src/kvirc/kvs/KviKvsTreeNodeSpecialCommand.cpp | 49 - src/kvirc/kvs/KviKvsTreeNodeSpecialCommand.h | 41 - .../kvs/KviKvsTreeNodeSpecialCommandBreak.cpp | 52 - src/kvirc/kvs/KviKvsTreeNodeSpecialCommandBreak.h | 45 - .../kvs/KviKvsTreeNodeSpecialCommandClass.cpp | 164 - src/kvirc/kvs/KviKvsTreeNodeSpecialCommandClass.h | 71 - .../kvs/KviKvsTreeNodeSpecialCommandContinue.cpp | 52 - .../kvs/KviKvsTreeNodeSpecialCommandContinue.h | 45 - .../kvs/KviKvsTreeNodeSpecialCommandDefpopup.cpp | 347 -- .../kvs/KviKvsTreeNodeSpecialCommandDefpopup.h | 193 - src/kvirc/kvs/KviKvsTreeNodeSpecialCommandDo.cpp | 86 - src/kvirc/kvs/KviKvsTreeNodeSpecialCommandDo.h | 51 - src/kvirc/kvs/KviKvsTreeNodeSpecialCommandFor.cpp | 137 - src/kvirc/kvs/KviKvsTreeNodeSpecialCommandFor.h | 53 - .../kvs/KviKvsTreeNodeSpecialCommandForeach.cpp | 235 -- .../kvs/KviKvsTreeNodeSpecialCommandForeach.h | 53 - src/kvirc/kvs/KviKvsTreeNodeSpecialCommandIf.cpp | 76 - src/kvirc/kvs/KviKvsTreeNodeSpecialCommandIf.h | 50 - .../kvs/KviKvsTreeNodeSpecialCommandSwitch.cpp | 357 -- src/kvirc/kvs/KviKvsTreeNodeSpecialCommandSwitch.h | 117 - .../kvs/KviKvsTreeNodeSpecialCommandUnset.cpp | 71 - src/kvirc/kvs/KviKvsTreeNodeSpecialCommandUnset.h | 47 - .../kvs/KviKvsTreeNodeSpecialCommandWhile.cpp | 86 - src/kvirc/kvs/KviKvsTreeNodeSpecialCommandWhile.h | 51 - src/kvirc/kvs/KviKvsTreeNodeStringCase.cpp | 64 - src/kvirc/kvs/KviKvsTreeNodeStringCase.h | 45 - src/kvirc/kvs/KviKvsTreeNodeSwitchList.cpp | 167 - src/kvirc/kvs/KviKvsTreeNodeSwitchList.h | 61 - .../kvs/KviKvsTreeNodeThisObjectFunctionCall.cpp | 60 - .../kvs/KviKvsTreeNodeThisObjectFunctionCall.h | 49 - src/kvirc/kvs/KviKvsTreeNodeVariable.cpp | 50 - src/kvirc/kvs/KviKvsTreeNodeVariable.h | 47 - src/kvirc/kvs/KviKvsTreeNodeVoidFunctionCall.cpp | 56 - src/kvirc/kvs/KviKvsTreeNodeVoidFunctionCall.h | 47 - src/kvirc/kvs/event/KviKvsEvent.cpp | 78 + src/kvirc/kvs/event/KviKvsEvent.h | 54 + src/kvirc/kvs/event/KviKvsEventHandler.cpp | 76 + src/kvirc/kvs/event/KviKvsEventHandler.h | 106 + src/kvirc/kvs/event/KviKvsEventManager.cpp | 673 ++++ src/kvirc/kvs/event/KviKvsEventManager.h | 123 + src/kvirc/kvs/event/KviKvsEventTable.cpp | 3804 +++++++++++++++++++ src/kvirc/kvs/event/KviKvsEventTable.h | 371 ++ src/kvirc/kvs/event/KviKvsEventTriggers.h | 289 ++ src/kvirc/kvs/object/KviKvsObject.cpp | 1814 +++++++++ src/kvirc/kvs/object/KviKvsObject.h | 199 + src/kvirc/kvs/object/KviKvsObjectClass.cpp | 235 ++ src/kvirc/kvs/object/KviKvsObjectClass.h | 112 + src/kvirc/kvs/object/KviKvsObjectController.cpp | 258 ++ src/kvirc/kvs/object/KviKvsObjectController.h | 70 + src/kvirc/kvs/object/KviKvsObjectFunctionCall.cpp | 26 + src/kvirc/kvs/object/KviKvsObjectFunctionCall.h | 49 + .../kvs/object/KviKvsObjectFunctionHandler.cpp | 59 + src/kvirc/kvs/object/KviKvsObjectFunctionHandler.h | 62 + .../kvs/object/KviKvsObjectFunctionHandlerImpl.cpp | 147 + .../kvs/object/KviKvsObjectFunctionHandlerImpl.h | 119 + src/kvirc/kvs/parser/KviKvsParser.cpp | 3909 ++++++++++++++++++++ src/kvirc/kvs/parser/KviKvsParser.h | 303 ++ src/kvirc/kvs/parser/KviKvsParserMacros.h | 47 + src/kvirc/kvs/parser/KviKvsParser_command.cpp | 348 ++ src/kvirc/kvs/parser/KviKvsParser_comment.cpp | 90 + src/kvirc/kvs/parser/KviKvsParser_dollar.cpp | 321 ++ src/kvirc/kvs/parser/KviKvsParser_expression.cpp | 629 ++++ src/kvirc/kvs/parser/KviKvsParser_lside.cpp | 958 +++++ .../kvs/parser/KviKvsParser_specialCommands.cpp | 2045 ++++++++++ src/kvirc/kvs/tree/KviKvsTreeNode.h | 378 ++ .../kvs/tree/KviKvsTreeNodeAliasFunctionCall.cpp | 76 + .../kvs/tree/KviKvsTreeNodeAliasFunctionCall.h | 84 + .../kvs/tree/KviKvsTreeNodeAliasSimpleCommand.cpp | 122 + .../kvs/tree/KviKvsTreeNodeAliasSimpleCommand.h | 83 + src/kvirc/kvs/tree/KviKvsTreeNodeArrayCount.cpp | 82 + src/kvirc/kvs/tree/KviKvsTreeNodeArrayCount.h | 93 + src/kvirc/kvs/tree/KviKvsTreeNodeArrayElement.cpp | 152 + src/kvirc/kvs/tree/KviKvsTreeNodeArrayElement.h | 120 + .../kvs/tree/KviKvsTreeNodeArrayOrHashElement.cpp | 43 + .../kvs/tree/KviKvsTreeNodeArrayOrHashElement.h | 42 + .../tree/KviKvsTreeNodeArrayReferenceAssert.cpp | 99 + .../kvs/tree/KviKvsTreeNodeArrayReferenceAssert.h | 118 + src/kvirc/kvs/tree/KviKvsTreeNodeBase.cpp | 32 + src/kvirc/kvs/tree/KviKvsTreeNodeBase.h | 102 + .../tree/KviKvsTreeNodeBaseObjectFunctionCall.cpp | 60 + .../tree/KviKvsTreeNodeBaseObjectFunctionCall.h | 50 + .../kvs/tree/KviKvsTreeNodeCallbackCommand.cpp | 61 + src/kvirc/kvs/tree/KviKvsTreeNodeCallbackCommand.h | 48 + src/kvirc/kvs/tree/KviKvsTreeNodeCommand.cpp | 65 + src/kvirc/kvs/tree/KviKvsTreeNodeCommand.h | 54 + .../kvs/tree/KviKvsTreeNodeCommandEvaluation.cpp | 48 + .../kvs/tree/KviKvsTreeNodeCommandEvaluation.h | 46 + .../tree/KviKvsTreeNodeCommandWithParameters.cpp | 58 + .../kvs/tree/KviKvsTreeNodeCommandWithParameters.h | 49 + src/kvirc/kvs/tree/KviKvsTreeNodeCompositeData.cpp | 82 + src/kvirc/kvs/tree/KviKvsTreeNodeCompositeData.h | 46 + src/kvirc/kvs/tree/KviKvsTreeNodeConstantData.cpp | 78 + src/kvirc/kvs/tree/KviKvsTreeNodeConstantData.h | 50 + .../kvs/tree/KviKvsTreeNodeCoreCallbackCommand.cpp | 70 + .../kvs/tree/KviKvsTreeNodeCoreCallbackCommand.h | 51 + .../kvs/tree/KviKvsTreeNodeCoreFunctionCall.cpp | 60 + .../kvs/tree/KviKvsTreeNodeCoreFunctionCall.h | 48 + .../kvs/tree/KviKvsTreeNodeCoreSimpleCommand.cpp | 68 + .../kvs/tree/KviKvsTreeNodeCoreSimpleCommand.h | 49 + src/kvirc/kvs/tree/KviKvsTreeNodeData.cpp | 104 + src/kvirc/kvs/tree/KviKvsTreeNodeData.h | 62 + src/kvirc/kvs/tree/KviKvsTreeNodeDataList.cpp | 108 + src/kvirc/kvs/tree/KviKvsTreeNodeDataList.h | 55 + src/kvirc/kvs/tree/KviKvsTreeNodeExpression.cpp | 728 ++++ src/kvirc/kvs/tree/KviKvsTreeNodeExpression.h | 238 ++ .../kvs/tree/KviKvsTreeNodeExpressionReturn.cpp | 58 + .../kvs/tree/KviKvsTreeNodeExpressionReturn.h | 45 + .../tree/KviKvsTreeNodeExtendedScopeVariable.cpp | 77 + .../kvs/tree/KviKvsTreeNodeExtendedScopeVariable.h | 45 + src/kvirc/kvs/tree/KviKvsTreeNodeFunctionCall.cpp | 59 + src/kvirc/kvs/tree/KviKvsTreeNodeFunctionCall.h | 47 + .../kvs/tree/KviKvsTreeNodeGlobalVariable.cpp | 61 + src/kvirc/kvs/tree/KviKvsTreeNodeGlobalVariable.h | 45 + src/kvirc/kvs/tree/KviKvsTreeNodeHashCount.cpp | 79 + src/kvirc/kvs/tree/KviKvsTreeNodeHashCount.h | 47 + src/kvirc/kvs/tree/KviKvsTreeNodeHashElement.cpp | 148 + src/kvirc/kvs/tree/KviKvsTreeNodeHashElement.h | 52 + .../kvs/tree/KviKvsTreeNodeHashReferenceAssert.cpp | 95 + .../kvs/tree/KviKvsTreeNodeHashReferenceAssert.h | 53 + src/kvirc/kvs/tree/KviKvsTreeNodeIndirectData.cpp | 42 + src/kvirc/kvs/tree/KviKvsTreeNodeIndirectData.h | 42 + src/kvirc/kvs/tree/KviKvsTreeNodeInstruction.cpp | 36 + src/kvirc/kvs/tree/KviKvsTreeNodeInstruction.h | 85 + .../kvs/tree/KviKvsTreeNodeInstructionBlock.cpp | 85 + .../kvs/tree/KviKvsTreeNodeInstructionBlock.h | 55 + src/kvirc/kvs/tree/KviKvsTreeNodeLocalVariable.cpp | 70 + src/kvirc/kvs/tree/KviKvsTreeNodeLocalVariable.h | 45 + .../tree/KviKvsTreeNodeModuleCallbackCommand.cpp | 94 + .../kvs/tree/KviKvsTreeNodeModuleCallbackCommand.h | 50 + .../kvs/tree/KviKvsTreeNodeModuleFunctionCall.cpp | 87 + .../kvs/tree/KviKvsTreeNodeModuleFunctionCall.h | 48 + .../kvs/tree/KviKvsTreeNodeModuleSimpleCommand.cpp | 94 + .../kvs/tree/KviKvsTreeNodeModuleSimpleCommand.h | 48 + .../KviKvsTreeNodeMultipleParameterIdentifier.cpp | 87 + .../KviKvsTreeNodeMultipleParameterIdentifier.h | 49 + src/kvirc/kvs/tree/KviKvsTreeNodeObjectField.cpp | 67 + src/kvirc/kvs/tree/KviKvsTreeNodeObjectField.h | 47 + .../kvs/tree/KviKvsTreeNodeObjectFunctionCall.cpp | 54 + .../kvs/tree/KviKvsTreeNodeObjectFunctionCall.h | 45 + src/kvirc/kvs/tree/KviKvsTreeNodeOperation.cpp | 1275 +++++++ src/kvirc/kvs/tree/KviKvsTreeNodeOperation.h | 296 ++ .../kvs/tree/KviKvsTreeNodeParameterReturn.cpp | 76 + src/kvirc/kvs/tree/KviKvsTreeNodeParameterReturn.h | 45 + .../kvs/tree/KviKvsTreeNodeRebindingSwitch.cpp | 93 + src/kvirc/kvs/tree/KviKvsTreeNodeRebindingSwitch.h | 49 + src/kvirc/kvs/tree/KviKvsTreeNodeScopeOperator.cpp | 144 + src/kvirc/kvs/tree/KviKvsTreeNodeScopeOperator.h | 58 + src/kvirc/kvs/tree/KviKvsTreeNodeSimpleCommand.cpp | 50 + src/kvirc/kvs/tree/KviKvsTreeNodeSimpleCommand.h | 43 + .../KviKvsTreeNodeSingleParameterIdentifier.cpp | 63 + .../tree/KviKvsTreeNodeSingleParameterIdentifier.h | 50 + .../kvs/tree/KviKvsTreeNodeSpecialCommand.cpp | 49 + src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommand.h | 41 + .../kvs/tree/KviKvsTreeNodeSpecialCommandBreak.cpp | 52 + .../kvs/tree/KviKvsTreeNodeSpecialCommandBreak.h | 45 + .../kvs/tree/KviKvsTreeNodeSpecialCommandClass.cpp | 164 + .../kvs/tree/KviKvsTreeNodeSpecialCommandClass.h | 71 + .../tree/KviKvsTreeNodeSpecialCommandContinue.cpp | 52 + .../tree/KviKvsTreeNodeSpecialCommandContinue.h | 45 + .../tree/KviKvsTreeNodeSpecialCommandDefpopup.cpp | 347 ++ .../tree/KviKvsTreeNodeSpecialCommandDefpopup.h | 193 + .../kvs/tree/KviKvsTreeNodeSpecialCommandDo.cpp | 86 + .../kvs/tree/KviKvsTreeNodeSpecialCommandDo.h | 51 + .../kvs/tree/KviKvsTreeNodeSpecialCommandFor.cpp | 137 + .../kvs/tree/KviKvsTreeNodeSpecialCommandFor.h | 53 + .../tree/KviKvsTreeNodeSpecialCommandForeach.cpp | 235 ++ .../kvs/tree/KviKvsTreeNodeSpecialCommandForeach.h | 53 + .../kvs/tree/KviKvsTreeNodeSpecialCommandIf.cpp | 76 + .../kvs/tree/KviKvsTreeNodeSpecialCommandIf.h | 50 + .../tree/KviKvsTreeNodeSpecialCommandSwitch.cpp | 357 ++ .../kvs/tree/KviKvsTreeNodeSpecialCommandSwitch.h | 117 + .../kvs/tree/KviKvsTreeNodeSpecialCommandUnset.cpp | 71 + .../kvs/tree/KviKvsTreeNodeSpecialCommandUnset.h | 47 + .../kvs/tree/KviKvsTreeNodeSpecialCommandWhile.cpp | 86 + .../kvs/tree/KviKvsTreeNodeSpecialCommandWhile.h | 51 + src/kvirc/kvs/tree/KviKvsTreeNodeStringCase.cpp | 64 + src/kvirc/kvs/tree/KviKvsTreeNodeStringCase.h | 45 + src/kvirc/kvs/tree/KviKvsTreeNodeSwitchList.cpp | 167 + src/kvirc/kvs/tree/KviKvsTreeNodeSwitchList.h | 61 + .../tree/KviKvsTreeNodeThisObjectFunctionCall.cpp | 60 + .../tree/KviKvsTreeNodeThisObjectFunctionCall.h | 49 + src/kvirc/kvs/tree/KviKvsTreeNodeVariable.cpp | 50 + src/kvirc/kvs/tree/KviKvsTreeNodeVariable.h | 47 + .../kvs/tree/KviKvsTreeNodeVoidFunctionCall.cpp | 56 + .../kvs/tree/KviKvsTreeNodeVoidFunctionCall.h | 47 + src/modules/CMakeLists.txt | 4 + 304 files changed, 29081 insertions(+), 29073 deletions(-) delete mode 100644 src/kvirc/kvs/KviKvsEvent.cpp delete mode 100644 src/kvirc/kvs/KviKvsEvent.h delete mode 100644 src/kvirc/kvs/KviKvsEventHandler.cpp delete mode 100644 src/kvirc/kvs/KviKvsEventHandler.h delete mode 100644 src/kvirc/kvs/KviKvsEventManager.cpp delete mode 100644 src/kvirc/kvs/KviKvsEventManager.h delete mode 100644 src/kvirc/kvs/KviKvsEventTable.cpp delete mode 100644 src/kvirc/kvs/KviKvsEventTable.h delete mode 100644 src/kvirc/kvs/KviKvsEventTriggers.h delete mode 100644 src/kvirc/kvs/KviKvsObject.cpp delete mode 100644 src/kvirc/kvs/KviKvsObject.h delete mode 100644 src/kvirc/kvs/KviKvsObjectClass.cpp delete mode 100644 src/kvirc/kvs/KviKvsObjectClass.h delete mode 100644 src/kvirc/kvs/KviKvsObjectController.cpp delete mode 100644 src/kvirc/kvs/KviKvsObjectController.h delete mode 100644 src/kvirc/kvs/KviKvsObjectFunctionCall.cpp delete mode 100644 src/kvirc/kvs/KviKvsObjectFunctionCall.h delete mode 100644 src/kvirc/kvs/KviKvsObjectFunctionHandler.cpp delete mode 100644 src/kvirc/kvs/KviKvsObjectFunctionHandler.h delete mode 100644 src/kvirc/kvs/KviKvsObjectFunctionHandlerImpl.cpp delete mode 100644 src/kvirc/kvs/KviKvsObjectFunctionHandlerImpl.h delete mode 100644 src/kvirc/kvs/KviKvsParser.cpp delete mode 100644 src/kvirc/kvs/KviKvsParser.h delete mode 100644 src/kvirc/kvs/KviKvsParserMacros.h delete mode 100644 src/kvirc/kvs/KviKvsParser_command.cpp delete mode 100644 src/kvirc/kvs/KviKvsParser_comment.cpp delete mode 100644 src/kvirc/kvs/KviKvsParser_dollar.cpp delete mode 100644 src/kvirc/kvs/KviKvsParser_expression.cpp delete mode 100644 src/kvirc/kvs/KviKvsParser_lside.cpp delete mode 100644 src/kvirc/kvs/KviKvsParser_specialCommands.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNode.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeAliasFunctionCall.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeAliasFunctionCall.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeAliasSimpleCommand.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeAliasSimpleCommand.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeArrayCount.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeArrayCount.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeArrayElement.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeArrayElement.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeArrayOrHashElement.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeArrayOrHashElement.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeArrayReferenceAssert.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeArrayReferenceAssert.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeBase.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeBase.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeBaseObjectFunctionCall.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeBaseObjectFunctionCall.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeCallbackCommand.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeCallbackCommand.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeCommand.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeCommand.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeCommandEvaluation.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeCommandEvaluation.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeCommandWithParameters.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeCommandWithParameters.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeCompositeData.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeCompositeData.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeConstantData.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeConstantData.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeCoreCallbackCommand.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeCoreCallbackCommand.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeCoreFunctionCall.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeCoreFunctionCall.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeCoreSimpleCommand.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeCoreSimpleCommand.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeData.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeData.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeDataList.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeDataList.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeExpression.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeExpression.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeExpressionReturn.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeExpressionReturn.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeExtendedScopeVariable.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeExtendedScopeVariable.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeFunctionCall.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeFunctionCall.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeGlobalVariable.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeGlobalVariable.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeHashCount.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeHashCount.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeHashElement.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeHashElement.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeHashReferenceAssert.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeHashReferenceAssert.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeIndirectData.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeIndirectData.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeInstruction.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeInstruction.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeInstructionBlock.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeInstructionBlock.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeLocalVariable.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeLocalVariable.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeModuleCallbackCommand.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeModuleCallbackCommand.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeModuleFunctionCall.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeModuleFunctionCall.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeModuleSimpleCommand.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeModuleSimpleCommand.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeMultipleParameterIdentifier.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeMultipleParameterIdentifier.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeObjectField.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeObjectField.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeObjectFunctionCall.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeObjectFunctionCall.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeOperation.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeOperation.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeParameterReturn.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeParameterReturn.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeRebindingSwitch.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeRebindingSwitch.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeScopeOperator.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeScopeOperator.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSimpleCommand.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSimpleCommand.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSingleParameterIdentifier.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSingleParameterIdentifier.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommand.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommand.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandBreak.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandBreak.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandClass.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandClass.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandContinue.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandContinue.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandDefpopup.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandDefpopup.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandDo.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandDo.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandFor.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandFor.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandForeach.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandForeach.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandIf.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandIf.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandSwitch.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandSwitch.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandUnset.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandUnset.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandWhile.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSpecialCommandWhile.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeStringCase.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeStringCase.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSwitchList.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeSwitchList.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeThisObjectFunctionCall.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeThisObjectFunctionCall.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeVariable.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeVariable.h delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeVoidFunctionCall.cpp delete mode 100644 src/kvirc/kvs/KviKvsTreeNodeVoidFunctionCall.h create mode 100644 src/kvirc/kvs/event/KviKvsEvent.cpp create mode 100644 src/kvirc/kvs/event/KviKvsEvent.h create mode 100644 src/kvirc/kvs/event/KviKvsEventHandler.cpp create mode 100644 src/kvirc/kvs/event/KviKvsEventHandler.h create mode 100644 src/kvirc/kvs/event/KviKvsEventManager.cpp create mode 100644 src/kvirc/kvs/event/KviKvsEventManager.h create mode 100644 src/kvirc/kvs/event/KviKvsEventTable.cpp create mode 100644 src/kvirc/kvs/event/KviKvsEventTable.h create mode 100644 src/kvirc/kvs/event/KviKvsEventTriggers.h create mode 100644 src/kvirc/kvs/object/KviKvsObject.cpp create mode 100644 src/kvirc/kvs/object/KviKvsObject.h create mode 100644 src/kvirc/kvs/object/KviKvsObjectClass.cpp create mode 100644 src/kvirc/kvs/object/KviKvsObjectClass.h create mode 100644 src/kvirc/kvs/object/KviKvsObjectController.cpp create mode 100644 src/kvirc/kvs/object/KviKvsObjectController.h create mode 100644 src/kvirc/kvs/object/KviKvsObjectFunctionCall.cpp create mode 100644 src/kvirc/kvs/object/KviKvsObjectFunctionCall.h create mode 100644 src/kvirc/kvs/object/KviKvsObjectFunctionHandler.cpp create mode 100644 src/kvirc/kvs/object/KviKvsObjectFunctionHandler.h create mode 100644 src/kvirc/kvs/object/KviKvsObjectFunctionHandlerImpl.cpp create mode 100644 src/kvirc/kvs/object/KviKvsObjectFunctionHandlerImpl.h create mode 100644 src/kvirc/kvs/parser/KviKvsParser.cpp create mode 100644 src/kvirc/kvs/parser/KviKvsParser.h create mode 100644 src/kvirc/kvs/parser/KviKvsParserMacros.h create mode 100644 src/kvirc/kvs/parser/KviKvsParser_command.cpp create mode 100644 src/kvirc/kvs/parser/KviKvsParser_comment.cpp create mode 100644 src/kvirc/kvs/parser/KviKvsParser_dollar.cpp create mode 100644 src/kvirc/kvs/parser/KviKvsParser_expression.cpp create mode 100644 src/kvirc/kvs/parser/KviKvsParser_lside.cpp create mode 100644 src/kvirc/kvs/parser/KviKvsParser_specialCommands.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNode.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeAliasFunctionCall.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeAliasFunctionCall.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeAliasSimpleCommand.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeAliasSimpleCommand.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeArrayCount.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeArrayCount.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeArrayElement.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeArrayElement.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeArrayOrHashElement.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeArrayOrHashElement.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeArrayReferenceAssert.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeArrayReferenceAssert.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeBase.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeBase.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeBaseObjectFunctionCall.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeBaseObjectFunctionCall.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeCallbackCommand.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeCallbackCommand.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeCommand.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeCommand.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeCommandEvaluation.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeCommandEvaluation.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeCommandWithParameters.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeCommandWithParameters.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeCompositeData.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeCompositeData.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeConstantData.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeConstantData.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeCoreCallbackCommand.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeCoreCallbackCommand.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeCoreFunctionCall.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeCoreFunctionCall.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeCoreSimpleCommand.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeCoreSimpleCommand.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeData.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeData.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeDataList.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeDataList.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeExpression.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeExpression.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeExpressionReturn.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeExpressionReturn.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeExtendedScopeVariable.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeExtendedScopeVariable.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeFunctionCall.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeFunctionCall.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeGlobalVariable.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeGlobalVariable.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeHashCount.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeHashCount.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeHashElement.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeHashElement.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeHashReferenceAssert.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeHashReferenceAssert.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeIndirectData.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeIndirectData.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeInstruction.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeInstruction.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeInstructionBlock.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeInstructionBlock.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeLocalVariable.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeLocalVariable.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeModuleCallbackCommand.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeModuleCallbackCommand.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeModuleFunctionCall.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeModuleFunctionCall.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeModuleSimpleCommand.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeModuleSimpleCommand.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeMultipleParameterIdentifier.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeMultipleParameterIdentifier.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeObjectField.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeObjectField.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeObjectFunctionCall.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeObjectFunctionCall.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeOperation.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeOperation.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeParameterReturn.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeParameterReturn.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeRebindingSwitch.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeRebindingSwitch.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeScopeOperator.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeScopeOperator.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSimpleCommand.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSimpleCommand.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSingleParameterIdentifier.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSingleParameterIdentifier.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommand.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommand.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandBreak.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandBreak.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandClass.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandClass.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandContinue.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandContinue.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandDefpopup.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandDefpopup.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandDo.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandDo.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandFor.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandFor.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandForeach.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandForeach.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandIf.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandIf.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandSwitch.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandSwitch.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandUnset.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandUnset.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandWhile.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSpecialCommandWhile.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeStringCase.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeStringCase.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSwitchList.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeSwitchList.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeThisObjectFunctionCall.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeThisObjectFunctionCall.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeVariable.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeVariable.h create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeVoidFunctionCall.cpp create mode 100644 src/kvirc/kvs/tree/KviKvsTreeNodeVoidFunctionCall.h (limited to 'src') diff --git a/src/kvirc/CMakeLists.txt b/src/kvirc/CMakeLists.txt index 251327c0c..f60ad39d0 100644 --- a/src/kvirc/CMakeLists.txt +++ b/src/kvirc/CMakeLists.txt @@ -3,6 +3,10 @@ INCLUDE_DIRECTORIES( kernel kvs + kvs/event + kvs/object + kvs/parser + kvs/tree module sparser ui @@ -73,13 +77,13 @@ SET(kvirc_MOC_HDRS kvs/KviKvsAsyncDnsOperation.h kvs/KviKvsAsyncOperation.h kvs/KviKvsDnsManager.h - kvs/KviKvsEventManager.h - kvs/KviKvsObject.h kvs/KviKvsPopupMenu.h kvs/KviKvsPopupManager.h kvs/KviKvsProcessManager.h kvs/KviKvsTimerManager.h kvs/KviKvsUserAction.h + kvs/event/KviKvsEventManager.h + kvs/object/KviKvsObject.h kernel/KviAction.h kernel/KviActionManager.h kernel/KviApplication.h @@ -184,27 +188,10 @@ SET(kvirc_SRCS kvs/KviKvsCoreSimpleCommands_mr.cpp kvs/KviKvsCoreSimpleCommands_sz.cpp kvs/KviKvsDnsManager.cpp - kvs/KviKvsEvent.cpp - kvs/KviKvsEventHandler.cpp - kvs/KviKvsEventManager.cpp - kvs/KviKvsEventTable.cpp kvs/KviKvsHash.cpp kvs/KviKvsKernel.cpp kvs/KviKvsModuleInterface.cpp - kvs/KviKvsObject.cpp - kvs/KviKvsObjectClass.cpp - kvs/KviKvsObjectController.cpp - kvs/KviKvsObjectFunctionCall.cpp - kvs/KviKvsObjectFunctionHandler.cpp - kvs/KviKvsObjectFunctionHandlerImpl.cpp kvs/KviKvsParameterProcessor.cpp - kvs/KviKvsParser.cpp - kvs/KviKvsParser_command.cpp - kvs/KviKvsParser_comment.cpp - kvs/KviKvsParser_dollar.cpp - kvs/KviKvsParser_expression.cpp - kvs/KviKvsParser_lside.cpp - kvs/KviKvsParser_specialCommands.cpp kvs/KviKvsPopupManager.cpp kvs/KviKvsPopupMenu.cpp kvs/KviKvsProcessManager.cpp @@ -216,69 +203,86 @@ SET(kvirc_SRCS kvs/KviKvsScriptAddonManager.cpp kvs/KviKvsSwitchList.cpp kvs/KviKvsTimerManager.cpp - kvs/KviKvsTreeNodeAliasFunctionCall.cpp - kvs/KviKvsTreeNodeAliasSimpleCommand.cpp - kvs/KviKvsTreeNodeArrayCount.cpp - kvs/KviKvsTreeNodeArrayElement.cpp - kvs/KviKvsTreeNodeArrayOrHashElement.cpp - kvs/KviKvsTreeNodeArrayReferenceAssert.cpp - kvs/KviKvsTreeNodeBase.cpp - kvs/KviKvsTreeNodeBaseObjectFunctionCall.cpp - kvs/KviKvsTreeNodeCallbackCommand.cpp - kvs/KviKvsTreeNodeCommand.cpp - kvs/KviKvsTreeNodeCommandEvaluation.cpp - kvs/KviKvsTreeNodeCommandWithParameters.cpp - kvs/KviKvsTreeNodeCompositeData.cpp - kvs/KviKvsTreeNodeConstantData.cpp - kvs/KviKvsTreeNodeCoreCallbackCommand.cpp - kvs/KviKvsTreeNodeCoreFunctionCall.cpp - kvs/KviKvsTreeNodeCoreSimpleCommand.cpp - kvs/KviKvsTreeNodeData.cpp - kvs/KviKvsTreeNodeDataList.cpp - kvs/KviKvsTreeNodeExpression.cpp - kvs/KviKvsTreeNodeExpressionReturn.cpp - kvs/KviKvsTreeNodeExtendedScopeVariable.cpp - kvs/KviKvsTreeNodeFunctionCall.cpp - kvs/KviKvsTreeNodeGlobalVariable.cpp - kvs/KviKvsTreeNodeHashCount.cpp - kvs/KviKvsTreeNodeHashElement.cpp - kvs/KviKvsTreeNodeHashReferenceAssert.cpp - kvs/KviKvsTreeNodeIndirectData.cpp - kvs/KviKvsTreeNodeInstruction.cpp - kvs/KviKvsTreeNodeInstructionBlock.cpp - kvs/KviKvsTreeNodeLocalVariable.cpp - kvs/KviKvsTreeNodeModuleCallbackCommand.cpp - kvs/KviKvsTreeNodeModuleFunctionCall.cpp - kvs/KviKvsTreeNodeModuleSimpleCommand.cpp - kvs/KviKvsTreeNodeMultipleParameterIdentifier.cpp - kvs/KviKvsTreeNodeObjectField.cpp - kvs/KviKvsTreeNodeObjectFunctionCall.cpp - kvs/KviKvsTreeNodeOperation.cpp - kvs/KviKvsTreeNodeParameterReturn.cpp - kvs/KviKvsTreeNodeRebindingSwitch.cpp - kvs/KviKvsTreeNodeScopeOperator.cpp - kvs/KviKvsTreeNodeSimpleCommand.cpp - kvs/KviKvsTreeNodeSingleParameterIdentifier.cpp - kvs/KviKvsTreeNodeSpecialCommand.cpp - kvs/KviKvsTreeNodeSpecialCommandBreak.cpp - kvs/KviKvsTreeNodeSpecialCommandClass.cpp - kvs/KviKvsTreeNodeSpecialCommandContinue.cpp - kvs/KviKvsTreeNodeSpecialCommandDefpopup.cpp - kvs/KviKvsTreeNodeSpecialCommandDo.cpp - kvs/KviKvsTreeNodeSpecialCommandFor.cpp - kvs/KviKvsTreeNodeSpecialCommandForeach.cpp - kvs/KviKvsTreeNodeSpecialCommandIf.cpp - kvs/KviKvsTreeNodeSpecialCommandSwitch.cpp - kvs/KviKvsTreeNodeSpecialCommandUnset.cpp - kvs/KviKvsTreeNodeSpecialCommandWhile.cpp - kvs/KviKvsTreeNodeStringCase.cpp - kvs/KviKvsTreeNodeSwitchList.cpp - kvs/KviKvsTreeNodeThisObjectFunctionCall.cpp - kvs/KviKvsTreeNodeVariable.cpp - kvs/KviKvsTreeNodeVoidFunctionCall.cpp kvs/KviKvsUserAction.cpp kvs/KviKvsVariant.cpp kvs/KviKvsVariantList.cpp + kvs/event/KviKvsEvent.cpp + kvs/event/KviKvsEventHandler.cpp + kvs/event/KviKvsEventManager.cpp + kvs/event/KviKvsEventTable.cpp + kvs/object/KviKvsObject.cpp + kvs/object/KviKvsObjectClass.cpp + kvs/object/KviKvsObjectController.cpp + kvs/object/KviKvsObjectFunctionCall.cpp + kvs/object/KviKvsObjectFunctionHandler.cpp + kvs/object/KviKvsObjectFunctionHandlerImpl.cpp + kvs/parser/KviKvsParser.cpp + kvs/parser/KviKvsParser_command.cpp + kvs/parser/KviKvsParser_comment.cpp + kvs/parser/KviKvsParser_dollar.cpp + kvs/parser/KviKvsParser_expression.cpp + kvs/parser/KviKvsParser_lside.cpp + kvs/parser/KviKvsParser_specialCommands.cpp + kvs/tree/KviKvsTreeNodeAliasFunctionCall.cpp + kvs/tree/KviKvsTreeNodeAliasSimpleCommand.cpp + kvs/tree/KviKvsTreeNodeArrayCount.cpp + kvs/tree/KviKvsTreeNodeArrayElement.cpp + kvs/tree/KviKvsTreeNodeArrayOrHashElement.cpp + kvs/tree/KviKvsTreeNodeArrayReferenceAssert.cpp + kvs/tree/KviKvsTreeNodeBase.cpp + kvs/tree/KviKvsTreeNodeBaseObjectFunctionCall.cpp + kvs/tree/KviKvsTreeNodeCallbackCommand.cpp + kvs/tree/KviKvsTreeNodeCommand.cpp + kvs/tree/KviKvsTreeNodeCommandEvaluation.cpp + kvs/tree/KviKvsTreeNodeCommandWithParameters.cpp + kvs/tree/KviKvsTreeNodeCompositeData.cpp + kvs/tree/KviKvsTreeNodeConstantData.cpp + kvs/tree/KviKvsTreeNodeCoreCallbackCommand.cpp + kvs/tree/KviKvsTreeNodeCoreFunctionCall.cpp + kvs/tree/KviKvsTreeNodeCoreSimpleCommand.cpp + kvs/tree/KviKvsTreeNodeData.cpp + kvs/tree/KviKvsTreeNodeDataList.cpp + kvs/tree/KviKvsTreeNodeExpression.cpp + kvs/tree/KviKvsTreeNodeExpressionReturn.cpp + kvs/tree/KviKvsTreeNodeExtendedScopeVariable.cpp + kvs/tree/KviKvsTreeNodeFunctionCall.cpp + kvs/tree/KviKvsTreeNodeGlobalVariable.cpp + kvs/tree/KviKvsTreeNodeHashCount.cpp + kvs/tree/KviKvsTreeNodeHashElement.cpp + kvs/tree/KviKvsTreeNodeHashReferenceAssert.cpp + kvs/tree/KviKvsTreeNodeIndirectData.cpp + kvs/tree/KviKvsTreeNodeInstruction.cpp + kvs/tree/KviKvsTreeNodeInstructionBlock.cpp + kvs/tree/KviKvsTreeNodeLocalVariable.cpp + kvs/tree/KviKvsTreeNodeModuleCallbackCommand.cpp + kvs/tree/KviKvsTreeNodeModuleFunctionCall.cpp + kvs/tree/KviKvsTreeNodeModuleSimpleCommand.cpp + kvs/tree/KviKvsTreeNodeMultipleParameterIdentifier.cpp + kvs/tree/KviKvsTreeNodeObjectField.cpp + kvs/tree/KviKvsTreeNodeObjectFunctionCall.cpp + kvs/tree/KviKvsTreeNodeOperation.cpp + kvs/tree/KviKvsTreeNodeParameterReturn.cpp + kvs/tree/KviKvsTreeNodeRebindingSwitch.cpp + kvs/tree/KviKvsTreeNodeScopeOperator.cpp + kvs/tree/KviKvsTreeNodeSimpleCommand.cpp + kvs/tree/KviKvsTreeNodeSingleParameterIdentifier.cpp + kvs/tree/KviKvsTreeNodeSpecialCommand.cpp + kvs/tree/KviKvsTreeNodeSpecialCommandBreak.cpp + kvs/tree/KviKvsTreeNodeSpecialCommandClass.cpp + kvs/tree/KviKvsTreeNodeSpecialCommandContinue.cpp + kvs/tree/KviKvsTreeNodeSpecialCommandDefpopup.cpp + kvs/tree/KviKvsTreeNodeSpecialCommandDo.cpp + kvs/tree/KviKvsTreeNodeSpecialCommandFor.cpp + kvs/tree/KviKvsTreeNodeSpecialCommandForeach.cpp + kvs/tree/KviKvsTreeNodeSpecialCommandIf.cpp + kvs/tree/KviKvsTreeNodeSpecialCommandSwitch.cpp + kvs/tree/KviKvsTreeNodeSpecialCommandUnset.cpp + kvs/tree/KviKvsTreeNodeSpecialCommandWhile.cpp + kvs/tree/KviKvsTreeNodeStringCase.cpp + kvs/tree/KviKvsTreeNodeSwitchList.cpp + kvs/tree/KviKvsTreeNodeThisObjectFunctionCall.cpp + kvs/tree/KviKvsTreeNodeVariable.cpp + kvs/tree/KviKvsTreeNodeVoidFunctionCall.cpp kernel/KviAction.cpp kernel/KviActionManager.cpp kernel/KviApplication.cpp diff --git a/src/kvirc/kvs/KviKvsEvent.cpp b/src/kvirc/kvs/KviKvsEvent.cpp deleted file mode 100644 index 5d170ce89..000000000 --- a/src/kvirc/kvs/KviKvsEvent.cpp +++ /dev/null @@ -1,78 +0,0 @@ -//============================================================================= -// -// File : KviKvsEvent.cpp -// Creation date : Mon 23 Feb 2004 03:00:02 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2004-2010 Szymon Stefanek -// -// 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 "KviKvsEvent.h" - - -KviKvsEvent::~KviKvsEvent() -{ - clear(); -} - -void KviKvsEvent::clear() -{ - if(m_pHandlers)delete m_pHandlers; - m_pHandlers = 0; -} - -void KviKvsEvent::removeHandler(KviKvsEventHandler * h) -{ - m_pHandlers->removeRef(h); - if(m_pHandlers->isEmpty()) - { - delete m_pHandlers; - m_pHandlers = 0; - } -} - -void KviKvsEvent::addHandler(KviKvsEventHandler * h) -{ - if(!m_pHandlers) - { - m_pHandlers = new KviPointerList(); - m_pHandlers->setAutoDelete(true); - } - m_pHandlers->append(h); -} - -void KviKvsEvent::clearScriptHandlers() -{ - if(!m_pHandlers)return; - KviPointerList dl; - dl.setAutoDelete(false); - KviKvsEventHandler * e; - for(e = m_pHandlers->first();e;e = m_pHandlers->next()) - { - if(e->type() == KviKvsEventHandler::Script)dl.append(e); - } - for(e = dl.first();e;e = dl.next()) - { - m_pHandlers->removeRef(e); - } - if(m_pHandlers->isEmpty()) - { - delete m_pHandlers; - m_pHandlers = 0; - } -} diff --git a/src/kvirc/kvs/KviKvsEvent.h b/src/kvirc/kvs/KviKvsEvent.h deleted file mode 100644 index 1495a4fea..000000000 --- a/src/kvirc/kvs/KviKvsEvent.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef _KVI_KVS_EVENT_H_ -#define _KVI_KVS_EVENT_H_ -//============================================================================= -// -// File : KviKvsEvent.h -// Creation date : Mon 23 Feb 2004 03:00:02 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2004-2010 Szymon Stefanek -// -// 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_settings.h" -#include "KviQString.h" -#include "KviPointerList.h" - -#include "KviKvsEventHandler.h" - -class KVIRC_API KviKvsEvent -{ -protected: - QString m_szName; - QString m_szParameterDescription; - KviPointerList * m_pHandlers; -public: - // the event name and the parameter description are NOT translated - KviKvsEvent(const char * szEventName,const char * szParameterDescription) - : m_szName(szEventName), m_szParameterDescription(szParameterDescription), m_pHandlers(0) {}; - ~KviKvsEvent(); - void clear(); - void clearScriptHandlers(); - bool hasHandlers(){ return m_pHandlers != 0; }; - KviPointerList * handlers(){ return m_pHandlers; }; - void addHandler(KviKvsEventHandler * h); - void removeHandler(KviKvsEventHandler * h); - const QString & name(){ return m_szName; }; - const QString & parameterDescription(){ return m_szParameterDescription; }; -}; - -#endif //!_KVI_KVS_EVENT_H_ diff --git a/src/kvirc/kvs/KviKvsEventHandler.cpp b/src/kvirc/kvs/KviKvsEventHandler.cpp deleted file mode 100644 index b29f3ba9a..000000000 --- a/src/kvirc/kvs/KviKvsEventHandler.cpp +++ /dev/null @@ -1,76 +0,0 @@ -//============================================================================= -// -// File : KviKvsEventHandler.cpp -// Creation date : Mon 23 Feb 2004 03:04:58 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2004-2010 Szymon Stefanek -// -// 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 "KviKvsEventHandler.h" - -KviKvsEventHandler::KviKvsEventHandler(Type t) -: KviHeapObject(), m_type(t) -{ -} - -KviKvsEventHandler::~KviKvsEventHandler() -{ -} - - - -KviKvsScriptEventHandler::KviKvsScriptEventHandler(const QString &szHandlerName,const QString &szContextName,const QString &szCode,bool bEnabled) -: KviKvsEventHandler(KviKvsEventHandler::Script), m_szName(szHandlerName), m_bEnabled(bEnabled) -{ - m_pScript = new KviKvsScript(szContextName,szCode); -} - -KviKvsScriptEventHandler::~KviKvsScriptEventHandler() -{ - delete m_pScript; -} - -KviKvsScriptEventHandler * KviKvsScriptEventHandler::createInstance(const QString &szHandlerName,const QString &szContextName,const QString &szCode,bool bEnabled) -{ - return new KviKvsScriptEventHandler(szHandlerName,szContextName,szCode,bEnabled); -} - - -KviKvsModuleEventHandler::KviKvsModuleEventHandler(KviKvsModuleInterface * m,KviKvsModuleEventHandlerRoutine proc) -: KviKvsEventHandler(KviKvsEventHandler::Module), m_pModule(m) -{ - m_pProc = new KviKvsModuleEventHandlerRoutine(proc); -} - -KviKvsModuleEventHandler::~KviKvsModuleEventHandler() -{ - delete m_pProc; -} - - -/* -KviKvsOldModuleEventHandler::KviKvsOldModuleEventHandler(KviModuleEventParseProc p,KviModule * m) -: KviKvsEventHandler(KviKvsEventHandler::OldModule), m_pModule(m), m_proc(p) -{ -} - -KviKvsOldModuleEventHandler::~KviKvsOldModuleEventHandler() -{ -} -*/ diff --git a/src/kvirc/kvs/KviKvsEventHandler.h b/src/kvirc/kvs/KviKvsEventHandler.h deleted file mode 100644 index 148c8bbee..000000000 --- a/src/kvirc/kvs/KviKvsEventHandler.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef _KVI_KVS_EVENTHANDLER_H_ -#define _KVI_KVS_EVENTHANDLER_H_ -//============================================================================= -// -// File : KviKvsEventHandler.h -// Creation date : Mon 23 Feb 2004 03:04:58 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2004-2010 Szymon Stefanek -// -// 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_settings.h" -#include "KviKvsScript.h" -#include "KviQString.h" -#include "KviKvsModuleInterface.h" -#include "KviHeapObject.h" - -class KVIRC_API KviKvsEventHandler : public KviHeapObject -{ -public: - enum Type { Script, Module }; -protected: - Type m_type; -public: - KviKvsEventHandler(Type t); - virtual ~KviKvsEventHandler(); -public: - Type type(){ return m_type; }; -}; - - -class KVIRC_API KviKvsScriptEventHandler : public KviKvsEventHandler -{ -public: - // the event handler becomes the owned of pszCode! - KviKvsScriptEventHandler(const QString &szHandlerName,const QString &szContextName,const QString &szCode,bool bEnabled = true); - virtual ~KviKvsScriptEventHandler(); -protected: - QString m_szName; - KviKvsScript * m_pScript; - bool m_bEnabled; -public: - KviKvsScript * script(){ return m_pScript; }; - const QString & name(){ return m_szName; }; - const QString & code(){ return m_pScript->code(); }; - - bool isEnabled(){ return m_bEnabled; }; - void setEnabled(bool bEnabled){ m_bEnabled = bEnabled; }; - - // Static allocator function. - // This MUST be used by the modules to allocate event structures - // instead of the new operator. - // See KviHeapObject.cpp for an explaination. - static KviKvsScriptEventHandler * createInstance(const QString &szHandlerName,const QString &szContextName,const QString &szCode,bool bEnabled = true); -}; - - -class KVIRC_API KviKvsModuleEventHandler : public KviKvsEventHandler -{ -protected: - KviKvsModuleInterface * m_pModule; - KviKvsModuleEventHandlerRoutine * m_pProc; -public: - KviKvsModuleEventHandler(KviKvsModuleInterface * m,KviKvsModuleEventHandlerRoutine proc); - virtual ~KviKvsModuleEventHandler(); -public: - KviKvsModuleInterface * moduleInterface(){ return m_pModule; }; - KviKvsModuleEventHandlerRoutine * handlerRoutine(){ return m_pProc; }; -}; - - -/* -#include "KviModule.h" - -class KVIRC_API KviKvsOldModuleEventHandler : public KviKvsEventHandler -{ -protected: - KviModule * m_pModule; - KviModuleEventParseProc m_proc; -public: - KviKvsOldModuleEventHandler(KviModuleEventParseProc p,KviModule * m); - virtual ~KviKvsOldModuleEventHandler(); -public: - KviModule * module(){ return m_pModule; }; - void setModule(KviModule * m){ m_pModule = m; }; - KviModuleEventParseProc proc(){ return m_proc; }; - void setProc(KviModuleEventParseProc p){ m_proc = p; }; -}; - -*/ -#endif //!_KVI_KVS_EVENTHANDLER_H_ diff --git a/src/kvirc/kvs/KviKvsEventManager.cpp b/src/kvirc/kvs/KviKvsEventManager.cpp deleted file mode 100644 index 024c2d84b..000000000 --- a/src/kvirc/kvs/KviKvsEventManager.cpp +++ /dev/null @@ -1,673 +0,0 @@ -//============================================================================= -// -// File : KviKvsEventManager.cpp -// Creation date : Thu Aug 17 2000 13:59:12 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2000-2010 Szymon Stefanek -// -// 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 "KviKvsEventManager.h" -#include "KviConfigurationFile.h" -#include "KviKvsScript.h" -#include "KviKvsVariant.h" -#include "KviOptions.h" -#include "KviLocale.h" -#include "kvi_out.h" -#include "KviModule.h" -#include "KviWindow.h" -#include "KviKvsVariantList.h" - -/* - @doc: events - @type: - language - @keyterms: - events,event handlers,event - @title: - Events - @short: - Events: user reactions - @body: - KVIrc triggers an event when a particular situation occurs (hehe :D).[br] - You can define a set of event handlers for each event type.[br] - An event handler is a snippet of user-defined code that gets executed when the event is triggered.[br] - Event handlers can be created or destroyed by using the scriptcenter (graphic interface) - or even from the commandline (or script) by using the [cmd]event[/cmd] command.[br] - For example, the [event:onirc]OnIRC[/event] is triggered when the login operations have - been terminated and you can consider yourself "completely" on IRC. For example, you might - want to "auto-join" some channels. Nothing easier! The following snippet of code - adds a handler to the OnIRC event that joins three channels:[br] - [example] - [cmd]event[/cmd](OnIRC,autojoin) - { - [cmd]echo[/cmd] Auto-joining my preferred channels... - [cmd]join[/cmd] #kvirc,#siena,#linux - } - [/example] - Now try to connect to a server and you'll see that it joins automatically the three channels!.[br] - You might also want to do some other actions just after the connection has been established, - for example you might want to look immediately for a friend of yours by issuing a [cmd]whois[/cmd] - to the server (well.. you could use the notify list for that, but well, this is an example).[br] - You can add the [cmd]whois[/cmd] request to the handler above or just create a new one:[br] - [example] - [cmd]event[/cmd](OnIRC,lookforfred) - { - [cmd]echo[/cmd] Looking for fred... - [cmd]whois[/cmd] fred - } - [/example] - (An even nicer idea would be to use the [cmd]awhois[/cmd] command...but that's left to the reader as exercise.[br] - To remove an event handler you still use the [cmd]event[/cmd] command, but with an empty code block:[br] - [example] - [cmd]event[/cmd](OnIRC,lookforfred){}[br] - [/example] - [br] - Certain events will pass you some data in the positional parameters.[br] - For example, when you are being banned from a channel, KVIrc triggers the [event:onmeban]OnMeBan[/event] - event: you might be interested in WHO has banned you. KVIrc will pass the "ban source" information - in the positional parameters $0,$1 and $2.[br] - (Please note that the parameters started from $1 in KVIrc versions older than 3.0.0!).[br] - You may take a look at the list of available [doc:event_index_all]events[/doc].[br] -*/ - - -KviKvsEventManager * KviKvsEventManager::m_pInstance = 0; - -KviKvsEventManager::KviKvsEventManager() -{ - m_pInstance = this; - for(int i=0;i_< - if((u == 4) && KviQString::equalCI(szName,"OnIrcConnectionEstabilished")) - return u; - } - return KVI_KVS_NUM_APP_EVENTS; // <-- invalid event number -} - -KviKvsEvent * KviKvsEventManager::findAppEventByName(const QString &szName) -{ - for(unsigned int u = 0;u < KVI_KVS_NUM_APP_EVENTS;u++) - { - if(KviQString::equalCI(szName,m_appEventTable[u].name()))return &(m_appEventTable[u]); - //Backwards compatibility >_< - if((u == 4) && KviQString::equalCI(szName,"OnIrcConnectionEstabilished")) - return &(m_appEventTable[u]); - } - return 0; -} - -bool KviKvsEventManager::addAppHandler(unsigned int uEvIdx,KviKvsEventHandler * h) -{ - if(uEvIdx >= KVI_KVS_NUM_APP_EVENTS)return false; - m_appEventTable[uEvIdx].addHandler(h); - return true; -} - -bool KviKvsEventManager::addRawHandler(unsigned int uRawIdx,KviKvsEventHandler * h) -{ - if(uRawIdx >= KVI_KVS_NUM_RAW_EVENTS)return false; - if(!m_rawEventTable[uRawIdx]) - { - m_rawEventTable[uRawIdx] = new KviPointerList(); - m_rawEventTable[uRawIdx]->setAutoDelete(true); - } - m_rawEventTable[uRawIdx]->append(h); - return true; -} - -bool KviKvsEventManager::removeScriptAppHandler(unsigned int uEvIdx,const QString &szName) -{ - if(uEvIdx >= KVI_KVS_NUM_APP_EVENTS)return false; - KviKvsEventHandler * h; - if(!(m_appEventTable[uEvIdx].handlers()))return false; - for(h = m_appEventTable[uEvIdx].handlers()->first();h;h = m_appEventTable[uEvIdx].handlers()->next()) - { - if(h->type() == KviKvsEventHandler::Script) - { - if(KviQString::equalCI(((KviKvsScriptEventHandler *)h)->name(),szName)) - { - m_appEventTable[uEvIdx].removeHandler(h); - return true; - } - } - } - return false; -} - -KviKvsScriptEventHandler * KviKvsEventManager::findScriptRawHandler(unsigned int uEvIdx,const QString &szName) -{ - if(uEvIdx >= KVI_KVS_NUM_RAW_EVENTS)return 0; - if(!m_rawEventTable[uEvIdx])return 0; - KviKvsEventHandler * h; - for(h = m_rawEventTable[uEvIdx]->first();h;h = m_rawEventTable[uEvIdx]->next()) - { - if(h->type() == KviKvsEventHandler::Script) - { - if(KviQString::equalCI(((KviKvsScriptEventHandler *)h)->name(),szName)) - { - return (KviKvsScriptEventHandler *)h; - } - } - } - return 0; -} - -KviKvsScriptEventHandler * KviKvsEventManager::findScriptAppHandler(unsigned int uEvIdx,const QString &szName) -{ - if(uEvIdx >= KVI_KVS_NUM_APP_EVENTS)return 0; - KviKvsEventHandler * h; - if(!(m_appEventTable[uEvIdx].handlers()))return 0; - for(h = m_appEventTable[uEvIdx].handlers()->first();h;h = m_appEventTable[uEvIdx].handlers()->next()) - { - if(h->type() == KviKvsEventHandler::Script) - { - if(KviQString::equalCI(((KviKvsScriptEventHandler *)h)->name(),szName)) - { - return (KviKvsScriptEventHandler *)h; - } - } - } - return 0; -} - -bool KviKvsEventManager::enableScriptAppHandler(unsigned int uEvIdx,const QString &szName,bool bEnable) -{ - KviKvsScriptEventHandler * h = findScriptAppHandler(uEvIdx,szName); - if(!h)return false; - h->setEnabled(bEnable); - return true; -} - - -bool KviKvsEventManager::removeModuleAppHandler(unsigned int uEvIdx,KviKvsModuleInterface *i) -{ - if(uEvIdx >= KVI_KVS_NUM_APP_EVENTS)return false; - KviKvsEventHandler * h; - if(!(m_appEventTable[uEvIdx].handlers()))return false; - for(h = m_appEventTable[uEvIdx].handlers()->first();h;h = m_appEventTable[uEvIdx].handlers()->next()) - { - if(h->type() == KviKvsEventHandler::Module) - { - if(((KviKvsModuleEventHandler *)h)->moduleInterface() == i) - { - m_appEventTable[uEvIdx].removeHandler(h); - return true; - } - } - // COMPAT - /* - } else if(h->type() == KviKvsEventHandler::OldModule) - { - if(((KviKvsOldModuleEventHandler *)h)->module() == i) - { - m_appEventTable[uEvIdx].removeHandler(h); - return true; - } - } - */ - // END COMPAT - } - return false; -} - -void KviKvsEventManager::removeAllModuleAppHandlers(KviKvsModuleInterface *pIface) -{ - KviKvsEventHandler * h; - for(unsigned int i =0;i< KVI_KVS_NUM_APP_EVENTS;i++) - { - if(!m_appEventTable[i].handlers())continue; - - KviPointerList l; - l.setAutoDelete(false); - for(h = m_appEventTable[i].handlers()->first();h;h = m_appEventTable[i].handlers()->next()) - { - if(h->type() == KviKvsEventHandler::Module) - { - if(((KviKvsModuleEventHandler *)h)->moduleInterface() == pIface) - { - l.append(h); - } - } - // COMPAT - /* - } else if(h->type() == KviKvsEventHandler::OldModule) - { - if(((KviKvsOldModuleEventHandler *)h)->module() == pIface) - { - l.append(h); - } - } - */ - // END COMPAT - - } - for(h = l.first();h;h = l.next())m_appEventTable[i].removeHandler(h); - } -} - -void KviKvsEventManager::removeAllModuleRawHandlers(KviKvsModuleInterface *pIface) -{ - KviKvsEventHandler * h; - for(unsigned int i =0;i< KVI_KVS_NUM_RAW_EVENTS;i++) - { - if(!m_rawEventTable[i])continue; - - KviPointerList l; - l.setAutoDelete(false); - for(h = m_rawEventTable[i]->first();h;h = m_rawEventTable[i]->next()) - { - if(h->type() == KviKvsEventHandler::Module) - { - if(((KviKvsModuleEventHandler *)h)->moduleInterface() == pIface) - { - l.append(h); - } - } - // COMPAT - /* - } else if(h->type() == KviKvsEventHandler::OldModule) - { - if(((KviKvsOldModuleEventHandler *)h)->module() == pIface) - { - l.append(h); - } - } - */ - // END COMPAT - - } - for(h = l.first();h;h = l.next())m_rawEventTable[i]->removeRef(h); - if(m_rawEventTable[i]->isEmpty()) - { - delete m_rawEventTable[i]; - m_rawEventTable[i] = 0; - } - } -} - -bool KviKvsEventManager::removeScriptRawHandler(unsigned int uEvIdx,const QString &szName) -{ - if(uEvIdx >= KVI_KVS_NUM_RAW_EVENTS)return false; - if(!m_rawEventTable[uEvIdx])return false; - KviKvsEventHandler * h; - for(h = m_rawEventTable[uEvIdx]->first();h;h = m_rawEventTable[uEvIdx]->next()) - { - if(h->type() == KviKvsEventHandler::Script) - { - if(KviQString::equalCI(((KviKvsScriptEventHandler *)h)->name(),szName)) - { - m_rawEventTable[uEvIdx]->removeRef(h); - if(m_rawEventTable[uEvIdx]->isEmpty()) - { - delete m_rawEventTable[uEvIdx]; - m_rawEventTable[uEvIdx] = 0; - } - return true; - } - } - } - return false; -} - - -bool KviKvsEventManager::enableScriptRawHandler(unsigned int uEvIdx,const QString &szName,bool bEnable) -{ - KviKvsScriptEventHandler * h = findScriptRawHandler(uEvIdx,szName); - if(!h)return false; - h->setEnabled(bEnable); - return true; -} - - -bool KviKvsEventManager::removeModuleRawHandler(unsigned int uRawIdx,KviKvsModuleInterface *i) -{ - if(uRawIdx >= KVI_KVS_NUM_RAW_EVENTS)return false; - if(!m_rawEventTable[uRawIdx])return false; - KviKvsEventHandler * h; - for(h = m_rawEventTable[uRawIdx]->first();h;h = m_rawEventTable[uRawIdx]->next()) - { - if(h->type() == KviKvsEventHandler::Module) - { - if(((KviKvsModuleEventHandler *)h)->moduleInterface() == i) - { - m_rawEventTable[uRawIdx]->removeRef(h); - if(m_rawEventTable[uRawIdx]->isEmpty()) - { - delete m_rawEventTable[uRawIdx]; - m_rawEventTable[uRawIdx] = 0; - } - return true; - } - } - // COMPAT - /* - } else if(h->type() == KviKvsEventHandler::OldModule) - { - if(((KviKvsOldModuleEventHandler *)h)->module() == i) - { - m_rawEventTable[uRawIdx]->removeRef(h); - if(m_rawEventTable[uRawIdx]->isEmpty()) - { - delete m_rawEventTable[uRawIdx]; - m_rawEventTable[uRawIdx] = 0; - } - return true; - } - } - */ - // END COMPAT - - } - return false; -} - -void KviKvsEventManager::removeAllModuleHandlers(KviKvsModuleInterface * pIface) -{ - removeAllModuleAppHandlers(pIface); - removeAllModuleRawHandlers(pIface); -} - -void KviKvsEventManager::removeAllScriptAppHandlers() -{ - for(int i=0;i< KVI_KVS_NUM_APP_EVENTS;i++) - { - m_appEventTable[i].clearScriptHandlers(); - } -} - -void KviKvsEventManager::removeAllScriptRawHandlers() -{ - for(int i=0;i< KVI_KVS_NUM_RAW_EVENTS;i++) - { - if(m_rawEventTable[i]) - { - KviPointerList dl; - dl.setAutoDelete(false); - KviKvsEventHandler * e; - for(e = m_rawEventTable[i]->first();e;e = m_rawEventTable[i]->next()) - { - if(e->type() == KviKvsEventHandler::Script)dl.append(e); - } - - for(e = dl.first();e;e = dl.next()) - { - m_rawEventTable[i]->removeRef(e); - } - - if(m_rawEventTable[i]->isEmpty()) - { - delete m_rawEventTable[i]; - m_rawEventTable[i] = 0; - } - } - } -} - -void KviKvsEventManager::clearRawEvents() -{ - for(int i=0;i * pHandlers,KviWindow *pWnd,KviKvsVariantList *pParams) -{ - if(!pHandlers)return false; - - bool bGotHalt = false; - for(KviKvsEventHandler * h = pHandlers->first();h;h = pHandlers->next()) - { - switch(h->type()) - { - case KviKvsEventHandler::Script: - { - if(((KviKvsScriptEventHandler *)h)->isEnabled()) - { - KviKvsScript * s = ((KviKvsScriptEventHandler *)h)->script(); - KviKvsScript copy(*s); - KviKvsVariant retVal; - int iRet = copy.run(pWnd,pParams,&retVal,KviKvsScript::PreserveParams); - if(!iRet) - { - // error! disable the handler if it's broken - if(KVI_OPTION_BOOL(KviOption_boolDisableBrokenEventHandlers)) - { - ((KviKvsScriptEventHandler *)h)->setEnabled(false); - pWnd->output(KVI_OUT_PARSERERROR,__tr2qs_ctx("Event handler %Q is broken: disabling","kvs"),&(s->name())); - emit eventHandlerDisabled(s->name()); - } - } - if(!bGotHalt)bGotHalt = (iRet & KviKvsScript::HaltEncountered); - } - } - break; - case KviKvsEventHandler::Module: - { - KviModule * m = (KviModule *)((KviKvsModuleEventHandler *)h)->moduleInterface(); - KviKvsModuleEventHandlerRoutine * proc = ((KviKvsModuleEventHandler *)h)->handlerRoutine(); - KviKvsVariant retVal; - KviKvsRunTimeContext ctx(0,pWnd,pParams,&retVal); - KviKvsModuleEventCall call(m,&ctx,pParams); - if(!(*proc)(&call))bGotHalt = true; - } - break; - } - } - return bGotHalt; -} - - -void KviKvsEventManager::loadRawEvents(const QString &szFileName) -{ - KviConfigurationFile cfg(szFileName,KviConfigurationFile::Read); - removeAllScriptRawHandlers(); - int i; - - for(i=0;i(); - m_rawEventTable[i]->setAutoDelete(true); - for(unsigned int index = 0;index < nHandlers;index++) - { - KviQString::sprintf(tmp,"Name%u",index); - QString szName = cfg.readEntry(tmp,"unnamed"); - KviQString::sprintf(tmp,"Buffer%u",index); - QString szCode = cfg.readEntry(tmp,""); - KviQString::sprintf(tmp,"RawEvent%u::%Q",index,&szName); - KviKvsScriptEventHandler * s = new KviKvsScriptEventHandler(szName,tmp,szCode); - KviQString::sprintf(tmp,"Enabled%u",index); - s->setEnabled(cfg.readBoolEntry(tmp,false)); - m_rawEventTable[i]->append(s); - } - } - } - } -} - -void KviKvsEventManager::saveRawEvents(const QString &szFileName) -{ - KviConfigurationFile cfg(szFileName,KviConfigurationFile::Write); - cfg.clear(); - int i; - - for(i=0;ifirst();s; s = m_rawEventTable[i]->next()) - { - if(s->type() == KviKvsEventHandler::Script) - { - KviQString::sprintf(tmp,"Name%d",index); - cfg.writeEntry(tmp,((KviKvsScriptEventHandler *)s)->name()); - KviQString::sprintf(tmp,"Buffer%d",index); - cfg.writeEntry(tmp,((KviKvsScriptEventHandler *)s)->code()); - KviQString::sprintf(tmp,"Enabled%d",index); - cfg.writeEntry(tmp,((KviKvsScriptEventHandler *)s)->isEnabled()); - index++; - } - } - cfg.writeEntry("NHandlers",index); - } - } - -} - -void KviKvsEventManager::loadAppEvents(const QString &szFileName) -{ - KviConfigurationFile cfg(szFileName,KviConfigurationFile::Read); - removeAllScriptAppHandlers(); - - int i; - for(i=0;i_< - if((i == 4) && !cfg.hasGroup(szEventName)) - szEventName = "OnIrcConnectionEstabilished"; - if(cfg.hasGroup(szEventName)) - { - cfg.setGroup(szEventName); - unsigned int nHandlers = cfg.readUIntEntry("NHandlers",0); - if(nHandlers) - { - for(unsigned int index = 0;index < nHandlers;index++) - { - QString tmp; - KviQString::sprintf(tmp,"Name%u",index); - QString szName = cfg.readEntry(tmp,"unnamed"); - KviQString::sprintf(tmp,"Buffer%u",index); - QString szCode = cfg.readEntry(tmp,""); - KviQString::sprintf(tmp,"Enabled%u",index); - bool bEnabled = cfg.readBoolEntry(tmp,false); - QString szCntx; - KviQString::sprintf(szCntx,"%Q::%Q",&(m_appEventTable[i].name()),&szName); - KviKvsScriptEventHandler *s = new KviKvsScriptEventHandler(szName,szCntx,szCode,bEnabled); - m_appEventTable[i].addHandler(s); - } - } - } - } - -} - -void KviKvsEventManager::saveAppEvents(const QString &szFileName) -{ - KviConfigurationFile cfg(szFileName,KviConfigurationFile::Write); - cfg.clear(); - int i; - bool bCompat = FALSE; - - for(i=0;i_< - if((i == 4) && cfg.hasGroup(szEventName)) - { - szEventName = "OnIRCConnectionEstabilished"; - bCompat = TRUE; - } - cfg.setGroup(szEventName); - int index = 0; - for(KviKvsEventHandler* s = m_appEventTable[i].handlers()->first();s; s = m_appEventTable[i].handlers()->next()) - { - if(s->type() == KviKvsEventHandler::Script) - { - QString tmp; - KviQString::sprintf(tmp,"Name%d",index); - cfg.writeEntry(tmp,((KviKvsScriptEventHandler *)s)->name()); - KviQString::sprintf(tmp,"Buffer%d",index); - cfg.writeEntry(tmp,((KviKvsScriptEventHandler *)s)->code()); - KviQString::sprintf(tmp,"Enabled%d",index); - cfg.writeEntry(tmp,((KviKvsScriptEventHandler *)s)->isEnabled()); - index++; - } - } - cfg.writeEntry("NHandlers",index); - - // Backwards compatibility >_< - if((i == 4) && !bCompat) - i--; - } - } -} diff --git a/src/kvirc/kvs/KviKvsEventManager.h b/src/kvirc/kvs/KviKvsEventManager.h deleted file mode 100644 index a601b4a62..000000000 --- a/src/kvirc/kvs/KviKvsEventManager.h +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef _KVI_KVS_EVENTMANAGER_H_ -#define _KVI_KVS_EVENTMANAGER_H_ -//============================================================================= -// -// File : KviKvsEventManager.h -// Creation date : Thu Aug 17 2000 13:59:12 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2000-2010 Szymon Stefanek -// -// 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_settings.h" - -#include "KviKvsEvent.h" -#include "KviPointerList.h" -#include "KviKvsEventTable.h" - -class KviWindow; -class KviKvsModuleInterface; -class KviKvsVariantList; - -#define KVI_KVS_NUM_RAW_EVENTS 1000 - -class KVIRC_API KviKvsEventManager: public QObject -{ - Q_OBJECT - friend class KviModule; // compatibility only! -protected: // it only can be created and destroyed by KviKvsAliasManager::init()/done() - KviKvsEventManager(); - ~KviKvsEventManager(); -protected: - static KviKvsEventManager * m_pInstance; - - static KviKvsEvent m_appEventTable[KVI_KVS_NUM_APP_EVENTS]; - KviPointerList * m_rawEventTable[KVI_KVS_NUM_RAW_EVENTS]; -public: - static KviKvsEventManager * instance(){ return m_pInstance; }; - static void init(); // called by KviKvs::init() - static void done(); // called by KviKvs::done() - - KviKvsEvent * appEvent(unsigned int uEvIdx){ return &(m_appEventTable[uEvIdx]); }; - - bool hasAppHandlers(unsigned int uEvIdx){ return m_appEventTable[uEvIdx].hasHandlers(); }; - KviPointerList * appHandlers(unsigned int uEvIdx){ return m_appEventTable[uEvIdx].handlers(); }; - - bool hasRawHandlers(unsigned int uEvIdx){ return m_rawEventTable[uEvIdx]; }; - KviPointerList * rawHandlers(unsigned int uEvIdx){ return m_rawEventTable[uEvIdx]; }; - - KviKvsEvent * findAppEventByName(const QString &szName); - unsigned int findAppEventIndexByName(const QString &szName); - bool isValidAppEvent(unsigned int uEvIdx){ return (uEvIdx < KVI_KVS_NUM_APP_EVENTS); }; - - bool isValidRawEvent(unsigned int uEvIdx){ return (uEvIdx < KVI_KVS_NUM_RAW_EVENTS); }; - - bool addAppHandler(unsigned int uEvIdx,KviKvsEventHandler * h); - bool addRawHandler(unsigned int uRawIdx,KviKvsEventHandler * h); - - bool removeScriptAppHandler(unsigned int uEvIdx,const QString &szName); - bool removeScriptRawHandler(unsigned int uEvIdx,const QString &szName); - - bool enableScriptAppHandler(unsigned int uEvIdx,const QString &szName,bool bEnable); - bool enableScriptRawHandler(unsigned int uEvIdx,const QString &szName,bool bEnable); - - bool removeModuleAppHandler(unsigned int uEvIdx,KviKvsModuleInterface *i); - bool removeModuleRawHandler(unsigned int uRawIdx,KviKvsModuleInterface *i); - - void removeAllModuleAppHandlers(KviKvsModuleInterface *i); - void removeAllModuleRawHandlers(KviKvsModuleInterface *i); - - void removeAllModuleHandlers(KviKvsModuleInterface * i); - - KviKvsScriptEventHandler * findScriptRawHandler(unsigned int uEvIdx,const QString &szName); - KviKvsScriptEventHandler * findScriptAppHandler(unsigned int uEvIdx,const QString &szName); - - // returns true if further processing should be stopped - // none of these functions takes params ownership, so be sure to delete them ! - bool triggerHandlers(KviPointerList * pHandlers,KviWindow *pWnd,KviKvsVariantList *pParams); - bool trigger(unsigned int uEvIdx,KviWindow * pWnd,KviKvsVariantList * pParams) - { return triggerHandlers(m_appEventTable[uEvIdx].handlers(),pWnd,pParams); }; - bool triggerRaw(unsigned int uEvIdx,KviWindow *pWnd,KviKvsVariantList * pParams) - { return triggerHandlers(m_rawEventTable[uEvIdx],pWnd,pParams); }; - - // this is the only that takes parameter ownership and deletes them - bool triggerDeleteParams(unsigned int uEvIdx,KviWindow * pWnd,KviKvsVariantList * pParams) - { - bool bRet = triggerHandlers(m_appEventTable[uEvIdx].handlers(),pWnd,pParams); - delete pParams; - return bRet; - }; - - void removeAllScriptAppHandlers(); - void removeAllScriptRawHandlers(); - - void clearAppEvents(); - void clearRawEvents(); - void clear(); - - void loadAppEvents(const QString &szFileName); - void saveAppEvents(const QString &szFileName); - void loadRawEvents(const QString &szFileName); - void saveRawEvents(const QString &szFileName); -signals: - void eventHandlerDisabled(const QString &); -}; - - - -#endif //!_KVI_KVS_EVENTMANAGER_H_ diff --git a/src/kvirc/kvs/KviKvsEventTable.cpp b/src/kvirc/kvs/KviKvsEventTable.cpp deleted file mode 100644 index 0fe3af6af..000000000 --- a/src/kvirc/kvs/KviKvsEventTable.cpp +++ /dev/null @@ -1,3804 +0,0 @@ -//============================================================================= -// -// File : KviKvsEventTable.cpp -// Creation date : Mon 23 Feb 2004 03:23:18 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2004-2010 Szymon Stefanek -// -// 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 "KviKvsEvent.h" -#include "KviKvsEventTable.h" -#include "KviKvsEventManager.h" - -#define EVENT(_name,_parm) KviKvsEvent(_name,_parm) - -KviKvsEvent KviKvsEventManager::m_appEventTable[KVI_KVS_NUM_APP_EVENTS]= -{ - // Application - /* - @doc: onkvircstartup - @type: - event - @title: - OnKVIrcStartup - @short: - Triggered on KVIrc startup - @parameters: - None - @window: - Console of the first IRC context - @description: - This event is triggered on KVIrc startup. - It is bound to the console of the first created IRC context. - This is a little tricky, since this event is triggered - before the related [event:onirccontextcreated]OnIRCContextCreated[/event] event. - This is to make OnApplicationStartup be the absolutely first - event triggered at all. - This event is a good place to load your script configuration - and eventually initialize your variables. - @seealso: - [event:onkvircshutdown]OnKVIrcShutdown[/event] - */ - EVENT("OnKVIrcStartup",""), - - /* - @doc: onkvircshutdown - @type: - event - @title: - OnKVIrcShutdown - @short: - Triggered on KVIrc shutdown - @parameters: - None - @window: - Console of the last IRC context - @description: - This event is triggered on KVIrc shutdown. - It is bound to the console of the last existing IRC context. - This is a little tricky, since this event is triggered - immediately after the on [event:onirccontextdestroyed]OnIRCContextDestroyed[/event] event, - so in theory the console should be already destroyed. - This is to make OnApplicationShutdown be the absolutely last event - triggered at all. - This event is a good place to save your script configuration. - @seealso: - [event:onkvircstartup]OnKVIrcStartup[/event] - */ - EVENT("OnKVIrcShutdown",""), - - /* - @doc: onirccontextcreated - @type: - event - @title: - OnIRCContextCreated - @short: - Triggered when a new IRC context is created - @parameters: - None - @window: - Console of the created IRC context - @description: - This event is triggered when a new IRC context is created. - It is bound to the console of the related IRC context, - that is the first window that is created. - @seealso: - [event:onirccontextdestroyed]OnIRCContextDestroyed[/event] - */ - EVENT("OnIRCContextCreated",""), - - /* - @doc: onirccontextdestroyed - @type: - event - @title: - OnIRCContextDestroyed - @short: - Triggered when an IRC context is destroyed - @parameters: - None - @window: - Console of the destroyed IRC context - @description: - This event is triggered when an IRC context is being destroyed. - It is bound to the console of the related IRC context, - that is the last window of the context that is destroyed. - @seealso: - [event:onirccontextcreated]OnIRCContextCreated[/event] - */ - EVENT("OnIRCContextDestroyed",""), - - /* - @doc: onframewindowcreated - @type: - event - @title: - OnFrameWindowCreated - @short: - Triggered when a new frame window is opened - @parameters: - None - @window: - First console in the frame window - @description: - This event is triggered in the first console of a new frame window. - A frame window is the toplevel window that contains the consoles - and the other MDI children windows. - @seealso: - [event:onframewindowdestroyed]OnFrameWindowDestroyed[/event] - */ - EVENT("OnFrameWindowCreated",""), - - /* - @doc: onframewindowdestroyed - @type: - event - @title: - OnFrameWindowDestroyed - @short: - Triggered when a frame window is being destroyed - @parameters: - None - @window: - Last console in the frame window - @description: - This event is triggered in the last console of a frame window that is - being destroyed. In fact the frame window is not destroyed yet, but it - is going to: there would be no way to trigger this event after the - last frame window destruction. - @seealso: - [event:onframewindowcreated]OnFrameWindowCreated[/event] - */ - EVENT("OnFrameWindowDestroyed",""), - - /* - @doc: onurl - @type: - event - @title: - OnURL - @short: - Triggered when an URL appears in one of the output windows - @parameters: - $0 = URL - @window: - The window that the URL appeared in - @description: - This event is triggered every time that an URL is going to appear - in a KVIrc window output widget. You cannot stop it or modify it. - This event is good for implementing an URL catcher.[br] - WARNING: If you attempt to "echo $0" inside this event, you will cause an infinite loop. - */ - EVENT("OnURL", \ - "$0 = URL"), - - /* - @doc: onerror - @type: - event - @title: - OnError - @short: - Triggered when an ERROR message is received from the server - @parameters: - $0 = message source - $1 = error reason - @window: - Console - @description: - Triggered when an ERROR message is received from the server.[br] - $0 is the message (server) source but be aware that it often happens to be empty.[br] - Calling 'halt' in this event will stop the default output.[br] - */ - EVENT("OnError", \ - "$0 = message source\n" \ - "$1 = error reason"), - - /* - @doc: onaccelkeypressed - @type: - event - @title: - OnAccelKeyPressed - @short: - Triggered when an accelerator key was pressed - @parameters: - $0 = keys - @window: - Active window - @description: - An accelerator key has been pressed by the user.[br] - The key sequence that the user has pressed is passed in $0 as a - human readable string.[br] - The keys that actually work with KVIrc are:[br] - F2 to F12, F1 to F12 with SHIFT key pressed, 0 to 9 with CTRL key pressed.[br] - This means that you can set up 33 "quick" aliases...that's really more than - an user can remember.[br] - If you need more keys, mail me, I'll see what I can do :)[br] - */ - EVENT("OnAccelKeyPressed", \ - "$0 = keys"), - - /* - @doc: onhighlight - @type: - event - @title: - OnHighlight - @short: - Triggered when a channel or query message is going to be highlighted - @parameters: - $0 = talker nick - $1 = target username - $2 = target hostname - $3 = message - $4 = highlight word - $5 = message type - $6 = is action - @window: - Channel or query window - @description: - A channel or query message is going to be highlighted.[br] - The message may be either a PRIVMSG, a NOTICE or a CTCP ACTION.[br] - The highlight may be either caused by a "highlight word" or by your own nickname - (if that option was specified).[br] - $5 contains the original color/icon set of the message that depends on - the type of the message itself.[br] - Since the CTCP ACTION messages generally have different format of output, - for your convenience $6 contains 1 if the message was caused by a - CTCP ACTION or 0 otherwise.[br] - If you call [cmd]halt[/cmd] in this event the message output will be completely disabled - (thus, KVIrc assumes that YOU have provided the necessary output and feedback to the user).[br] - A common error here is to call halt and re-echo the unmodified output; [b]this - can cause another OnHighlight event to be triggered and create an infinite loop![/b] - [cmd]echoprivmsg[/cmd] [b]-n[/b] is the command you probably want. - To discriminate if this event has been triggered within a channel or in a private message, - check the values of [fnc]$channel[/fnc] or [fnc]$query[/fnc]. - */ - EVENT("OnHighlight", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = message\n" \ - "$4 = highlight word"), - - /* - @doc: onwindowactivated - @type: - event - @title: - OnWindowActivated - @short: - Triggered when a window has just been activated - @parameters: - none - @window: - Any window - @description: - This event is triggered when a KVIrc MDI window gets activated.[br] - This might be a good place to update your toolbar button status (for example).[br] - */ - EVENT("OnWindowActivated",""), - - /* - @doc: onnotifyonline - @type: - event - @title: - OnNotifyOnline - @short: - A user in the notify list is on-line - @parameters: - $0 = nickname - @window: - Console or active window of the IRC context - @description: - This event is triggered when one of the users in your [doc:notify_list]notify[/doc] lists - is detected to be ON-Line.[br] - The event is triggered in the console window or the active window of the IRC context depending - on the user options.[br] - (Note: If you call [cmd]halt[/cmd] in this event, you will stop the "Nick is on irc" output, - but this is rather a bad idea since KVIrc gives a lot of additional information to the - user with some notify-methods).[br] - This is a good place to play a sound or attract the user attention in some other way.[br] - - */ - EVENT("OnNotifyOnline", \ - "$0 = nickname"), - - /* - @doc: onnotifyoffline - @type: - event - @title: - OnNotifyOffline - @short: - A user in the notify list went off-line - @parameters: - $0 = nickname - @window: - Console or active window of the IRC context - @description: - This event is triggered when one of the users in your [doc:notify_list]notify[/doc] lists - has just left IRC.[br] - The event is triggered in the console window or the active window of the IRC context depending - on the user options.[br] - (Note: If you call [cmd]halt[/cmd] in this event, you will stop the "Nick has left irc" output, - but this is rather a bad idea since KVIrc gives a lot of additional information to the - user with some notify-methods).[br] - This is a good place to play a sound or attract the user attention in some other way.[br] - */ - EVENT("OnNotifyOffline", \ - "$0 = nickname"), - - /* - @doc: onping - @type: - event - @title: - OnPing - @short: - Server ping handler - @parameters: - $0 = server - $1 = ping message parameters - @window: - Console - @description: - Triggered when a PING message was received from a server.[br] - Calling 'halt' in this event will stop the informational message about 'ping->pong'.[br] - */ - EVENT("OnPing", \ - "$0 = server\n" \ - "$1 = message parameters"), - - /* - @doc: onpong - @type: - event - @title: - OnPong - @short: - Server pong handler - @parameters: - $0 = server - $1 = pong message parameters - @window: - Console - @description: - Triggered when a PONG message was received from a server.[br] - Calling 'halt' in this event will stop the informational message about the pong'.[br] - */ - EVENT("OnPong", \ - "$0 = server\n" \ - "$1 = pong message parameters"), - - /* - @doc: onlagalarmtimeup - @type: - event - @title: - OnLagAlarmTimeUp - @short: - High-Lag Alarm Started - @parameters: - $0 = server - $1 = Lag value in milliseconds - @window: - Console - @description: - Triggered when the Lag on the server tied to this console is higher than the configured Lag-Alarm time. - */ - EVENT("OnLagAlarmTimeUp", \ - "$0 = server\n" \ - "$1 = lag time in milliseconds"), - - /* - @doc: onlagalarmtimedown - @type: - event - @title: - OnLagAlarmTimeDown - @short: - High-Lag Alarm Stopped - @parameters: - $0 = server - $1 = Lag value in milliseconds - @window: - Console - @description: - Triggered when the Lag on the server tied to this console is lower than the configured Lag-Alarm time but was higher in the previous lag check. - */ - EVENT("OnLagAlarmTimeDown", \ - "$0 = server\n" \ - "$1 = lag time in milliseconds"), - - /* - @doc: onlagcheck - @type: - event - @title: - OnLagCheck - @short: - The lag metering engine has checked the lag - @parameters: - $0 = server - $1 = Lag value in milliseconds - @window: - Console - @description: - Triggered when the lag metering engine periodically calculates the current lag (the interval is configurable under settings -> IRC -> Tools -> Lag). - */ - EVENT("OnLagCheck", \ - "$0 = server\n" \ - "$1 = lag time in milliseconds"), - - /* - @doc: ontextinput - @type: - event - @title: - OnTextInput - @short: - The user has just entered some text in the text input - @parameters: - $0 = text - @window: - window in that the text is entered - @description: - Triggered when the user enters some text in the text input - window and presses return. - Calling [cmd]halt[/cmd] will stop the automatic text processing - and the result depends on the window the text is typed in. - In channel/query and console windows the text will NOT be sent to - the IRC server. This event might be useful for performing - substitutions in the text sent to the server. If you stop the - text processing in a channel or query window then the local - echo of the message will be omitted too. You might want to - realize the echo by the means of the [cmd]echoprivmsg[/cmd] command. - This event is NOT triggered when the user enters a command - in the input window. - @seealso: - [cmd]echoprivmsg[/cmd] - */ - EVENT("OnTextInput", \ - "$0 = text"), - - /* - @doc: onnotifylistdefaultactionrequest - @type: - event - @title: - OnNotifyListDefaultActionRequest - @short: - Notify list double click customization - @parameters: - $0 = nickname - @window: - The window that the user has clicked in - @description: - This event is triggered when an user has double clicked on a nickname in - the notify list (console window).[br] - You should use this event to do some significant action associated with the double click.[br] - A good example might be a [cmd]whois[/cmd] query or a [cmd]dcc.chat[/cmd] - */ - EVENT("OnNotifyListDefaultActionRequest", \ - "$0 = nickname"), - - /* - @doc: onwallops - @type: - event - @title: - OnWallops - @short: - Triggered when a WALLOPS message is received from the server - @parameters: - $0 = source nick - $1 = source user - $2 = source host - $3 = message text - @window: - channel - @description: - Triggered when a WALLOPS message is received from the server. - If you call [cmd]halt[/cmd] the message output will be stopped. - @seealso: - */ - EVENT("OnWallops", \ - "$0 = nick\n" \ - "$1 = user\n" \ - "$2 = host\n" \ - "$3 = message text"), - - /* - @doc: OnIgnoredMessage - @type: - event - @title: - OnIgnoredMessage - @short: - Triggered when a message is ignored. - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = message target - $4 = message - @window: - any - @description: - Triggered when a message is ignored. - */ - EVENT("OnIgnoredMessage", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source host\n" \ - "$3 = message target\n" \ - "$4 = message"), - - /* - @doc: onservernotice - @type: - event - @title: - OnServerNotice - @short: - A server NOTICE have been issued. - @parameters: - $0 = source nick - $1 = message - @window: - Console window - @description: - Someone has issued a server NOTICE. - @seealso: - [event:onchannelnotice]OnChannelNotice[/event] - */ - EVENT("OnServerNotice", \ - "$0 = source nick\n" \ - "$1 = message"), - - - - // Connection - /* - @doc: onircconnectionestablished - @type: - event - @title: - OnIRCConnectionEstablished - @short: - Triggered when a new IRC connection has been established - @parameters: - None - @window: - Console of the related IRC context - @description: - This event is triggered immediately after an IRC connection - has been established. No data has been sent to the server yet - and you have not logged in: it is not a good idea - attempting to send data to the server (READ: [b]This is NOT - a good place for joining channels[/b]). - Your nickname is still "undefined" too. - If you're looking for the appropriate moment for sending - data to the server look at the [event:onirc]OnIRC[/event] event. - This event is a good place for initializing connection related - variables. By calling [cmd]halt[/cmd] in this event you will stop the - "Connection established" output. - @seealso: - [event:onircconnectionterminated]OnIRCConnectionTerminated[/event] - */ - EVENT("OnIRCConnectionEstablished",""), - - /* - @doc: onircconnectionterminated - @type: - event - @title: - OnIRCConnectionTerminated - @short: - Triggered when an IRC connection has been terminated - @parameters: - None - @window: - Console of the related IRC context - @description: - This event is triggered immediately after an IRC connection - has been terminated. The socket is already closed, so you - can't send data to the server. You can still read - the connection parameters like the server name or - network name. By calling [cmd]halt[/cmd] in this - event you will stop the "Connection terminated..." output. - @seealso: - [event:onircconnectionestablished]OnIRCConnectionEstablished[/event] - */ - EVENT("OnIRCConnectionTerminated",""), - - /* - @doc: onirc - @type: - event - @title: - OnIRC - @short: - Triggered when the login operations are terminated - @parameters: - None - @window: - Console of the related IRC context - @description: - This event is triggered immediately after the login - operations have been terminated. From now on you are - "completely on IRC": your nickname has been defined - and the server is ready to accept commands from you. - This is a good place to join the "preferred channels". - By calling [cmd]halt[/cmd] in this event you will - stop the "Login operations complete..." output. - @seealso: - [event:onircconnectionestablished]OnIRCConnectionEstablished[/event] - [event:onircconnectionterminated]OnIRCConnectionTerminated[/event] - */ - EVENT("OnIRC",""), - - /* - @doc: onnetsplit - @type: - event - @title: - OnNetsplit - @short: - A netsplit has been detected - @parameters: - $0 = server1 - $1 = server2 - @window: - console - @description: - Triggered when KVIrc detects a netsplit by looking at an user's quit message. - The two parameters passed are the two servers that lost the link and were - signaled in that particular quit message.[br] - The actual netsplit detector in the KVIrc core uses the following rule - (extracted from the eggdrop bot code): "determine if signoff string matches "%.% %.%", - and only one space".[br] - [b]Note that this may be not accurate and KVIrc CAN be fooled by specially - formatted quit messages that aren't really netsplits.[/b][br] - KVIrc tries to avoid duplicate netsplit warnings thus this event will NOT - be triggered for EVERY quit in a netsplit: you will get it once for every - different set of servers that lost the link.[br] - Determining where the network link has been exactly broken may be a hard - task since the quit messages you see may not involve - the servers on the split boundary. - */ - EVENT("OnNetsplit", \ - "$0 = server1\n" \ - "$1 = server2"), - - /* - @doc: ondisconnectrequest - @type: - event - @title: - OnDisconnectRequest - @short: - Triggered when the user requests a disconnection - @parameters: - none - @window: - console - @description: - Triggered when the user requests a disconnection from - a server by pressing the "disconnect", by closing - the console or closing KVIrc. It is your last chance - to send some meaningful data to the server before the QUIT message - is sent. You can't prevent the user from disconnecting: [cmd]halt [/cmd]does nothing here.[br] - This event is useful to either give a salute to all the users - you were talking with or maybe to send some commands to the - bouncer you're connected to. Note that you can override the QUIT - message sent by KVIrc by sending it by youself first.[br] - @seealso: - */ - EVENT("OnDisconnectRequest",""), - - /* - @doc: OnHTTPGetTerminated - @type: - event - @title: - OnHTTPGetTerminated - @short: - A http.get command has terminated execution - @parameters: - $0 = status - $1 = remote url - $2 = local file - $3 = magic identifier - @window: - Console - @description: - Triggered when a [cmd]http.get[/cmd] file download has terminated execution. - If the transfer has been succesfull then $0 will contain the value 1 (true), - otherwise will contain the value 0. $1 contains the remote url and $2 the local - path on disk of the saved file. $3 contains the magic identifier passed to - the http.get command by the means of the -i switch. - */ - EVENT("OnHTTPGetTerminated", \ - "$0 = status\n" \ - "$1 = remote url\n" \ - "$2 = local file\n" \ - "$3 = magic identifier"), - - /* - @doc: onunhandledliteral - @type: - event - @title: - OnUnhandledLiteral - @short: - An unhandled literal server message has been received - @parameters: - $0 = source mask - $1 = message (literal) - $2- = parameters - @window: - Console window - @description: - An unhandled/unrecognized literal server message has been received.[br] - The KVIrc core code hasn't been able to recognize it nor handle it in any way.[br] - If you call [cmd]halt[/cmd] you will stop the standard or warning message output.[br] - For server numerics there is no "unhandled" event, you should use the raw numeric events to handle them.[br] - @seealso: - */ - EVENT("OnUnhandledLiteral", \ - "$0 = source mask\n" \ - "$1 = message\n" \ - "$2- parameters"), - - /* - @doc: onoutboundtraffic - @type: - event - @title: - OnOutboundTraffic - @short: - Triggered on outbound traffic.[br] - USE THIS EVENT WITH REAL CAUTION: an improper use can leads to many problems to KVIrc; especially avoid the use of 'halt' command. - @parameters: - $0 = outbound string - @window: - any - @description: - This event is triggered on outbound traffic. - @seealso: - [event:ontextinput]OnTextInput[/event] - [event:onchannelmessage]OnChannelMessage[/event] - */ - EVENT("OnOutboundTraffic", \ - "$0 = outbound string"), - - // Popups - /* - @doc: onchannelpopuprequest - @type: - event - @title: - OnChannelPopupRequest - @short: - Triggered when the channel text view is right-clicked - @parameters: - None - @window: - Channel window - @description: - This event is triggered when the user clicks the channel - text view with the right mouse button. It is a good place - to activate a [cmd]popup[/cmd] menu :) - @seealso: - [event:ondccchatpopuprequest]OnDCCChatPopupRequest[/event], - [event:onconsolepopuprequest]OnConsolePopupRequest[/event], - [event:onquerypopuprequest]OnQueryPopupRequest[/event] - */ - EVENT("OnChannelPopupRequest",""), - - /* - @doc: onconsolepopuprequest - @type: - event - @title: - OnConsolePopupRequest - @short: - Triggered when the console text view is right-clicked - @parameters: - None - @window: - Console window - @description: - This event is triggered when the user clicks the console - text view with the right mouse button. It is a good place - to activate a [cmd]popup[/cmd] menu :) - @seealso: - [event:ondccchatpopuprequest]OnDCCChatPopupRequest[/event], - [event:onchannelpopuprequest]OnChannelPopupRequest[/event], - [event:onquerypopuprequest]OnQueryPopupRequest[/event] - */ - EVENT("OnConsolePopupRequest",""), - - /* - @doc: onquerypopuprequest - @type: - event - @title: - OnQueryPopupRequest - @short: - Triggered when the query text view is right-clicked - @parameters: - None - @window: - Query - @description: - This event is triggered when the user clicks the query - text view with the right mouse button. It is a good place - to activate a [cmd]popup[/cmd] menu :) - @seealso: - [event:ondccchatpopuprequest]OnDCCChatPopupRequest[/event], - [event:onconsolepopuprequest]OnConsolePopupRequest[/event], - [event:onchannelpopuprequest]OnChannelPopupRequest[/event], - */ - EVENT("OnQueryPopupRequest",""), - - /* - @doc: onwindowpopuprequest - @type: - event - @title: - OnWindowPopupRequest - @short: - Triggered when the user middle-clicks in a text view (or right-clicks with the CTRL key pressed). - @parameters: - none - @window: - The window that the user has clicked in. - @description: - This event is here to allow easy customization of the window popup (it was builtin in KVIrc version prior to 3.0.0).[br] - Actually it is triggered when the user middle-clicks in a text view (or right-clicks with the CTRL key pressed).[br] - You should use it to popup your own version of the window popup that should interface the logging and window-behaviour functions. - */ - EVENT("OnWindowPopupRequest",""), - - /* - @doc: onhostlinkpopuprequest - @type: - event - @title: - OnHostLinkPopupRequest - @short: - Triggered when an user right clicks on a hostname link in the text view. - @parameters: - $0 = actual name - $1 - visible name - $2 - command name - @window: - The window that the user has clicked in. - @description: - This event is triggered when an user has right clicked on a hostname link in the text view. - The double click link action is builtin and it causes KVIrc to perform a DNS query on the hostname. - This is a good place to show a popup menu with some operations that can be done on the hostname like - "telnet", "traceroute", some special kind of DNS lookup (maybe an xterm with nslookup or sth). - */ - EVENT("OnHostLinkPopupRequest", \ - "$0 = actual name\n" \ - "$1 - visible name\n" \ - "$2 - command name"), - - /* - @doc: onurllinkpopuprequest - @type: - event - @title: - OnURLLinkPopupRequest - @short: - URL link popup customization - @parameters: - $0 = actual name - $1 - visible name - $2 - command name - @window: - The window that the user has clicked in - @description: - Actual name is equal to the command name if command name is not null. - Visible name is the link text (as it shown by user) - Command name is set if the visible name differs with the actual link target(probably contains mIRC colors,etc). It is equal to the actual target name. - This event is triggered when an user has right clicked on an URL link in - the text view. The double click link action is builtin and it causes KVIrc - to open the URL with a browser (tipically your OS default browser).[br] - This is a good place to show a [cmd]popup[/cmd] menu with some operations - that can be performed with the URL, like bookmarking in some way or opening - with a specific browser.[br] - */ - EVENT("OnURLLinkPopupRequest", \ - "$0 = actual name\n" \ - "$1 - visible name\n" \ - "$2 - command name"), - - /* - @doc: onserverlinkpopuprequest - @type: - event - @title: - OnServerLinkPopupRequest - @short: - Server link popup customization - @parameters: - $0 = actual name - $1 - visible name - $2 - command name - @window: - The window that the user has clicked in - @description: - Actual name is equal to the command name if command name is not null. - Visible name is the link text (as it shown by user) - Command name is set if the visible name differs with the actual link target(probably contains mIRC colors,etc). It is equal to the actual target name. - This event is triggered when an user has right clicked on an server name link in - the text view. The double click link action is builtin and it causes KVIrc - to query the MOTD of the server.[br] - This is a good place to show a [cmd]popup[/cmd] menu with some operations - that can be performed with the server name, like querying stats or links.[br] - Please note that the server name is generally NOT a hostname: some parts of - it are often hidden. The name of the server is generally valid only within - the IRC network that you are connected to.[br] - */ - EVENT("OnServerLinkPopupRequest", \ - "$0 = actual name\n" \ - "$1 - visible name\n" \ - "$2 - command name"), - - /* - @doc: onchannellinkpopuprequest - @type: - event - @title: - OnChannelLinkPopupRequest - @short: - Channel link popup customization - @parameters: - $0 = actual name - $1 - visible name - $2 - command name - @window: - The window that the user has clicked in - @description: - Actual name is equal to the command name if command name is not null. - Visible name is the link text (as it shown by user) - Command name is set if the visible name differs with the actual link target(probably contains mIRC colors,etc). It is equal to the actual target name. - This event is triggered when an user has right clicked on an channel link in - the text view. The double click link action is builtin and it causes KVIrc - to join the channel (unless the user is already on).[br] - This is a good place to show a [cmd]popup[/cmd] menu with some operations - that can be performed with the channel name like bookmarking, joining with a password, - performing a [cmd]who[/cmd] etc... - */ - EVENT("OnChannelLinkPopupRequest", \ - "$0 = actual name\n" \ - "$1 - visible name\n" \ - "$2 - command name"), - - /* - @doc: onnicklinkpopuprequest - @type: - event - @title: - OnNickLinkPopupRequest - @short: - Nick link popup customization - @parameters: - $0 = actual name - $1 - visible name - $2 - command name - @window: - The window that the user has clicked in - @description: - Actual name is equal to the command name if command name is not null. - Visible name is the link text (as it shown by user) - Command name is set if the visible name differs with the actual link target(probably contains mIRC colors,etc). It is equal to the actual target name. - This event is triggered when an user has right clicked on an "unknown" nickname link in - the text view.[br] - This is a good place to show a [cmd]popup[/cmd] menu with some operations - that can be performed with the nickname like querying, sending a file by dcc or opening a dcc.chat. - Please note that NOT ALL the nickname links will receive this event.[br] - The nickname links that appear in the text view of the channel that they are actually in - are handled by the [event:onchannelnickpopuprequest]OnChannelNickPopupRequest[/event] event.[br] - The nickname links that appear in the text view of the query in that they are a remote end - are handled by the [event:onquerynickpopuprequest]OnQueryNickPopupRequest[/event] event.[br] - */ - EVENT("OnNickLinkPopupRequest", \ - "$0 = actual name\n" \ - "$1 - visible name\n" \ - "$2 - command name"), - - /* - @doc: onquerynickpopuprequest - @type: - event - @title: - OnQueryNickPopupRequest - @short: - Query nicklist popup customization - @parameters: - $0 = actual name - $1 - visible name - $2 - command name - @window: - The window that the user has clicked in - @description: - Actual name is equal to the command name if command name is not null. - Visible name is the link text (as it shown by user) - Command name is set if the visible name differs with the actual link target(probably contains mIRC colors,etc). It is equal to the actual target name. - This event is triggered when an user has right clicked on a set of nicknames in - the query target list.[br] - This is a good place to show a [cmd]popup[/cmd] menu with some operations - that can be performed with the nickname like sending a file by dcc, opening a dcc.chat or - performing a whois.[br] - */ - EVENT("OnQueryNickPopupRequest", \ - "$0 = actual name\n" \ - "$1 - visible name\n" \ - "$2 - command name"), - - /* - @doc: onchannelnickpopuprequest - @type: - event - @title: - OnChannelNickPopupRequest - @short: - Allows customization of the nick-on-channel context popup - @parameters: - $0 = nick list - @window: - Channel window - @description: - This event is triggered when the user right-clicks in the channel user list - or on a nickname link in the channel text view.[br] - The first parameter ($0) contains a comma separated list of selected nicknames (if it is an user list click) - or a single nickname (if it is a link).[br] - In both cases all the nicknames are currently on the channel.[br] - You should popup a popup-menu with a set of possible channel-related actions, - like op/deop, voice/devoice, whois etc... - @seealso: - [event:onchannelnickdefaultactionrequest]OnChannelNickDefaultActionRequest[/event] - */ - EVENT("OnChannelNickPopupRequest", \ - "$0 = nick list"), - - /* - @doc: onnotifylistpopuprequest - @type: - event - @title: - OnNotifyListPopupRequest - @short: - Notify list context popup customization - @parameters: - $0 = nickname list - @window: - The window that the user has clicked in - @description: - This event is triggered when an user has right clicked on a list of nicknames in - the notify list (console window).[br] - This is a good place to show a [cmd]popup[/cmd] with some actions that can be performed - on the nicknames like querying, performing a whois lookup or sth similar.[br] - */ - EVENT("OnNotifyListPopupRequest", \ - "$0 = nickname list"), - - /* - @doc: ondccchatpopuprequest - @type: - event - @title: - OnDCCChatPopupRequest - @short: - Triggered when the DCC chat text view is right-clicked - @parameters: - $0 = DCC session ID - @window: - DCC Chat window - @description: - This event is triggered when the user clicks the DCC chat - text view with the right mouse button. It is a good place - to activate a [cmd]popup[/cmd] menu :) - You can retrieve the session information by calling the [module:dcc]dcc[/module].* - module functions and by passing the DCC session ID parameter. - @seealso: - [event:onconsolepuprequest]OnConsolePopupRequest[/event], - [event:onchannelpopuprequest]OnChannelPopupRequest[/event], - [event:onquerypopuprequest]OnQueryPopupRequest[/event] - */ - EVENT("OnDCCChatPopupRequest", \ - "$0 = DCC session ID"), - - // Channels - /* - @doc: onchannelwindowcreated - @type: - event - @title: - OnChannelWindowCreated - @short: - A channel window has just been opened - @parameters: - none - @window: - Channel window - @description: - Triggered when a channel window has just been created - Note that the channel is still empty: no users have joined it. - @seealso: - [event:onquerywindowcreated]OnQueryWindowCreated[/event] - */ - EVENT("OnChannelWindowCreated",""), - - /* - @doc: onchannelsync - @type: - event - @title: - OnChannelSync - @short: - Triggered when all channel information have been received - @parameters: - $0 = channel sync time in milliseconds - @window: - Channel - @description: - This event is triggered after you have joined a channel - and all information have been received.[br] - This includes the channel users list, the ban list, - the channel mode, the topic and eventually - the invite and ban exception lists.[br] - Calling halt in this even stops the "channel synchronized" output. - (the output will be halted anyway if [fnc]$option[/fnc](boolShowChannelSyncTime) evaluates to false) - @seealso: - [event:ondccchatpopuprequest]OnDCCChatPopupRequest[/event], - [event:onconsolepopuprequest]OnConsolePopupRequest[/event], - [event:onchannelpopuprequest]OnChannelPopupRequest[/event] - */ - EVENT("OnChannelSync", \ - "$0 = Channel sync time in milliseconds"), - - /* - @doc: onchannelmessage - @type: - event - @title: - OnChannelMessage - @short: - A message has been received from the channel - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = message - $4 = [target mode prefixes] - @window: - Channels window - @description: - Triggered when a channel message is received - $0!$1@$2 is the source of the message, $3 is the message text - and $4 are the eventual mode prefixes added to the target channel (i.e: - if the message is only for channel operators then you will get the string @ in $4). - @seealso: - [event:onquerymessage]OnQueryMessage[/event] - [event:ondccchatmessage]OnDCCChatMessage[/event] - */ - EVENT("OnChannelMessage", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = message\n" \ - "$4 = target mode prefixes"), - - /* - @doc: onchannelnotice - @type: - event - @title: - OnChannelNotice - @short: - A NOTICE have been issued to a channel - @parameters: - $0 = source nick - $1 = message - $2 = target - @window: - Channel window - @description: - Someone has issued a NOTICE with a channel as his target - For normal channel notices $2 parameter will only a channel name. - For channel op or channel voice notices it will contain also the leading '@' or '+' flag. - Please note that this convention is different from the one used in [event:onchannelprivmsg]OnChannelPrivmsg[/event]: - the incompatibility is here for historical reasons: it is not a big deal so we're not fighting it :) - @seealso: - [event:onservernotice]OnServerNotice[/event] - */ - EVENT("OnChannelNotice", \ - "$0 = source nick\n" \ - "$1 = message\n" \ - "$2 = target"), - - // Queries - /* - @doc: onquerymessage - @type: - event - @title: - OnQueryMessage - @short: - A message has been received from a query - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = message - @window: - Query or console window. - @description: - Triggered when a query message is received.[br] - If you [cmd]return[/cmd] [fnc]$false[/fnc] in this event, the message output will be stopped.[br] - This event is triggered in the query window associated to the source nick, or in - the IRC context console window if the query window has not been created for some reason. - Note that you can't stop the query window creation with this event: you must - use [event:onquerywindowrequest]OnQueryWindowRequest[/event] for that purpose. - Note also that you may not receive this event if the anti-spam option is in use and - KVIrc has detected that this might be a spam message. This is usually not an issue - but if you care about it then write to pragma at kvirc dot net asking to add a OnSpam event. - @seealso: - [event:onquerywindowrequest]OnQueryWindowRequest[/event] - [event:onquerywindowcreated]OnQueryWindowCreated[/event] - [event:onquerytargetadded]OnQueryTargetAdded[/event] - [event:onchannelmessage]OnChannelMessage[/event] - [event:ondccchatmessage]OnDCCChatMessage[/event] - */ - EVENT("OnQueryMessage", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = message"), - - /* - @doc: onquerynotice - @type: - event - @title: - OnQueryNotice - @short: - A private notice has been received - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = message - @window: - Query window or console - @description: - Triggered when a private notice is received.[br] - If you call [cmd]halt[/cmd] in this event, the message output will be stopped and if the message was going to cause a query window creation, the window will NOT be created - @seealso: - [event:onchannelmessage]OnChannelMessage[/event] - [event:onchannelnotice]OnChannelNotice[/event] - */ - EVENT("OnQueryNotice", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source host\n" \ - "$3 = message"), - - /* - @doc: onquerywindowrequest - @type: - event - @title: - OnQueryWindowRequest - @short: - A new query window is going to be opened because a remote message has been received - @parameters: - $0 = source nickname - $1 = source username - $2 = source host - $3 = message - @window: - console window - @description: - Triggered when a PRIVMSG or NOTICE has been received from a remote user and a query - for that user doesn't exist yet. KVIrc has already checked its internal conditions - and you have the last word on the query creation. If you call halt in this event - you will prevent the creation of the query window, in all other cases the window - will be created. This is useful for filtering out spam messages that popup unwanted - windows in front of the user. You have also the option of creating the query window - yourself (by calling [cmd]query[/cmd]). This may be useful if you want to create - the query windows in a particular state (minimized, positioned in some special place - or maybe undocked if some conditions are verified). - The next event you will catch related to this query window will be - [event:onquerywindowcreated]OnQueryWindowCreated[/event] and [event:onquerytargetadded]OnQueryTargetAdded[/event]. - After that you will get [event:onquerymessage]OnQueryMessage[/event] with exactly - the parameters passed to this event. - */ - EVENT("OnQueryWindowRequest", \ - "$0 = source nick\n" \ - "$1 = source user\n" \ - "$2 = source host\n" \ - "$3 = message"), - - /* - @doc: onquerywindowcreated - @type: - event - @title: - OnQueryWindowCreated - @short: - A query window has just been opened - @parameters: - none - @window: - Query window - @description: - Triggered when a query window has just been created - Note that the query is still empty: it has no targets. - If you want to trigger some events in response to a query - creation by some remote user then you probably need - [event:onquerywindowrequest]OnQueryWindowRequest[/event] or - [event:onquerytargetadded]OnQueryTargetAdded[/event]. - @seealso: - [event:onchannelwindowcreated]OnChannelWindowCreated[/event] - [event:onquerywindowrequest]OnQueryWindowRequest[/event] - [event:onquerytargetadded]OnQueryTargetAdded[/event] - */ - EVENT("OnQueryWindowCreated",""), - - /* - @doc: onquerytargetadded - @type: - event - @title: - OnQueryTargetAdded - @short: - A new query target has been added - @parameters: - $0 = nickname - $1 = username (may be *) - $2 = host (may be *) - @window: - query window - @description: - Triggered when a new remote target has been added to a query window. - This is the event to catch when you want to perform some specific actions - when someone queries you. - KVIrc supports multiple target queries and thus, this event is triggered also - when a new query target is added by using [cmd]addtarget[/cmd]. - */ - EVENT("OnQueryTargetAdded", \ - "$0 = nick\n" \ - "$1 = username (may be *)\n" \ - "$2 = hostname (may be *)"), - - /* - @doc: OnQueryFileDropped - @type: - event - @title: - OnQueryFileDropped - @short: - A file is dropped in a query - @parameters: - $0 = source nick - $1 = filedropped - @window: - Query - @description: - Triggered when a file is dropped in a query window.[br] - $target is the nick.[br] - */ - EVENT("OnQueryFileDropped", \ - "$0 = nick\n" \ - "$1 = filedropped"), - - // Actions - /* - @doc: onmeaway - @type: - event - @title: - OnMeAway - @short: - Local user sets the AWAY status - @parameters: - $0 = server message trailing - @window: - Console - @description: - Triggered when the local user enters the AWAY state. - Calling 'halt' in this event disables the server "You have been marked as being away" message.[br] - @seealso: - [event:onmeback]OnMeBack[/event] - */ - EVENT("OnMeAway", \ - "$0- = server message trailing"), - - /* - @doc: onmeback - @type: - event - @title: - OnMeBack - @short: - Local user cancels the AWAY status - @parameters: - $0 = away start time - $1- = server message trailing - @window: - Console - @description: - Triggered when the local user leaves the AWAY state.[br] - The $0 parameter contains the [b]unix time[/b] of the away status start.[br] - You can obtain the current [b]unix time[/b] from the function [fnc]$unixtime[/fnc].[br] - Calling 'halt' in this event disables the server "You are no longer marked as being away" message.[br] - @seealso: - [event:onmeaway]OnMeAway[/event] - */ - EVENT("OnMeBack", \ - "$0 = away start time\n" - "$1- = server message trailing"), - - /* - @doc: onjoin - @type: - event - @title: - OnJoin - @short: - Non-local user joining a channel - @parameters: - $0 = nickname - $1 = username - $2 = hostname - @window: - Channel - @description: - Triggered just after a non-local user has joined a channel.[br] - Sine this event is triggered in the chanel window, - you can get the channel name by using the [fnc]$target[/fnc] function.[br] - Calling 'halt' in this event will stop the join message output.[br] - @seealso: - [event:onmejoin]OnMeJoin[/event] - */ - EVENT("OnJoin", \ - "$0 = nickname\n" \ - "$1 = username\n" \ - "$2 = hostname"), - - /* - @doc: onmejoin - @type: - event - @title: - OnMeJoin - @short: - Local user joining a channel - @parameters: - None - @window: - Channel - @description: - Triggered just after the local user has joined a channel.[br] - Sine this event is triggered in the chanel window, - you can get the channel name by using the [fnc]$target[/fnc] function.[br] - Calling 'halt' in this event will stop the join message output.[br] - @seealso: - [event:onjoin]OnJoin[/event] - */ - EVENT("OnMeJoin",""), - - /* - @doc: onpart - @type: - event - @title: - OnPart - @short: - Non-local user is leaving a channel - @parameters: - $0 = nickname - $1 = username - $2 = hostname - $3 = part message - @window: - Channel - @description: - Triggered when a NON-local user is leaving a channel.[br] - The PART message has already been processed by the server, so - the user is effectively no longer on the channel. - On the other side, it might be useful to access the user-related channel data from - this event, thus the handler is called effectively just BEFORE the - user effectively leaves the channel (and thus BEFORE the user-related channel data gets - destroyed).[br] - Since this event is triggered in the chanel window, - you can get the channel name by using the [fnc]$target[/fnc] function.[br] - Calling 'halt' in this event will stop the part message output.[br] - @seealso: - [event:onmejoin]OnMeJoin[/event], [event:OnJoin]OnJoin[/event], - [event:onmepart]OnMePart[/event] - */ - EVENT("OnPart", \ - "$0 = nickname\n" \ - "$1 = username\n" \ - "$2 = host\n" \ - "$3 = part message"), - - /* - @doc: onmepart - @type: - event - @title: - OnMePart - @short: - Local user is leaving a channel - @parameters: - $0 = part message - @window: - Channel - @description: - Triggered when the local user is leaving a channel.[br] - The PART message has already been processed by the server, so - the user is effectively no longer on the channel. - On the other side, it might be useful to access the channel data from - this event, thus the handler is called effectively just BEFORE the - user effectively leaves the channel (and thus BEFORE the channel window gets - destroyed).[br] - Sine this event is triggered in the chanel window, - you can get the channel name by using the [fnc]$target[/fnc] function.[br] - Calling 'halt' in this event will stop the part message output.[br] - @seealso: - [event:onmejoin]OnMeJoin[/event], [event:OnJoin]OnJoin[/event], - [event:onpart]OnPart[/event] - */ - EVENT("OnMePart", \ - "$0 = part message"), - - /* - @doc: onkick - @type: - event - @title: - OnKick - @short: - Non-local user is being kicked from a channel - @parameters: - $0 = source nickname - $1 = source username - $2 = source hostname - $3 = kicked nickname - $4 = kick reason - @window: - Channel - @description: - Triggered when a non-local user is being kicked from a channel.[br] - The KICK message has already been processed by the server, so - the user is effectively no longer on the channel. - On the other side, it might be useful to access the user-related channel data from - this event, thus the handler is called effectively just BEFORE the - user is effectively removed from the channel internal structures.[br] - Sine this event is triggered in the chanel window, - you can get the channel name by using the [fnc]$target[/fnc] function.[br] - Calling 'halt' in this event will stop the kick message output.[br] - @seealso: - [event:onmekick]OnMeKick[/event] - */ - EVENT("OnKick", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = kicked nick\n" \ - "$4 = reason"), - - /* - @doc: onmekick - @type: - event - @title: - OnMeKick - @short: - Local user is being kicked from a channel - @parameters: - $0 = source nickname - $1 = source username - $2 = source hostname - $3 = kick reason - @window: - Channel - @description: - Triggered when the local user has been kicked from a channel.[br] - The KICK message has already been processed by the server, so - the user is effectively no longer on the channel. - On the other side, it might be useful to access the user-related channel data from - this event, thus the handler is called effectively just BEFORE the - user is effectively removed from the channel internal structures - (and thus BEFORE the channel data itself gets destroyed).[br] - Sine this event is triggered in the chanel window, - you can get the channel name by using the [fnc]$target[/fnc] function.[br] - Calling 'halt' in this event will stop the kick message output.[br] - @seealso: - [event:onkick]OnKick[/event] - */ - EVENT("OnMeKick", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = reason"), - - /* - @doc: ontopic - @type: - event - @title: - OnTopic - @short: - Topic change on a channel - @parameters: - $0 = nickname - $1 = username - $2 = hostname - $3 = new topic string - @window: - Channel - @description: - Triggered when a TOPIC message is received for a given channel.[br] - The topic change has not been executed effectively in the current window - so you can still access the old topic by the channel functions.[br] - The new topic is passed as fourth parameter and will effectively - become the current topic just after this event handler has been executed.[br] - Sine this event is triggered in the chanel window, - you can get the channel name by using the [fnc]$target[/fnc] function.[br] - Calling 'halt' in this event will stop the topic message output.[br] - @seealso: - [event:onmejoin]OnMeJoin[/event] - */ - EVENT("OnTopic", \ - "$0 = nickname\n" \ - "$1 = username\n" \ - "$2 = hostname\n" \ - "$3 = topic"), - - /* - @doc: onquit - @type: - event - @title: - OnQuit - @short: - An user is leaving IRC - @parameters: - $0 = nickname - $1 = username - $2 = hostname - $3 = quit message - $4 = channels - @window: - Console - @description: - Triggered when an user is quitting IRC.[br] - The QUIT message has already been processed by the server, so - the user is effectively no longer on IRC. - On the other side, it might be useful to access the user-related data from - this event, thus the handler is called effectively just BEFORE the - user is effectively removed from the IRC user list (and thus from the channels and query windows).[br] - The fifth parameter ($4) contains the list of channels on that the user was - just before quitting. - Calling 'halt' in this event will stop the quit message output (in ALL the windows!).[br] - @seealso: - [event:onpart]OnPart[/event], - [event:onmepart]OnMePart[/event] - @examples: - [example] - foreach(%cname,$4)echo -r=$channel(%cname) User $0 is quitting... - [/example] - */ - EVENT("OnQuit", \ - "$0 = nickname\n" \ - "$1 = username\n" \ - "$2 = hostname\n" \ - "$3 = part message\n" \ - "$4 = channels"), - - // IRC modes - /* - @doc: OnChannelModeChange - @type: - event - @title: - OnChannelModeChange - @short: - The channel mode has been changed - @parameters: - $0 = source nick - $1 = source user - $2 = source host - $3 = modeflags - $4 = mode parameter string - @window: - channel - @description: - Triggered when a channel mode has been changed, AFTER all the mode specific events - were triggered. $3 contains the unparsed mode flags (-o+b...) and $4 contains - the unparsed mode parameter string (you need to split it!). - */ - EVENT("OnChannelModeChange", \ - "$0 = sourcenick\n" \ - "$1 = sourceusername\n" \ - "$2 = sourcehost\n" \ - "$3 = modeflags\n" \ - "$4 = mode params"), - - /* - @doc: onusermodechange - @type: - event - @title: - OnUserModeChange - @short: - The local user has changed mode - @parameters: - $0 = mode flags - @window: - Console - @description: - Triggered when the local user has changed his user mode.[br] - The first parameter is the changed mode flag with a leading '+' or '-' sign: - if the mode was removed it will be something like "-x", otherwise something like "+x".[br] - Calling 'halt' in this event will stop the "mode" message output.[br] - */ - EVENT("OnUserModeChange", \ - "$0 = mode flags"), - - /* - @doc: onban - @type: - event - @title: - OnBan - @short: - Someone has set a +b flag on the channel - @parameters: - $0 = source nick - $1 = source username - $2 = source hostname - $3 = ban mask - @window: - Channel window - @description: - Triggered when someone sets a +b flag on the channel - @seealso: - [event:onunban]OnUnban[/event] - */ - EVENT("OnBan", \ - "$0 = source nick\n" - "$1 = source username\n" - "$2 = source hostname\n" - "$3 = ban mask"), - - /* - @doc: onunban - @type: - event - @title: - OnUnban - @short: - Someone has set a -b flag on the channel - @parameters: - $0 = source nick - $1 = source username - $2 = source hostname - $3 = unban mask - @window: - Channel window - @description: - Triggered when someone sets a -b flag on the channel - @seealso: - [event:onban]OnBan[/event] - */ - EVENT("OnUnBan", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = ban mask"), - - /* - @doc: onmeban - @type: - event - @title: - OnMeBan - @short: - Local user is being banned in a channel - @parameters: - $0 = source nickname - $1 = source username - $2 = source hostname - $3 = ban mask - @window: - Channel - @description: - Triggered when someone has set a +b flag that matches your mask (bans you) in the channel.[br] - @seealso: - [event:onmeunban]OnMeUnban[/event] - */ - EVENT("OnMeBan", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = ban mask"), - - /* - @doc: onmeunban - @type: - event - @title: - OnMeUnban - @short: - Local user is being de-banned in a channel - @parameters: - $0 = source nickname - $1 = source username - $2 = source hostname - $3 = ban mask - @window: - Channel - @description: - Triggered when someone has set a -b flag that matches your mask (debans you) in the channel.[br] - @seealso: - [event:onmeban]OnMeBan[/event] - */ - EVENT("OnMeUnban", \ - "$0 = source nick\n" - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = ban mask"), - - /* - @doc: onbanexception - @type: - event - @title: - OnBanException - @short: - Someone has set a +e flag on the channel - @parameters: - $0 = source nick - $1 = source username - $2 = source hostname - $3 = banexception mask - @window: - Channel window - @description: - Triggered when someone sets a +e (Ban Exception) flag on the channel - @seealso: - [event:onbanexceptionremove]OnBanExceptionRemove[/event] - */ - EVENT("OnBanException", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = ban exception mask"), - - /* - @doc: onbanexceptionremove - @type: - event - @title: - OnBanExceptionRemove - @short: - Someone has set a -e flag on the channel - @parameters: - $0 = source nick - $1 = source username - $2 = source hostname - $3 = unban mask - @window: - Channel window - @description: - Triggered when someone sets a -e (Removed a Ban Exception) flag on the channel - @seealso: - [event:onbanexception]OnBanException[/event] - */ - EVENT("OnBanExceptionRemove", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = ban exception mask"), - - /* - @doc: onmebanexception - @type: - event - @title: - OnMeBanException - @short: - Someone has set a +e flag on the local user - @parameters: - $0 = source nick - $1 = source username - $2 = source hostname - $3 = mask - @window: - Channel window - @description: - Triggered when someone sets a +e (puts a Ban Exception) flag on the local user in the active channel - @seealso: - [event:onmebanexceptionremove]OnMeBanExceptionRemove[/event] - */ - EVENT("OnMeBanException", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = mask"), - - /* - @doc: onmebanexceptionremove - @type: - event - @title: - OnMeBanExceptionRemove - @short: - Someone has set a -e flag on the local user - @parameters: - $0 = source nick - $1 = source username - $2 = source hostname - $3 = mask - @window: - Channel window - @description: - Triggered when someone sets a -e (removes a Ban Exception) flag on the local user in the active channel - @seealso: - [event:onmebanexception]OnMeBanException[/event] - */ - EVENT("OnMeBanExceptionRemove", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = mask"), - - /* - @doc: oninvite - @type: - event - @title: - OnInvite - @short: - The local user has received an invitation - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = channel - @window: - Active window/console - @description: - Triggered when someone invites the local user to join a channel - */ - EVENT("OnInvite", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = channel"), - - /* - @doc: oninviteexception - @type: - event - @title: - OnInviteException - @short: - A +I mode has been set - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = target mask - @window: - Channels window - @description: - Someone has set mode +I on a channel - @seealso: - [event:oninviteexceptionremove]OnInviteExceptionRemove[/event] - */ - EVENT("OnInviteException", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = target mask"), - - /* - @doc: oninviteexceptionremove - @type: - event - @title: - OnInviteExceptionRemove - @short: - Mode -I has been set - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = target mask - @window: - Channels window - @description: - Someone has set mode -I on a channel - @seealso: - [event:oninviteexceptionremove]OnInviteExceptionRemove[/event] - */ - EVENT("OnInviteExceptionRemove", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = target mask"), - - /* - @doc: onmeinviteexception - @type: - event - @title: - OnMeInviteException - @short: - A +I mode has been set on the local user - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = mask - @window: - Channels window - @description: - Someone has set mode +I on a channel with a target mask that matches - the local user mask - @seealso: - [event:onmeinviteexceptionremove]OnMeInviteExceptionRemove[/event] - */ - EVENT("OnMeInviteException", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = mask"), - - /* - @doc: onmeinviteexceptionremove - @type: - event - @title: - OnMeInviteExceptionRemove - @short: - Move -I has been set - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = mask - @window: - Channels window - @description: - Someone has set mode -I on a channel with a target mask that matches - the local user mask - @seealso: - [event:onmeinviteexceptionremove]OnMeInviteExceptionRemove[/event] - */ - EVENT("OnMeInviteExceptionRemove", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = mask"), - - /* - @doc: onlimitset - @type: - event - @title: - OnLimitSet - @short: - The channel users limit has been set - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = limit - @window: - Channels window - @description: - Triggered when someone change or sets the active channel user limit (+l) - @seealso: - [event:onlimitunset]OnLimitUnset[/event] - */ - EVENT("OnLimitSet", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = limit"), - - /* - @doc: onlimitunset - @type: - event - @title: - OnLimitUnSet - @short: - The channel users limit has been unset - @parameters: - $0 = source nick - $1 = source username - $2 = source host - @window: - Channels window - @description: - Triggered when someone unsets the active channel user limit (-l) - @seealso: - [event:onlimitunset]OnLimitUnset[/event] - */ - EVENT("OnLimitUnset", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname"), - - /* - @doc: onkeyset - @type: - event - @title: - OnKeySet - @short: - The channel users key has been set - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = key - @window: - Channels window - @description: - Triggered when someone change or sets the active channel access key (+k) - @seealso: - [event:onkeyunset]OnKeyUnset[/event] - */ - EVENT("OnKeySet", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = key"), - - /* - @doc: onkeyunset - @type: - event - @title: - OnKeyUnset - @short: - The channel users key has been unset - @parameters: - $0 = source nick - $1 = source username - $2 = source host - @window: - Channels window - @description: - Triggered when someone unsets the active channel access key (-k) - @seealso: - [event:onkeyunset]OnKeyUnset[/event] - */ - EVENT("OnKeyUnset", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname"), - - /* - @doc: onnickchange - @type: - event - @title: - OnNickChange - @short: - Someone has changed his nickname - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = new nickname - @window: - Console window - @description: - Triggered when someone has changed his nickname. - The change has already been processed by the server, but not by the local KVIrc database. - @seealso: - [event:onmenickchange]OnMeNickChange[/event] - */ - EVENT("OnNickChange", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = new nickname"), - - /* - @doc: onmenickchange - @type: - event - @title: - OnMeNickChange - @short: - The local user has changed his nickname - @parameters: - $0 = old nick - $1 = new nickname - @window: - Console window - @description: - Triggered when the local user is going to change his nickname. - The change has already been processed by the server, but not by the local KVIrc database. - @seealso: - [event:onnickchange]OnNickChange[/event] - */ - EVENT("OnMeNickChange", \ - "$0 = old nick\n" \ - "$1 = new nick"), - - /* - @doc: onchanowner - @type: - event - @title: - OnChanOwner - @short: - Someone has given a user the +q flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = target nick - @window: - Channels window - @description: - Triggered when someone sets a +q (has made Channel Owner) flag on a user of the active channel. - @seealso: - [event:ondechanowner]OnDeChanOwner[/event] - */ - EVENT("OnChanOwner", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = target nick"), - - /* - @doc: ondechanowner - @type: - event - @title: - OnDeChanOwner - @short: - Someone has given a user the -q flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = target nick - @window: - Channels window - @description: - Triggered when someone sets a -q (DeChanOwner) flag on a user in the active channel. - @seealso: - [event:onchanowner]OnChanOwner[/event] - */ - EVENT("OnDeChanOwner", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = target nick"), - - /* - @doc: onmechanowner - @type: - event - @title: - OnMeChanOwner - @short: - Someone has given the +q flag to the local user - @parameters: - $0 = source nick - $1 = source username - $2 = source host - @window: - Channels window - @description: - Triggered when someone sets a +q (has made Channel owner) flag on the local user in the active channel. - @seealso: - [event:onmedechanowner]OnMeDeChanOwner[/event] - */ - EVENT("OnMeChanOwner", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname"), - - /* - @doc: onmedechanowner - @type: - event - @title: - OnMeDeChanOwner - @short: - Someone has given the -q flag to the local user - @parameters: - $0 = source nick - $1 = source username - $2 = source host - @window: - Channels window - @description: - Triggered when someone sets a -q (has removed channel owner status) flag on the local user in the active channel. - @seealso: - [event:onmechanowner]OnMeChanOwner[/event] - */ - EVENT("OnMeDeChanOwner", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname"), - - /* - @doc: onchanadmin - @type: - event - @title: - OnChanAdmin - @short: - Someone has given a user the +a flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = target nick - @window: - Channels window - @description: - Triggered when someone sets a +a (has made Channel Administrator) flag on a user of the active channel. - @seealso: - [event:ondechanadmin]OnDeChanAdmin[/event] - */ - EVENT("OnChanAdmin", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = target nick"), - - /* - @doc: ondechanadmin - @type: - event - @title: - OnDeChanAdmin - @short: - Someone has given a user the -a flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = target nick - @window: - Channels window - @description: - Triggered when someone sets a -a (DeChanAdmin) flag on a user in the active channel. - @seealso: - [event:onchanadmin]OnChanAdmin[/event] - */ - EVENT("OnDeChanAdmin", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = target nick"), - - /* - @doc: onmechanadmin - @type: - event - @title: - OnMeChanAdmin - @short: - Someone has given the +a flag to the local user - @parameters: - $0 = source nick - $1 = source username - $2 = source host - @window: - Channels window - @description: - Triggered when someone sets a +a (has made Channel administrator) flag on the local user in the active channel. - @seealso: - [event:onmedeop]OnMeDeChanAdmin[/event] - */ - EVENT("OnMeChanAdmin", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname"), - - /* - @doc: onmedechanadmin - @type: - event - @title: - OnMeDeChanAdmin - @short: - Someone has given the -a flag to the local user - @parameters: - $0 = source nick - $1 = source username - $2 = source host - @window: - Channels window - @description: - Triggered when someone sets a -a (has removed channel admin status) flag on the local user in the active channel. - @seealso: - [event:onmeop]OnMeOp[/event] - */ - EVENT("OnMeDeChanAdmin", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname"), - - /* - @doc: onop - @type: - event - @title: - OnOp - @short: - Someone has given a user the +o flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = opped nick - @window: - Channels window - @description: - Triggered when someone sets a +o (has made Op) flag on a user of the active channel. - @seealso: - [event:ondeop]OnDeOp[/event] - */ - EVENT("OnOp", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = opped nick"), - - /* - @doc: ondeop - @type: - event - @title: - OnDeOp - @short: - Someone has given a user the -o flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = deopped nick - @window: - Channels window - @description: - Triggered when someone sets a -o (DeOp) flag on a user in the active channel. - @seealso: - [event:onop]OnOp[/event] - */ - EVENT("OnDeOp", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = deopped nick"), - - /* - @doc: onmeop - @type: - event - @title: - OnMeOp - @short: - Someone has given the +o flag to the local user - @parameters: - $0 = source nick - $1 = source username - $2 = source host - @window: - Channels window - @description: - Triggered when someone sets a +o (has made Op) flag on the local user in the active channel. - @seealso: - [event:onmedeop]OnMeDeOp[/event] - */ - EVENT("OnMeOp", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname"), - - /* - @doc: onmedeop - @type: - event - @title: - OnMeDeOp - @short: - Someone has given the -o flag to the local user - @parameters: - $0 = source nick - $1 = source username - $2 = source host - @window: - Channels window - @description: - Triggered when someone sets a -o (has deoped) flag on the local user in the active channel. - @seealso: - [event:onmeop]OnMeOp[/event] - */ - EVENT("OnMeDeOp", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname"), - - /* - @doc: onhalfop - @type: - event - @title: - OnHalfOp - @short: - Someone has given a user the +h flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = halfopped nick - @window: - Channels window - @description: - Triggered when someone sets a +h flag on a user of the active channel. - @seealso: - [event:ondehalfop]OnDeHalfOp[/event] - */ - EVENT("OnHalfOp", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = halfopped nick"), - - /* - @doc: ondehalfop - @type: - event - @title: - OnDeHalfOp - @short: - Someone has given a user the -h flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = dehalfopped nick - @window: - Channels window - @description: - Triggered when someone sets a -h (dehalfop) flag on a user in the active channel. - @seealso: - [event:onhalfop]OnHalfOp[/event] - */ - EVENT("OnDeHalfOp", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = dehalfopped nick"), - - /* - @doc: onmehalfop - @type: - event - @title: - OnMeHalfOp - @short: - Someone has given the local user the +h flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - @window: - Channels window - @description: - Triggered when someone sets a +h (halfop) flag for the local user in the active channel. - @seealso: - [event:onmedehalfop]OnMeDeHalfOp[/event] - */ - EVENT("OnMeHalfOp", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname"), - - /* - @doc: onmedehalfop - @type: - event - @title: - OnMeDeHalfOp - @short: - Someone has given the local user the -h flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - @window: - Channels window - @description: - Triggered when someone sets a -h (dehalfop) flag for the local user in the active channel. - @seealso: - [event:onmehalfop]OnMeHalfOp[/event] - */ - EVENT("OnMeDeHalfOp", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname"), - - /* - @doc: onvoice - @type: - event - @title: - OnVoice - @short: - Someone has given a user the +v flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = voiced nick - @window: - Channels window - @description: - Triggered when someone sets a +v (voice) flag to someone in the active channel. - @seealso: - [event:ondevoice]OnDeVoice[/event] - */ - EVENT("OnVoice", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = voiced nick"), - - /* - @doc: ondevoice - @type: - event - @title: - OnDeVoice - @short: - Someone has given a user the -v flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = devoiced nick - @window: - Channels window - @description: - Triggered when someone sets a -v (devoice) flag to someone in the active channel. - @seealso: - [event:ondevoice]OnDeVoice[/event] - */ - EVENT("OnDeVoice", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = voiced nick"), - - /* - @doc: onmevoice - @type: - event - @title: - OnMeVoice - @short: - Someone has give the local user a +v flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - @window: - Channels window - @description: - Triggered when someone sets a +v (devoice) flag for the local user in the active channel. - @seealso: - [event:onmedevoice]OnMeDeVoice[/event] - */ - EVENT("OnMeVoice", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname"), - - /* - @doc: onmedevoice - @type: - event - @title: - OnMeDeVoice - @short: - Someone has give the local user a -v flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - @window: - Channels window - @description: - Triggered when someone sets a -v (devoice) flag for the local user in the active channel. - @seealso: - [event:onmevoice]OnMeVoice[/event] - */ - EVENT("OnMeDeVoice", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname"), - - /* - @doc: onuserop - @type: - event - @title: - OnUserOp - @short: - Someone has given a user the +u flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = useropped nick - @window: - Channels window - @description: - Triggered when someone sets a +u flag on a user of the active channel. - @seealso: - [event:ondeuserop]OnDeUserOp[/event] - */ - EVENT("OnUserOp", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = useropped nick"), - - /* - @doc: ondeuserop - @type: - event - @title: - OnDeUserOp - @short: - Someone has given a user a -u flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = deuseropped nick - @window: - Channels window - @description: - Triggered when someone sets a -u (deuserop) flag on a user in the active channel. - @seealso: - [event:onuserop]OnUserOp[/event] - */ - EVENT("OnDeUserOp", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = deuseropped nick"), - - /* - @doc: onmeuserop - @type: - event - @title: - OnMeUserOp - @short: - Someone has given the local user the +u flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - @window: - Channels window - @description: - Triggered when someone sets a +u (userop) flag for the local user in the active channel. - @seealso: - [event:onmedeuserop]OnMeDeUserOp[/event] - */ - EVENT("OnMeUserOp", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname"), - - /* - @doc: onmedeuserop - @type: - event - @title: - OnMeDeUserOp - @short: - Someone has given the local user the -u flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - @window: - Channels window - @description: - Triggered when someone sets a -u (deuserop) flag for the local user in the active channel. - @seealso: - [event:onmeuserop]OnMeUserOp[/event] - */ - EVENT("OnMeDeUserOp", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname"), - - /* - @doc: onircop - @type: - event - @title: - OnIrcOp - @short: - Someone has given a user the +O flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = ircopped nick - @window: - Channels window - @description: - Triggered when someone sets a +O (has made IrcOp) flag on a user of the active channel. - @seealso: - [event:ondeircop]OnDeIrcOp[/event] - */ - EVENT("OnIrcOp", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = ircopped nick"), - - /* - @doc: ondeircop - @type: - event - @title: - OnDeIrcOp - @short: - Someone has given a user the -O flag - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = deircopped nick - @window: - Channels window - @description: - Triggered when someone sets a -O (DeIrcOp) flag on a user in the active channel. - @seealso: - [event:onircop]OnIrcOp[/event] - */ - EVENT("OnDeIrcOp", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = deircopped nick"), - - /* - @doc: onmeircop - @type: - event - @title: - OnMeIrcOp - @short: - Someone has given the +O flag to the local user - @parameters: - $0 = source nick - $1 = source username - $2 = source host - @window: - Channels window - @description: - Triggered when someone sets a +O (has made IrcOp) flag on the local user in the active channel. - @seealso: - [event:onmedeircop]OnMeDeIrcOp[/event] - */ - EVENT("OnMeIrcOp", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname"), - - /* - @doc: onmedeircop - @type: - event - @title: - OnMeDeIrcOp - @short: - Someone has given the -O flag to the local user - @parameters: - $0 = source nick - $1 = source username - $2 = source host - @window: - Channels window - @description: - Triggered when someone sets a -O (DeIrcOp) flag on the local user in the active channel. - @seealso: - [event:onmeircop]OnMeIrcOp[/event] - */ - EVENT("OnMeDeIrcOp", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname"), - - // Services - /* - @doc: onchanservnotice - @type: - event - @title: - OnChanServNotice - @short: - A notice from ChanServ has been received - @parameters: - $0 = ChanServ nick - $1 = ChanServ username - $2 = ChanServ host - $3 = message - @window: - console - @description: - Triggered when a notice is received and the source user is recognized as - the ChanServ service.
- Calling [cmd]halt[/cmd] stops the message output. - @seealso: - [event:onquerynotice]OnQueryNotice[/event] - [event:onnickservnotice]OnNickServNotice[/event] - */ - EVENT("OnChanServNotice", \ - "$0 = ChanServ nick\n" \ - "$1 = ChanServ username\n" \ - "$2 = ChanServ host\n" \ - "$3 = message"), - - /* - @doc: onnickservnotice - @type: - event - @title: - OnNickServNotice - @short: - A notice from NickServ has been received - @parameters: - $0 = NickServ nick - $1 = NickServ username - $2 = NickServ host - $3 = message - @window: - console - @description: - Triggered when a notice is received and the source user is recognized as - the NickServ service (the source nick is 'NickServ' or its mask matches - a mask defined in the Nickserver identify options).[br] - Calling [cmd]halt[/cmd] stops the message output. - @seealso: - [event:onquerynotice]OnQueryNotice[/event] - [event:onchanservnotice]OnChanServNotice[/event] - */ - EVENT("OnNickServNotice", \ - "$0 = NickServ nick\n" \ - "$1 = NickServ username\n" \ - "$2 = NickServ host\n" \ - "$3 = message"), - - /* - @doc: OnNickServAuth - @type: - event - @title: - OnNickServAuth - @short: - Triggered when ircd sets a registered user mode. - @parameters: - @window: - any - @description: - Triggered when ircd sets a registered user mode. - */ - EVENT("OnNickServAuth",""), - - // CTCPs - /* - @doc: onaction - @type: - event - @title: - OnAction - @short: - Someone issued a CTCP ACTION - @parameters: - $0 = source nick - $1 = source username - $2 = source host - $3 = message target - $4 = action message text - @window: - Channels and query windows - @description: - This event is triggered when a remote user issues a CTCP ACTION.[br] - (The CTCP ACTION is usually triggered by the /me command).[br] - The parameters $0-$2 identify the source user.[br] - $3 identifies the message target and can be one of the following:[br] - - The local user nickname : this is a private CTCP ACTION and is triggered inside a query window.[br] - - A channel name : this is a channel CTCP ACTION and is triggered in the channel window.[br] - - Any other string : this is either a broadcast CTCP ACTION (sent by a privileged user - to a subset of clients) or a sign of the server brain damage :D In this - case the event is triggered in the console window.[br] - Calling [cmd]halt[/cmd] in this event stops the message output.[br] - */ - EVENT("OnAction", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = message target\n" \ - "$4 = action message text"), - - /* - @doc: onmeaction - @type: - event - @title: - OnMeAction - @short: - User issued a CTCP ACTION - @parameters: - $0 = action message text - $1 = action target (channel or nickname) - @window: - Channels and query windows - @description: - This event is triggered when user issues a CTCP ACTION.[br] - (The CTCP ACTION is usually triggered by the /me command).[br] - Warning: don't use a /me inside this event handler, or you'll get an infinite recursion. - If you need to halt the action (eg. to do some text substitution), follow the example code. - @examples: - [example] - ctcp $1 action "this text was changed in scripting, old one was $0"; - echo -i=$msgtype(action) -w=$active "$me this text was changed in scripting, old one was $0"; - halt; - [/example] - */ - EVENT("OnMeAction", \ - "$0 = action message text\n" \ - "$1 = action target"), - - /* - @doc: onctcprequest - @type: - event - @title: - OnCTCPRequest - @short: - A CTCP request has been received - @parameters: - $0 = source nick - $1 = source user - $2 = source host - $3 = target - $4 = ctcp type - $5- = ctcp parameters - @window: - Console window - @description: - A CTCP request has been received.[br] - If you call [cmd]halt[/cmd] in this event, you will stop the further processing of the CTCP (thus, you can disable some of the KVIrc features).[br] - Be careful when using this. - @seealso: - [event:onctcpreply]OnCTCPReply[/event] - */ - EVENT("OnCTCPRequest", \ - "$0 = source nick\n" \ - "$1 = source user\n" \ - "$2 = source host\n" \ - "$3 = target\n" \ - "$4 = ctcp type\n" \ - "$5- = ctcp parameters"), - - /* - @doc: onctcpreply - @type: - event - @title: - OnCTCPReply - @short: - A CTCP reply has been received - @parameters: - $0 = source nick - $1 = source user - $2 = source host - $3 = target - $4 = ctcp type - $5- = ctcp parameters - @window: - Console window - @description: - A CTCP reply has been received.[br] - If you call [cmd]halt[/cmd] in this event, you will stop the further processing of the CTCP (thus, you can disable some of the KVIrc features).[br] - Be careful when using this. - @seealso: - [event:onctcpreply]OnCTCPReply[/event] - */ - EVENT("OnCTCPReply", \ - "$0 = source nick\n" \ - "$1 = source user\n" \ - "$2 = source host\n" \ - "$3 = target\n" \ - "$4 = ctcp type\n" \ - "$5- = ctcp parameters"), - - /* - @doc: onctcpflood - @type: - event - @title: - OnCTCPFlood - @short: - Someone tried to flood you with CTCP requests - @parameters: - $0 = source nick - $1 = source username - $2 = source hostname - $3 = target - $4 = ctcp type - $5- = ctcp parameters - @window: - Console window - @description: - On IRC there is a kind of attack called 'CTCP Flood'. It consist of a lot of CTCP request in a short period of time, trying to made your client reply to them and made the server kick you. This event is triggered when one of such attacks is detected. - @seealso: - [event:onctcprequest]OnCTCPRequest[/event] - [event:onctcpreply]OnCTCPReply[/event] - */ - EVENT("OnCTCPFlood", \ - "$0 = source nick\n" \ - "$1 = source username\n" \ - "$2 = source hostname\n" \ - "$3 = target\n" \ - "$4 = ctcp type\n" \ - "$5- = ctcp parameters"), - - /* - @doc: ondccsessioncreated - @type: - event - @title: - OnDCCSessionCreated - @short: - A new DCC session has just been created - @parameters: - $0 = DCC session ID - @window: - console - @description: - Triggered when a new DCC session has just been created. - You can retrieve the session information by calling the [module:dcc]dcc[/module].* - module functions. - */ - EVENT("OnDCCSessionCreated", \ - "$0 = DCC session ID"), - - /* - @doc: ondccsessiondestroyed - @type: - event - @title: - OnDCCSessionDestroyed - @short: - A new DCC session has just been destroyed - @parameters: - $0 = DCC session ID - @window: - console - @description: - Triggered when a new DCC session has just been destroyed. - You can retrieve the session information by calling the [module:dcc]dcc[/module].* - module functions and by passing the DCC session ID parameter. - */ - EVENT("OnDCCSessionDestroyed", \ - "$0 = DCC session ID"), - - /* - @doc: ondccchatwindowcreated - @type: - event - @title: - OnDCCChatWindowCreated - @short: - A DCC Chat window has been just created - @parameters: - $0 = DCC session ID - @window: - DCC Chat - @description: - A DCC Chat window has been just created. - The [module:dcc]dcc[/module] module functions - can be used to retrieve the information about the - window and the data transfer.[br] - The DCC Chat connection attempt starts from here: - you can get [event:ondccchatterminated]OnDCCChatError[/event] - in any moment - @seealso: - [event:ondccchatterminated]OnDCCChatTerminated[/event] - */ - EVENT("OnDCCChatWindowCreated", \ - "$0 = DCC session ID"), - - /* - @doc: ondccchatconnectioninprogress - @type: - event - @title: - OnDCCChatConnectionInProgress - @short: - A DCC Chat connection has just been started - @parameters: - $0 = DCC session ID - @window: - DCC Chat - @description: - A DCC Chat connection has just been started successfully. - The [module:dcc]dcc[/module] module functions - can be used to retrieve the information about the - window and the data transfer. - In case of a passive DCC Chat, the local ip and port - are known from the moment that this event triggers. - @seealso: - */ - EVENT("OnDCCChatConnectionInProgress", \ - "$0 = DCC session ID"), - - /* - @doc: ondccchatconnected - @type: - event - @title: - OnDCCChatConnected - @short: - A DCC Chat connection has been established - @parameters: - $0 = DCC session ID - @window: - DCC Chat - @description: - A DCC Chat connection has just been established. - The [module:dcc]dcc[/module] module functions - can be used to retrieve the information about the - window and the data transfer. - @seealso: - */ - EVENT("OnDCCChatConnected", \ - "$0 = DCC session ID"), - - /* - @doc: ondccchatmessage - @type: - event - @title: - OnDCCChatMessage - @short: - A DCC Chat message has just been received - @parameters: - $0 = message text - $1 = DCC session ID - @window: - DCC Chat - @description: - A DCC Chat message has just been received. - The [module:dcc]dcc[/module] module functions - can be used to retrieve the information about the - window and the data transfer. - @seealso: - */ - EVENT("OnDCCChatMessage", \ - "$0 = text\n" \ - "$1 = DCC session ID"), - - /* - @doc: ondccchaterror - @type: - event - @title: - OnDCCChatError - @short: - A DCC Chat error has just been triggered - @parameters: - $0 = error message - $1 = DCC session ID - @window: - DCC Chat - @description: - A DCC Chat error has just been triggered - The [module:dcc]dcc[/module] module functions - can be used to retrieve the information about the - window and the data transfer. - A DCC Chat can terminate because an error has - interrupted the connection or because - the local user has closed the window forcibly. - The remote end closing the connection is considered - an error. - @seealso: - */ - EVENT("OnDCCChatError", \ - "$0 = error message\n" \ - "$1 = DCC session ID"), - - /* - @doc: ondccchatdisconnected - @type: - event - @title: - OnDCCChatDisconnected - @short: - A DCC Chat has been just disconnected - @parameters: - $0 = DCC session ID - @window: - DCC Chat - @description: - A DCC Chat has just been disconnected for some reason. - The [module:dcc]dcc[/module] module functions - can be used to retrieve the information about the - window and the data transfer. - @seealso: - */ - EVENT("OnDCCChatDisconnected", \ - "$0 = DCC session ID"), - - /* - @doc: ondccchatwindowclosing - @type: - event - @title: - OnDCCChatWindowClosing - @short: - A DCC Chat is going to be closed - @parameters: - $0 = DCC session ID - @window: - DCC Chat - @description: - A DCC Chat window is going to be closed. - The [module:dcc]dcc[/module] module functions - can be used to retrieve the information about the - window and the data transfer. - @seealso: - */ - EVENT("OnDCCChatWindowClosing", \ - "$0 = DCC session ID"), - - /* - @doc: ondccfiletransferconnectioninprogress - @type: - event - @title: - OnDCCFileTransferConnectionInProgress - @short: - Triggered when a DCC File transfer is waiting for a connection - @parameters: - $0 = DCC session ID - @window: - unspecified - @description: - Triggered when a DCC File transfer has been set up and - is waiting for the connection to be established.[br] - Note that the real data transfer is not started until - [event:ondccfiletransferbegin]OnDCCFileTransferBegin[/event] is triggered - but from this moment on you will be notified of success - or failure by the means of [event:ondccfiletransfersuccess]OnDCCFileTransferSuccess[/event] - or [event:ondccfiletransferfailed]OnDCCFileTransferFailed[/event].[br] - You can retrieve the session information by calling the [module:dcc]dcc[/module].* - module functions and by passing the DCC session ID parameter. - @seealso: - [event:ondccfiletransferfailed]OnDCCFileTransferFailed[/event], - [event:ondccfiletransfersuccess]OnDCCFileTransferSuccess[/event], - [event:ondccfiletransferbegin]OnDCCFileTransferBegin[/event] - */ - EVENT("OnDCCFileTransferConnectionInProgress", \ - "$0 = DCC session ID"), - - /* - @doc: ondccfiletransferbegin - @type: - event - @title: - OnDCCFileTransferBegin - @short: - Triggered when a DCC File transfer begins - @parameters: - $0 = DCC session ID - @window: - unspecified - @description: - Triggered when a DCC file transfer connection is established - and the real data transfer starts.[br] - You can retrieve the session information by calling the [module:dcc]dcc[/module].* - module functions and by passing the DCC session ID parameter. - @seealso: - [event:ondccfiletransferconnectioninprogress]OnDCCFileTransferConnectionInProgress[/event], - [event:ondccfiletransfersuccess]OnDCCFileTransferSuccess[/event], - [event:ondccfiletransferfailed]OnDCCFileTransferFailed[/event] - */ - EVENT("OnDCCFileTransferBegin", \ - "$0 = DCC session ID"), - - /* - @doc: ondccfiletransfersuccess - @type: - event - @title: - OnDCCFileTransferSuccess - @short: - Triggered when a DCC File transfer succeeds - @parameters: - $0 = bytes transferred - $1 = DCC session ID - @window: - unspecified - @description: - Triggered when a DCC File transfer terminates successfully.[br] - $0 contains the number of bytes transferred in the session.[br] - You can retrieve the session information by calling the [module:dcc]dcc[/module].* - module functions and by passing the DCC session ID parameter. - @seealso: - [event:ondccfiletransferconnectioninprogress]OnDCCFileTransferConnectionInProgress[/event], - [event:ondccfiletransferfailed]OnDCCFileTransferFailed[/event], - [event:ondccfiletransferbegin]OnDCCFileTransferBegin[/event] - */ - EVENT("OnDCCFileTransferSuccess", \ - "$0 = bytes transferred\n" \ - "$1 = DCC session ID"), - - /* - @doc: ondccfiletransferfailed - @type: - event - @title: - OnDCCFileTransferFailed - @short: - Triggered when a DCC File transfer fails - @parameters: - $0 = failure reason message - $1 = bytes transferred - $2 = DCC session ID - @window: - unspecified - @description: - Triggered when a DCC File transfer fails. $0 contains a message - explaining the reason of the failure.[br] - $1 contains the number of bytes transferred in the session, eventually 0.[br] - You can retrieve the session information by calling the [module:dcc]dcc[/module].* - module functions and by passing the DCC session ID parameter. - @seealso: - [event:ondccfiletransferconnectioninprogress]OnDCCFileTransferConnectionInProgress[/event], - [event:ondccfiletransfersuccess]OnDCCFileTransferSuccess[/event], - [event:ondccfiletransferbegin]OnDCCFileTransferBegin[/event] - */ - EVENT("OnDCCFileTransferFailed", \ - "$0 = failure reason\n" \ - "$1 = bytes transferred\n" \ - "$2 = DCC session ID"), - - // Link clicks - /* - @doc: OnChannelNickLinkClick - @type: - event - @title: - OnChannelNickLinkClick - @short: - Clicked on nick in channel - @parameters: - $0 = nick list - @window: - channel - @description: - Triggered when user clicks on nickname in channel window - It will be triggered only at the left mouse button click - */ - EVENT("OnChannelNickLinkClick", \ - "$0 = nick list"), - - /* - @doc: OnQueryNickLinkClick - @type: - event - @title: - OnQueryNickLinkClick - @short: - Triggered when user clicks on nickname in query window - @parameters: - $0 = nickname list - @window: - query - @description: - Triggered when user clicks on nickname in query window - It will be triggered only at the left mouse button click - */ - EVENT("OnQueryNickLinkClick", \ - "$0 = nickname list"), - - /* - @doc: OnConsoleNickLinkClick - @type: - event - @title: - OnConsoleNickLinkClick - @short: - Triggered when user clicks on nickname in console window - @parameters: - $0 = nickname - @window: - console - @description: - Triggered when user clicks on nickname in console window - It will be triggered only at the left mouse button click - */ - EVENT("OnConsoleNickLinkClick", \ - "$0 = nickname"), - - /* - @doc: OnHostLinkClick - @type: - event - @title: - OnHostLinkClick - @short: - Triggered when user clicks on any hostname in any window - @parameters: - $0 = host name - @window: - any - @description: - Triggered when user clicks on any hostname in any window - It will be triggered only at the left mouse button click - */ - EVENT("OnHostLinkClick", \ - "$0 = host name"), - - /* - @doc: OnURLLinkClick - @type: - event - @title: - OnURLLinkClick - @short: - Triggered when user clicks on any URL link in any window - @parameters: - $0 = url - @window: - any - @description: - Triggered when user clicks on any URL link in any window - It will be triggered only at the left mouse button click - */ - EVENT("OnURLLinkClick", \ - "$0 = url"), - - /* - @doc: OnChannelLinkClick - @type: - event - @title: - OnChannelLinkClick - @short: - Triggered when user clicks on any channel name in any window - @parameters: - $0 = channel name - @window: - any - @description: - Triggered when user clicks on any channel name in any window - It will be triggered only at the left mouse button click - */ - EVENT("OnChannelLinkClick", \ - "$0 = channel name"), - - /* - @doc: OnServerLinkClick - @type: - event - @title: - OnServerLinkClick - @short: - Triggered when user clicks on server name in any window - @parameters: - $0 = server name - @window: - any - @description: - Triggered when user clicks on server name in any window - It will be triggered only at the left mouse button click - */ - EVENT("OnServerLinkClick", \ - "$0 = server name"), - - /* - @doc: ontextviewdoublecliked - @type: - event - @title: - OnTextViewDoubleClicked - @short: - Text view link double click customization - @parameters: - $0 = actual name - $1 - visible name - $2 - command name - @window: - The window that the user has clicked in - @description: - Actual name is equal to the command name if command name is not null. - Visible name is the link text (as it shown by user). - Command name is set if the visible name differs with the actual link target (probably contains mIRC colors,etc). It is equal to the actual target name. - This event is triggered when an user has double clicked on a text view and has not hit any link.[br] - I have no idea what you can do in this event....maybe some sort of channel-central dialog? :) - */ - EVENT("OnTextViewDoubleClicked",""), - - /* - @doc: onnicklinkdefaultactionrequest - @type: - event - @title: - OnNickLinkDefaultActionRequest - @short: - Nick link double click customization - @parameters: - $0 = actual name - $1 - visible name - $2 - command name - @window: - The window that the user has clicked in - @description: - Actual name is equal to the command name if command name is not null. - Visible name is the link text (as it shown by user) - Command name is set if the visible name differs with the actual link target(probably contains mIRC colors,etc). It is equal to the actual target name. - This event is triggered when an user has double clicked on a nickname link.[br] - You should use this event to perform some significant action associated with the double click.[br] - A good example might be a [cmd]whois[/cmd] or a [cmq]query[/cmd] call.[br] - Please note that NOT ALL nickname links will cause this event to be triggered: some nickname - links default actions are actually handled by the - [event:onquerynickdefaultactionrequest]OnQueryNickDefaultActionRequest[/event] and - [event:onchannelnickdefatulactionrequest]OnChannelNickDefaultActionRequest[/event] events.[br] - */ - EVENT("OnNickLinkDefaultActionRequest", \ - "$0 = actual name\n" \ - "$1 - visible name\n" \ - "$2 - command name"), - - /* - @doc: onchannelnickdefaultactionrequest - @type: - event - @title: - OnChannelNickDefaultActionRequest - @short: - Allows customization of the double click on nicknames - @parameters: - $0 = nick list - @window: - Channel window - @description: - @seealso: - [event:onchannelnickpopuprequest]OnChannelNickPopupRequest[/event] - */ - EVENT("OnChannelNickDefaultActionRequest", \ - "$0 = nick list"), - - /* - @doc: onquerynickdefaultactionrequest - @type: - event - @title: - OnQueryNickDefaultActionRequest - @short: - Query double click customization - @parameters: - $0 = actual name - $1 - visible name - $2 - command name - @window: - The window that the user has clicked in - @description: - Actual name is equal to the command name if command name is not null. - Visible name is the link text (as it shown by user) - Command name is set if the visible name differs with the actual link target(probably contains mIRC colors,etc). It is equal to the actual target name. - This event is triggered when an user has double clicked on a nickname in - the query target list.[br] - You should use this event to do some significant action associated with the double click.[br] - A good example might be a [cmd]whois[/cmd] query or a [cmd]dcc.chat[/cmd] - */ - EVENT("OnQueryNickDefaultActionRequest", \ - "$0 = actual name\n" \ - "$1 - visible name\n" \ - "$2 - command name"), - - /* - @doc: onwindowtitlerequest - @type: - event - @title: - OnWindowTitleRequest - @short: - Triggered when a window title needs to be set - @parameters: - none - @window: - Any window - @description: - This event is triggered when a KVIrc MDI or undocked window is in need of a window title change.[br] - You can set a customized window title and halt the default title from being set.[br] - @seealso: - [cmd]window.setWindowTitle[cmd] - */ - EVENT("OnWindowTitleRequest", \ - "$0 = window id\n" \ - "$1 = default window title"), - - /* - @doc: oninputbarpaste - @type: - event - @title: - OnInputBarPaste - @short: - Triggered when the user paste some text on the inputbar - @parameters: - none - @window: - Any window - @description: - This event is triggered when the user paste some text on the input bar.[br] - You can check the text, insert any other text and halt the orginal from being inserted in the input bar.[br] - Note that the text can contains binary data, end-of-line or other characters that could need a special treatment then parsed. - @seealso: - [cmd]window.insertInInputText[cmd] - */ - EVENT("OnInputBarPaste", \ - "$0 = window id\n" \ - "$1 = pasted text") - -}; diff --git a/src/kvirc/kvs/KviKvsEventTable.h b/src/kvirc/kvs/KviKvsEventTable.h deleted file mode 100644 index 22dbbfd4b..000000000 --- a/src/kvirc/kvs/KviKvsEventTable.h +++ /dev/null @@ -1,371 +0,0 @@ -#ifndef _KVI_KVS_EVENTTABLE_H_ -#define _KVI_KVS_EVENTTABLE_H_ -//============================================================================= -// -// File : KviKvsEventTable.h -// Creation date : Mon 23 Feb 2004 03:23:18 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2004-2010 Szymon Stefanek -// -// 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 KviKvsEventTable.h -* \author Szymon Stefanek -* \brief Events table -*/ - -// Application -/** -* \def KviEvent_OnKVIrcStartup Triggered at KVIrc startup -* \def KviEvent_OnKVIrcShutdown Triggered at KVIrc shutdown -* \def KviEvent_OnIrcContextCreated Triggered when the IRC context is created -* \def KviEvent_OnIrcContextDestroyed Triggered when the IRC context is destroyed -* \def KviEvent_OnFrameWindowCreated Triggered when the frame window is created -* \def KviEvent_OnFrameWindowDestroyed Triggered when the frame window is destroyed -* \def KviEvent_OnURL An URL appears in one of the output windows -* \def KviEvent_OnError Triggered when an ERROR message is received from the server -* \def KviEvent_OnAccelKeyPressed An accelerator key was pressed -* \def KviEvent_OnHighlight A channel or query message is going to be highlighted -* \def KviEvent_OnWindowActivated A window has just been activated -* \def KviEvent_OnNotifyOnLine A user in the notify list is on-line -* \def KviEvent_OnNotifyOffLine A user in the notify list went off-line -* \def KviEvent_OnPing Server ping handler -* \def KviEvent_OnPong Server pong handler -* \def KviEvent_OnLagAlarmTimeUp High-Lag Alarm Started -* \def KviEvent_OnLagAlarmTimeDown High-Lag Alarm Stopped -* \def KviEvent_OnLagCheck The lag metering engine has checked the lag -* \def KviEvent_OnTextInput The user has just entered some text in the text input -* \def KviEvent_OnNotifyListDefaultActionRequest Notify list double click customization -* \def KviEvent_OnWallops A WALLOPS message is received from the server -* \def KviEvent_OnIgnoredMessage Triggered when a message is ignored -* \def KviEvent_OnServerNotice A server NOTICE have been issued -* \def KviEvent_OnWindowTitleRequest A window title is needed -* \def KviEvent_OnInputBarPaste User pasted some text on the inputbar -*/ -#define KviEvent_OnKVIrcStartup 0 -#define KviEvent_OnKVIrcShutdown 1 -#define KviEvent_OnIrcContextCreated 2 -#define KviEvent_OnIrcContextDestroyed 3 -#define KviEvent_OnFrameWindowCreated 4 -#define KviEvent_OnFrameWindowDestroyed 5 -#define KviEvent_OnURL 6 -#define KviEvent_OnError 7 -#define KviEvent_OnAccelKeyPressed 8 -#define KviEvent_OnHighlight 9 -#define KviEvent_OnWindowActivated 10 -#define KviEvent_OnNotifyOnLine 11 -#define KviEvent_OnNotifyOffLine 12 -#define KviEvent_OnPing 13 -#define KviEvent_OnPong 14 -#define KviEvent_OnLagAlarmTimeUp 15 -#define KviEvent_OnLagAlarmTimeDown 16 -#define KviEvent_OnLagCheck 17 -#define KviEvent_OnTextInput 18 -#define KviEvent_OnNotifyListDefaultActionRequest 19 -#define KviEvent_OnWallops 20 -#define KviEvent_OnIgnoredMessage 21 -#define KviEvent_OnServerNotice 22 -#define KviEvent_OnWindowTitleRequest 145 -#define KviEvent_OnInputBarPaste 146 - -// Connection -/** -* \def KviEvent_OnIrcConnectionEstabilished Triggered when the IRC connection is established -* \def KviEvent_OnIrcConnectionTerminated Triggered when the IRC connection is terminated -* \def KviEvent_OnIrc Triggered when the login is completed -* \def KviEvent_OnNetsplit A netsplit has been detected -* \def KviEvent_OnDisconnectRequest Triggered when the user requests a disconnection -* \def KviEvent_OnHTTPGetTerminated A http.get command has terminated execution -* \def KviEvent_OnUnhandledLiteral An unhandled literal server message has been received -* \def KviEvent_OnOutboundTraffic Triggered when text is sent to the server -*/ -#define KviEvent_OnIRCConnectionEstabilished 23 -#define KviEvent_OnIRCConnectionTerminated 24 -#define KviEvent_OnIRC 25 -#define KviEvent_OnNetsplit 26 -#define KviEvent_OnDisconnectRequest 27 -#define KviEvent_OnHTTPGetTerminated 28 -#define KviEvent_OnUnhandledLiteral 29 -#define KviEvent_OnOutboundTraffic 30 - -// Popups -/** -* \def KviEvent_OnChannelPopupRequest Triggered when the channel text view is right-clicked -* \def KviEvent_OnConsolePopupRequest Triggered when the console text view is right-clicked -* \def KviEvent_OnQueryPopupRequest Triggered when the query text view is right-clicked -* \def KviEvent_OnWindowPopupRequest Triggered when the user middle-clicks in a text view (or right-clicks with the CTRL key pressed) -* \def KviEvent_OnHostLinkPopupRequest Triggered when an user right clicks on a hostname link in the text view -* \def KviEvent_OnURLLinkPopupRequest URL link popup customization -* \def KviEvent_OnServerLinkPopupRequest Server link popup customization -* \def KviEvent_OnChannelLinkPopupRequest Channel link popup customization -* \def KviEvent_OnNickLinkPopupRequest Nick link popup customization -* \def KviEvent_OnQueryNickPopupRequest Query nicklist popup customization -* \def KviEvent_OnChannelNickPopupRequest Allows customization of the nick-on-channel context popup -* \def KviEvent_OnNotifyListPopupRequest Notify list context popup customization -* \def KviEvent_OnDCCChatPopupRequest Triggered when the DCC chat text view is right-clicked -*/ -#define KviEvent_OnChannelPopupRequest 31 -#define KviEvent_OnConsolePopupRequest 32 -#define KviEvent_OnQueryPopupRequest 33 -#define KviEvent_OnWindowPopupRequest 34 -#define KviEvent_OnHostLinkPopupRequest 35 -#define KviEvent_OnURLLinkPopupRequest 36 -#define KviEvent_OnServerLinkPopupRequest 37 -#define KviEvent_OnChannelLinkPopupRequest 38 -#define KviEvent_OnNickLinkPopupRequest 39 -#define KviEvent_OnQueryNickPopupRequest 40 -#define KviEvent_OnChannelNickPopupRequest 41 -#define KviEvent_OnNotifyListPopupRequest 42 -#define KviEvent_OnDCCChatPopupRequest 43 - -// Channels -/** -* \def KviEvent_OnChannelWindowCreated A channel window has just been opened -* \def KviEvent_OnChannelSync Triggered when all the channel information have been received -* \def KviEvent_OnChannelMessage A message has been received from the channel -* \def KviEvent_OnChannelNotice A NOTICE have been issued to a channel -*/ -#define KviEvent_OnChannelWindowCreated 44 -#define KviEvent_OnChannelSync 45 -#define KviEvent_OnChannelMessage 46 -#define KviEvent_OnChannelNotice 47 - -// Queries -/** -* \def KviEvent_OnQueryMessage A message has been received from a query -* \def KviEvent_OnQueryNotice A private notice has been received -* \def KviEvent_OnQueryWindowRequest A new query window is going to be opened because a remote message has been received -* \def KviEvent_OnQueryWindowCreated A query window has just been opened -* \def KviEvent_OnQueryTargetAdded A new query target has been added -* \def KviEvent_OnQueryFileDropped A file is dropped in a query -*/ -#define KviEvent_OnQueryMessage 48 -#define KviEvent_OnQueryNotice 49 -#define KviEvent_OnQueryWindowRequest 50 -#define KviEvent_OnQueryWindowCreated 51 -#define KviEvent_OnQueryTargetAdded 52 -#define KviEvent_OnQueryFileDropped 53 - -// Actions -/** -* \def KviEvent_OnMeAway Local user sets the AWAY status -* \def KviEvent_OnMeBack Local user cancels the AWAY status -* \def KviEvent_OnJoin Non-local user joining a channel -* \def KviEvent_OnMeJoin Local user joining a channel -* \def KviEvent_OnPart Non-local user is leaving a channel -* \def KviEvent_OnMePart Local user is leaving a channel -* \def KviEvent_OnKick Non-local user is being kicked from a channel -* \def KviEvent_OnMeKick Local user is being kicked from a channel -* \def KviEvent_OnTopic Topic change on a channel -* \def KviEvent_OnQuit An user is leaving IRC -*/ -#define KviEvent_OnMeAway 54 -#define KviEvent_OnMeBack 55 -#define KviEvent_OnJoin 56 -#define KviEvent_OnMeJoin 57 -#define KviEvent_OnPart 58 -#define KviEvent_OnMePart 59 -#define KviEvent_OnKick 60 -#define KviEvent_OnMeKick 61 -#define KviEvent_OnTopic 62 -#define KviEvent_OnQuit 63 - -// IRC modes -/** -* \def KviEvent_OnChannelModeChange The channel mode has been changed -* \def KviEvent_OnUserModeChange The local user has changed mode -* \def KviEvent_OnBan Someone has set a +b flag on the channel -* \def KviEvent_OnUnban Someone has set a -b flag on the channel -* \def KviEvent_OnMeBan Local user is being banned in a channel -* \def KviEvent_OnMeUnban Local user is being de-banned in a channel -* \def KviEvent_OnBanException Someone has set a +e flag on the channel -* \def KviEvent_OnBanExceptionRemove Someone has set a -e flag on the channel -* \def KviEvent_OnMeBanException Someone has set a +e flag on the local user -* \def KviEvent_OnMeBanExceptionRemove Someone has set a -e flag on the local user -* \def KviEvent_OnInvite Triggered when a user invites someone in the channel -* \def KviEvent_OnInviteException A +I mode has been set -* \def KviEvent_OnInviteExceptionRemove Mode -I has been set -* \def KviEvent_OnMeInviteException A +I mode has been set on the local user -* \def KviEvent_OnMeInviteExceptionRemove A -I mode has been set on the local user -* \def KviEvent_OnLimitSet The channel users limit has been set -* \def KviEvent_OnLimitUnset The channel users limit has been unset -* \def KviEvent_OnKeySet The channel users key has been set -* \def KviEvent_OnKeyUnset The channel users key has been unset -* \def KviEvent_OnNickChange Someone has changed his nickname -* \def KviEvent_OnMeNickChange The local user has changed his nickname -* \def KviEvent_OnChanOwner Someone has given a user the +q flag -* \def KviEvent_OnDeChanOwner Someone has given a user the -q flag -* \def KviEvent_OnMeChanOwner Someone has given the +q flag to the local user -* \def KviEvent_OnMeDeChanOwner Someone has given the -q flag to the local user -* \def KviEvent_OnChanAdmin Someone has given a user the +a flag -* \def KviEvent_OnDeChanAdmin Someone has given a user the -a flag -* \def KviEvent_OnMeChanAdmin Someone has given the +a flag to the local user -* \def KviEvent_OnMeDeChanAdmin Someone has given the -a flag to the local user -* \def KviEvent_OnOp Someone has given a user the +o flag -* \def KviEvent_OnDeOp Someone has given a user the -o flag -* \def KviEvent_OnMeOp Someone has given a user the +o flag to the local user -* \def KviEvent_OnMeDeOp Someone has given a user the -o flag to the local user -* \def KviEvent_OnHalfOp Someone has given a user the +h flag -* \def KviEvent_OnDeHalfOp Someone has given a user the -h flag -* \def KviEvent_OnMeHalfOp Someone has given the local user the +h flag -* \def KviEvent_OnMeDeHalfOp Someone has given the local user the -h flag -* \def KviEvent_OnVoice Someone has given a user the +v flag -* \def KviEvent_OnDeVoice Someone has given a user the -v flag -* \def KviEvent_OnMeVoice Someone has given the local user the +v flag -* \def KviEvent_OnMeDeVoice Someone has given the local user the -v flag -* \def KviEvent_OnUserOp Someone has given a user the +u flag -* \def KviEvent_OnDeUserOp Someone has given a user the -u flag -* \def KviEvent_OnMeUserOp Someone has given the local user the +u flag -* \def KviEvent_OnMeDeUserOp Someone has given the local user the -u flag -* \def KviEvent_OnIrcOp Someone has given a user the +O flag -* \def KviEvent_OnDeIrcOp Someone has given a user the -O flag -* \def KviEvent_OnMeIrcOp Someone has given the local user the +O flag -* \def KviEvent_OnMeDeIrcOp Someone has given the local user the -O flag -*/ -#define KviEvent_OnChannelModeChange 64 -#define KviEvent_OnUserModeChange 65 -#define KviEvent_OnBan 66 -#define KviEvent_OnUnban 67 -#define KviEvent_OnMeBan 68 -#define KviEvent_OnMeUnban 69 -#define KviEvent_OnBanException 70 -#define KviEvent_OnBanExceptionRemove 71 -#define KviEvent_OnMeBanException 72 -#define KviEvent_OnMeBanExceptionRemove 73 -#define KviEvent_OnInvite 74 -#define KviEvent_OnInviteException 75 -#define KviEvent_OnInviteExceptionRemove 76 -#define KviEvent_OnMeInviteException 77 -#define KviEvent_OnMeInviteExceptionRemove 78 -#define KviEvent_OnLimitSet 79 -#define KviEvent_OnLimitUnset 80 -#define KviEvent_OnKeySet 81 -#define KviEvent_OnKeyUnset 82 -#define KviEvent_OnNickChange 83 -#define KviEvent_OnMeNickChange 84 -#define KviEvent_OnChanOwner 85 -#define KviEvent_OnDeChanOwner 86 -#define KviEvent_OnMeChanOwner 87 -#define KviEvent_OnMeDeChanOwner 88 -#define KviEvent_OnChanAdmin 89 -#define KviEvent_OnDeChanAdmin 90 -#define KviEvent_OnMeChanAdmin 91 -#define KviEvent_OnMeDeChanAdmin 92 -#define KviEvent_OnOp 93 -#define KviEvent_OnDeOp 94 -#define KviEvent_OnMeOp 95 -#define KviEvent_OnMeDeOp 96 -#define KviEvent_OnHalfOp 97 -#define KviEvent_OnDeHalfOp 98 -#define KviEvent_OnMeHalfOp 99 -#define KviEvent_OnMeDeHalfOp 100 -#define KviEvent_OnVoice 101 -#define KviEvent_OnDeVoice 102 -#define KviEvent_OnMeVoice 103 -#define KviEvent_OnMeDeVoice 104 -#define KviEvent_OnUserOp 105 -#define KviEvent_OnDeUserOp 106 -#define KviEvent_OnMeUserOp 107 -#define KviEvent_OnMeDeUserOp 108 -#define KviEvent_OnIrcOp 109 -#define KviEvent_OnDeIrcOp 110 -#define KviEvent_OnMeIrcOp 111 -#define KviEvent_OnMeDeIrcOp 112 - - -// Services -/** -* \def KviEvent_OnChanServNotice A notice from ChanServ has been received -* \def KviEvent_OnNickServNotice A notice from NickServ has been received -* \def KviEvent_OnNickServAuth Triggered when IRCd sets a registered user mode. -*/ -#define KviEvent_OnChanServNotice 113 -#define KviEvent_OnNickServNotice 114 -#define KviEvent_OnNickServAuth 115 - -// CTCPs -/** -* \def KviEvent_OnAction Someone issued a CTCP ACTION -* \def KviEvent_OnMeAction User issued a CTCP ACTION -* \def KviEvent_OnCTCPRequest A CTCP request has been received -* \def KviEvent_OnCTCPReply A CTCP reply has been received -* \def KviEvent_OnCTCPFlood Someone tried to flood you with CTCP requests -* \def KviEvent_OnDCCSessionCreated A new DCC session has just been created -* \def KviEvent_OnDCCSessionDestroyed A new DCC session has just been destroyed -* \def KviEvent_OnDCCChatWindowCreated A DCC Chat window has been just created -* \def KviEvent_OnDCCChatConnectionInProgress A DCC Chat connection has just been started -* \def KviEvent_OnDCCChatConnected A DCC Chat connection has been established -* \def KviEvent_OnDCCChatMessage A DCC Chat message has just been received -* \def KviEvent_OnDCCChatError A DCC Chat error has just been triggered -* \def KviEvent_OnDCCChatDisconnected A DCC Chat has been just disconnected -* \def KviEvent_OnDCCChatWindowClosing A DCC Chat is going to be closed -* \def KviEvent_OnDCCFileTransferConnectionInProgress Triggered when a DCC File transfer is waiting for a connection -* \def KviEvent_OnDCCFileTransferBegin Triggered when a DCC File transfer begins -* \def KviEvent_OnDCCFileTransferSuccess Triggered when a DCC File transfer succeeds -* \def KviEvent_OnDCCFileTransferFailed Triggered when a DCC File transfer fails -*/ -#define KviEvent_OnAction 116 -#define KviEvent_OnMeAction 117 -#define KviEvent_OnCTCPRequest 118 -#define KviEvent_OnCTCPReply 119 -#define KviEvent_OnCTCPFlood 120 -#define KviEvent_OnDCCSessionCreated 121 -#define KviEvent_OnDCCSessionDestroyed 122 -#define KviEvent_OnDCCChatWindowCreated 123 -#define KviEvent_OnDCCChatConnectionInProgress 124 -#define KviEvent_OnDCCChatConnected 125 -#define KviEvent_OnDCCChatMessage 126 -#define KviEvent_OnDCCChatError 127 -#define KviEvent_OnDCCChatDisconnected 128 -#define KviEvent_OnDCCChatWindowClosing 129 -#define KviEvent_OnDCCFileTransferConnectionInProgress 130 -#define KviEvent_OnDCCFileTransferBegin 131 -#define KviEvent_OnDCCFileTransferSuccess 132 -#define KviEvent_OnDCCFileTransferFailed 133 - -// Link clicks -/** -* \def KviEvent_OnChannelNickLinkClick User clicked on nick in channel -* \def KviEvent_OnQueryNickLinkClick User clicked on nickname in query window -* \def KviEvent_OnConsoleNickLinkClick User clicked on nickname in console window -* \def KviEvent_OnHostLinkClick Triggered when user clicks on any hostname in any window -* \def KviEvent_OnURLLinkClick Triggered when user clicks on any URL link in any window -* \def KviEvent_OnChannelLinkClick Triggered when user clicks on any channel name in any window -* \def KviEvent_OnServerLinkClick Triggered when user clicks on server name in any window -* \def KviEvent_OnTextViewDoubleClicked Text view link double click customization -* \def KviEvent_OnNickLinkDefaultActionRequest Nick link double click customization -* \def KviEvent_OnChannelNickDefaultActionRequest Nicknames double click customization -* \def KviEvent_OnQueryNickDefaultActionRequest Query double click customization -*/ -#define KviEvent_OnChannelNickLinkClick 134 -#define KviEvent_OnQueryNickLinkClick 135 -#define KviEvent_OnConsoleNickLinkClick 136 -#define KviEvent_OnHostLinkClick 137 -#define KviEvent_OnURLLinkClick 138 -#define KviEvent_OnChannelLinkClick 139 -#define KviEvent_OnServerLinkClick 140 -#define KviEvent_OnTextViewDoubleClicked 141 -#define KviEvent_OnNickLinkDefaultActionRequest 142 -#define KviEvent_OnChannelNickDefaultActionRequest 143 -#define KviEvent_OnQueryNickDefaultActionRequest 144 - -/** \def KVI_KVS_NUM_APP_EVENTS Defines the number of events */ -#define KVI_KVS_NUM_APP_EVENTS 147 - -#endif //_KVI_KVS_EVENTTABLE_H_ diff --git a/src/kvirc/kvs/KviKvsEventTriggers.h b/src/kvirc/kvs/KviKvsEventTriggers.h deleted file mode 100644 index 73898c3c2..000000000 --- a/src/kvirc/kvs/KviKvsEventTriggers.h +++ /dev/null @@ -1,289 +0,0 @@ -#ifndef _KVI_KVS_EVENTTRIGGERS_H_ -#define _KVI_KVS_EVENTTRIGGERS_H_ -//============================================================================= -// -// File : KviKvsEventTriggers.h -// Creation date : Thu Oct 22 2005 04:57:12 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2005-2010 Szymon Stefanek -// -// 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_settings.h" - -#include "KviKvsEventTable.h" -#include "KviKvsEventManager.h" -#include "KviKvsVariantList.h" - -// -// KVS Macros for triggering events -// -// KviKvsVariantList vParams; -// vParams.append(bSomething); -// vParams.append(iSomething); -// vParams.append(szSomething); -// KVS_TRIGGER_EVENT(KviEvent_OnSomething,pSomeWindow,&vParams) -// -// if(KVS_TRIGGER_EVENT_HALTED(KviEvent_OnSomething,pSomeWindow,&vParams)) -// msg->haltOutput() -// -// - -// These two allow reusing the parameter lists (but may require more code) -#define KVS_TRIGGER_EVENT(__idx,__wnd,__parms) \ - if(KviKvsEventManager::instance()->hasAppHandlers(__idx)) \ - KviKvsEventManager::instance()->trigger(__idx,__wnd,__parms); - -#define KVS_TRIGGER_EVENT_HALTED(__idx,__wnd,__parms) \ - (KviKvsEventManager::instance()->hasAppHandlers(__idx) ? \ - KviKvsEventManager::instance()->trigger(__idx,__wnd,__parms) : false) - - -// These require less code (but param lists can't be reused) -#define KVS_TRIGGER_EVENT_0(__idx,__wnd) \ - if(KviKvsEventManager::instance()->hasAppHandlers(__idx)) \ - { \ - KviKvsVariantList _vLocalParamList; \ - KviKvsEventManager::instance()->trigger(__idx,__wnd,&_vLocalParamList); \ - } - -#define KVS_TRIGGER_EVENT_1(__idx,__wnd,__param1) \ - if(KviKvsEventManager::instance()->hasAppHandlers(__idx)) \ - { \ - KviKvsVariantList _vLocalParamList( \ - new KviKvsVariant(__param1) \ - ); \ - KviKvsEventManager::instance()->trigger(__idx,__wnd,&_vLocalParamList); \ - } - -#define KVS_TRIGGER_EVENT_2(__idx,__wnd,__param1,__param2) \ - if(KviKvsEventManager::instance()->hasAppHandlers(__idx)) \ - { \ - KviKvsVariantList _vLocalParamList( \ - new KviKvsVariant(__param1), \ - new KviKvsVariant(__param2) \ - ); \ - KviKvsEventManager::instance()->trigger(__idx,__wnd,&_vLocalParamList); \ - } - -#define KVS_TRIGGER_EVENT_3(__idx,__wnd,__param1,__param2,__param3) \ - if(KviKvsEventManager::instance()->hasAppHandlers(__idx)) \ - { \ - KviKvsVariantList _vLocalParamList( \ - new KviKvsVariant(__param1), \ - new KviKvsVariant(__param2), \ - new KviKvsVariant(__param3) \ - ); \ - KviKvsEventManager::instance()->trigger(__idx,__wnd,&_vLocalParamList); \ - } - -#define KVS_TRIGGER_EVENT_4(__idx,__wnd,__param1,__param2,__param3,__param4) \ - if(KviKvsEventManager::instance()->hasAppHandlers(__idx)) \ - { \ - KviKvsVariantList _vLocalParamList( \ - new KviKvsVariant(__param1), \ - new KviKvsVariant(__param2), \ - new KviKvsVariant(__param3), \ - new KviKvsVariant(__param4) \ - ); \ - KviKvsEventManager::instance()->trigger(__idx,__wnd,&_vLocalParamList); \ - } - -#define KVS_TRIGGER_EVENT_5(__idx,__wnd,__param1,__param2,__param3,__param4,__param5) \ - if(KviKvsEventManager::instance()->hasAppHandlers(__idx)) \ - { \ - KviKvsVariantList _vLocalParamList( \ - new KviKvsVariant(__param1), \ - new KviKvsVariant(__param2), \ - new KviKvsVariant(__param3), \ - new KviKvsVariant(__param4), \ - new KviKvsVariant(__param5) \ - ); \ - KviKvsEventManager::instance()->trigger(__idx,__wnd,&_vLocalParamList); \ - } - -#define KVS_TRIGGER_EVENT_6(__idx,__wnd,__param1,__param2,__param3,__param4,__param5,__param6) \ - if(KviKvsEventManager::instance()->hasAppHandlers(__idx)) \ - { \ - KviKvsVariantList _vLocalParamList( \ - new KviKvsVariant(__param1), \ - new KviKvsVariant(__param2), \ - new KviKvsVariant(__param3), \ - new KviKvsVariant(__param4), \ - new KviKvsVariant(__param5), \ - new KviKvsVariant(__param6) \ - ); \ - KviKvsEventManager::instance()->trigger(__idx,__wnd,&_vLocalParamList); \ - } - -#define KVS_TRIGGER_EVENT_7(__idx,__wnd,__param1,__param2,__param3,__param4,__param5,__param6,__param7) \ - if(KviKvsEventManager::instance()->hasAppHandlers(__idx)) \ - { \ - KviKvsVariantList _vLocalParamList( \ - new KviKvsVariant(__param1), \ - new KviKvsVariant(__param2), \ - new KviKvsVariant(__param3), \ - new KviKvsVariant(__param4), \ - new KviKvsVariant(__param5), \ - new KviKvsVariant(__param6), \ - new KviKvsVariant(__param7) \ - ); \ - KviKvsEventManager::instance()->trigger(__idx,__wnd,&_vLocalParamList); \ - } - - -#define KVS_TRIGGER_EVENT_0_HALTED(__idx,__wnd) \ - ( \ - KviKvsEventManager::instance()->hasAppHandlers(__idx) \ - ? \ - KviKvsEventManager::instance()->triggerDeleteParams( \ - __idx, \ - __wnd, \ - new KviKvsVariantList() \ - ) \ - : \ - false \ - ) - -#define KVS_TRIGGER_EVENT_1_HALTED(__idx,__wnd,__param1) \ - ( \ - KviKvsEventManager::instance()->hasAppHandlers(__idx) \ - ? \ - KviKvsEventManager::instance()->triggerDeleteParams( \ - __idx, \ - __wnd, \ - new KviKvsVariantList( \ - new KviKvsVariant(__param1) \ - ) \ - ) \ - : \ - false \ - ) - -#define KVS_TRIGGER_EVENT_2_HALTED(__idx,__wnd,__param1,__param2) \ - ( \ - KviKvsEventManager::instance()->hasAppHandlers(__idx) \ - ? \ - KviKvsEventManager::instance()->triggerDeleteParams( \ - __idx, \ - __wnd, \ - new KviKvsVariantList( \ - new KviKvsVariant(__param1), \ - new KviKvsVariant(__param2) \ - ) \ - ) \ - : \ - false \ - ) - -#define KVS_TRIGGER_EVENT_3_HALTED(__idx,__wnd,__param1,__param2,__param3) \ - ( \ - KviKvsEventManager::instance()->hasAppHandlers(__idx) \ - ? \ - KviKvsEventManager::instance()->triggerDeleteParams( \ - __idx, \ - __wnd, \ - new KviKvsVariantList( \ - new KviKvsVariant(__param1), \ - new KviKvsVariant(__param2), \ - new KviKvsVariant(__param3) \ - ) \ - ) \ - : \ - false \ - ) - -#define KVS_TRIGGER_EVENT_4_HALTED(__idx,__wnd,__param1,__param2,__param3,__param4) \ - ( \ - KviKvsEventManager::instance()->hasAppHandlers(__idx) \ - ? \ - KviKvsEventManager::instance()->triggerDeleteParams( \ - __idx, \ - __wnd, \ - new KviKvsVariantList( \ - new KviKvsVariant(__param1), \ - new KviKvsVariant(__param2), \ - new KviKvsVariant(__param3), \ - new KviKvsVariant(__param4) \ - ) \ - ) \ - : \ - false \ - ) - -#define KVS_TRIGGER_EVENT_5_HALTED(__idx,__wnd,__param1,__param2,__param3,__param4,__param5) \ - ( \ - KviKvsEventManager::instance()->hasAppHandlers(__idx) \ - ? \ - KviKvsEventManager::instance()->triggerDeleteParams( \ - __idx, \ - __wnd, \ - new KviKvsVariantList( \ - new KviKvsVariant(__param1), \ - new KviKvsVariant(__param2), \ - new KviKvsVariant(__param3), \ - new KviKvsVariant(__param4), \ - new KviKvsVariant(__param5) \ - ) \ - ) \ - : \ - false \ - ) - -#define KVS_TRIGGER_EVENT_6_HALTED(__idx,__wnd,__param1,__param2,__param3,__param4,__param5,__param6) \ - ( \ - KviKvsEventManager::instance()->hasAppHandlers(__idx) \ - ? \ - KviKvsEventManager::instance()->triggerDeleteParams( \ - __idx, \ - __wnd, \ - new KviKvsVariantList( \ - new KviKvsVariant(__param1), \ - new KviKvsVariant(__param2), \ - new KviKvsVariant(__param3), \ - new KviKvsVariant(__param4), \ - new KviKvsVariant(__param5), \ - new KviKvsVariant(__param6) \ - ) \ - ) \ - : \ - false \ - ) - -#define KVS_TRIGGER_EVENT_7_HALTED(__idx,__wnd,__param1,__param2,__param3,__param4,__param5,__param6,__param7) \ - ( \ - KviKvsEventManager::instance()->hasAppHandlers(__idx) \ - ? \ - KviKvsEventManager::instance()->triggerDeleteParams( \ - __idx, \ - __wnd, \ - new KviKvsVariantList( \ - new KviKvsVariant(__param1), \ - new KviKvsVariant(__param2), \ - new KviKvsVariant(__param3), \ - new KviKvsVariant(__param4), \ - new KviKvsVariant(__param5), \ - new KviKvsVariant(__param6), \ - new KviKvsVariant(__param7) \ - ) \ - ) \ - : \ - false \ - ) - -#endif //!_KVI_KVS_EVENTTRIGGERS_H_ diff --git a/src/kvirc/kvs/KviKvsObject.cpp b/src/kvirc/kvs/KviKvsObject.cpp deleted file mode 100644 index 857e2d139..000000000 --- a/src/kvirc/kvs/KviKvsObject.cpp +++ /dev/null @@ -1,1814 +0,0 @@ -//============================================================================= -// -// File : KviKvsObject.cpp -// Creation date : Wed 08 Oct 2003 02:31:57 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2003-2010 Szymon Stefanek -// -// 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 "KviKvsObject.h" -#include "KviKvsHash.h" -#include "KviKvsKernel.h" -#include "KviWindow.h" -#include "KviApplication.h" - -#include "KviModuleManager.h" -#include "KviConsoleWindow.h" -#include "KviLocale.h" -#include "KviError.h" -#include "kvi_out.h" -#include "KviMircCntrl.h" -#include "KviIconManager.h" -#include "KviMemory.h" - -#include "KviKvsObjectController.h" -#include "KviKvsObjectFunctionCall.h" -#include "KviKvsObjectFunctionHandlerImpl.h" - -#include -#include -#include -#include -#include - -#include - -/* - @doc: objects - @title: - Object scripting - @short: - Object scripting overview - @keyterms: - objects, object scripting, complex data structures - @body: - [big]Introduction[/big] - - The KVIrc scripting language is not object oriented in nature. - Anyway, objects are a highlevel abstraction that allow - to write complex code in a "clean" way. - So I've added at least some pseudo-object support.[br][br] - - [big]Basic concepts[/big] - - Objects are arranged in tree structures. - Each object that you create is either toplevel object or a children - of another object. A toplevel object is a parentless one. - Obviously all objects can have children objects.[br][br] - - When an object is destroyed, all its children are also destroyed. - The toplevel objects are automatically destroyed when KVIrc quits. - The objects are global to the entire application (this is different - from previous KVIrc releases where the objects were local - to the current frame window and arranged in a single tree - with a builtin root object).[br][br] - - Each object is an instance of a class that defines its features. - Each object has also a name, that is not necessary unique and is assigned to - by the programmer; the name is just a mnemonic expedient, and - you may also not need it.[br][br] - - Each object is identified by an [b]OPAQUE UNIQUE ID[/b]. - The ID is assigned by KVIrc and can be held in any variable. - You can think the object id as a "handle for the object" or the object's pointer. - Any action performed on the object will require its ID.[br][br] - - [big]Creation and destruction[/big] - - To create an object you must use the [fnc]$new[/fnc]() - function. [fnc]$new[/fnc]() requires three parameters:[br] - - The object class (more about object classes later in this document)[br] - - The ID of the parent object (this can be 0 for toplevel objects).[br] - - The object name (eventually empty)[br] - [example] - %myobject = [fnc]$new[/fnc]([class]object[/class],0,theName) - [/example] - [fnc]$new[/fnc]() returns the ID of the newly created object, or - the STRING "0" if the object creation fails - (it is a string because the object id's are generally strings, and 0 is an "invalid object id"). - In well written scripts it is not common that the object creation fails, anyway - you can check if the creation has failed in the following way:[br] - [example] - [cmd]if[/cmd](%myobject)[cmd]echo[/cmd] "Object created!" - else [cmd]echo[/cmd] "Object creation failed!" - [/example] - You can also test the object ID's for equality:[br] - [example] - [cmd]if[/cmd](%myobject == %anotherobject)[cmd]echo[/cmd] "This is the same object!"; - [/example] - The parent object id is optional, if not specified it is assumed to be 0. - The object name is optional, but it may help you later in finding the object.[br][br] - - To destroy an object use the [cmd]delete[/cmd] command. (In previous versions - this command was named "destroy" and delete is currently aliased to that name too).[br] - [example] - [cmd]delete[/cmd] %myobject - [/example] - If the destroyed object has children objects, these are destroyed too.[br][br] - - [big]Fields: objects as pseudo-structures[/big] - - All the objects can contain variable fields. - You can set an object's field by using the object scope operator "->":[br] - [example] - %myobject->%fieldVariable = dataString - [/example] - To unset a field set it with empty data string (just like with a normal variable). - To retrieve the field data use the object scope operator in the same way:[br] - [example] - [cmd]echo[/cmd] %myobject->%fieldVariable - [/example] - The '->' operator has been stolen from the C language. - In the KVIrc scripting language it switches from the global namespace - to the object's one.[br] - So in the above example %fieldVariable is owned by the object.[br] - The first character of the variable name has no special meaning in the - object namespace (in the global namespace the variables starting - with an uppercase letter are global to the application, the other ones are local - to the command sequence). The variable names are completely case insensitive.[br][br] - - Any [doc:operators]operator[/doc] can be used with the object field variables:[br] - [example] - %myobject->%fieldVariable = 0 - %myobject->%fieldVarialbe ++ - [cmd]if[/cmd]0(%myobject->%fieldVariable != 1)[cmd]echo[/cmd] KVIrc is drunk, maybe a reboot will help? - [/example] - You can simulate C structures "on the fly" by using objects and fields:[br] - [example] - # Create an user description on the fly - %myobj = [fnc]$new[/fnc]([class]object[/class],0,userDescription) - # Set the fields - %myobj->%nickname = Pragma - %myobj->%username = daemon - %myobj->%hostname = pippo.pragma.org - %myobj->%info = Pragma goes always sleep too late - %myobj->%info [doc:operators]<<[/doc] and wakes up too late too! - # Call an (user defined) alias that stores the data to a file - storetofile %myobj - # Destroy the object - [cmd]delete[/cmd] %myobj - [/example] - The field variables can be also dictionaries:[br] - [example] - %theobj->%field[key] = something - [/example] - Unlike in C, there is no need to declare object fields.[br] - If you have ever used other high level object-oriented languages, you may be used to declaring different types of - variables: instance variables, which per definition define an object's state (at least partly) and local variables, - which can be used in any function and will be only valid in the very current scope. This does and does not apply - to KVI++.[br] - Local variables can be used as normal and the scope of those variables will (naturally) be limited to the scope of - the function they are defined in.[br] - [example] - [cmd]class[/cmd](test,[class]object[/class]) - { - test() - { - %test = "will this persist?" - } - - anotherfunc() { - [cmd]echo[/cmd] "var: %test" - } - } - - %myObject = [fnc]$new[/fnc](test,0) - %myObject->$test() - [comment]# Behold! This will only print "var: "![/comment] - %myObject->$anotherfunc() - [/example][br] - Intance variables, however, which are managed in the object's "field" can be accessed at any time by anyone. - [b]Warning:[/b] every script or object is potentially able to change the values of your field variables! - They may also add or unset (empty) previously not used or used fields.[br] - As earlier said, there is no need to declare object fields, as KVIrc will keep track of them. Even more precisely - said, you [b]can not[/b] declare them in the class file itself (some later example will tell you otherwise, - just keep in mind to ignore the pseudo code, as it does not reflect how KVI++ is really working in respect of - fields.)[br] - However, there is one way to declare and define object fields: using the constructor (please see below, if you - are interesting in learning about this function), it is possible to "declare" (really only for the human being - reading the code) and more important initialize object fields. For more information, see the Constructor section - below.[br] - Any object can have any field variable; an "unset" field is equivalent to an "empty" field.[br] - Note:[br] - The KVIrc scripting language is not typed. - Any object class (be patient... I'll explain classes in a while) identifier can be stored in any KVIrc variable: - it is not possible to find out the object features by "examining" its identifier. - This may make the usage of objects a bit "unclear"; - Howewer, with some experience you will be able to use the objects in a very powerful way. - The type-safety can be also simulated by a careful usage of object names; - in the above example, the %myobj object was created with the "userDescription" name. - The storetofile alias could check the passed object's name and refuse to work - if that does not match "userDescription".[br][br] - - A more complex use of fields will be described later in this document.[br][br] - - [big]Member functions[/big] - - Just like in C++, the objects have member functions. - For example, the "object" class (again... read on) objects export the [classfnc:object]$name[/classfnc]() - and [classfnc:object]$className[/classfnc]() functions.[br] - [example] - %tmp = [fnc]$new[/fnc]([class]object[/class],0,myobject) - [cmd]echo[/cmd] The object's name is %tmp->[classfnc:object]$name[/classfnc](), the class name is %tmp->[classfnc:object]$className[/classfnc]() - # Destroy the object - [cmd]delete[/cmd] %tmp - [/example] - Another cool function exported by the [class:object]object[/class] class is the - [classfnc:object]$children[/classfnc]() function. - It returns a comma separated list of children identifiers.[br] - [example] - %tmp = [fnc]$new[/fnc]([class]object[/class],0,myobject) - %tmpchild = [fnc]$new[/fnc]([class]object[/class],%tmp,child1) - %tmpchild = [fnc]$new[/fnc]([class]object[/class],%tmp,child2) - %tmpchild = [fnc]$new[/fnc]([class]object[/class],%tmp,child3) - [cmd]echo[/cmd] The object's children list is: %tmp->[classfnc:object]$children[/classfnc]() - # Destroy the object and the children - [cmd]delete[/cmd] %tmp - [/example] - There are two special functions for each objects: the "constructor" and the "destructor". - You will find more information on constructors and destructors later in this document, - for now it's enough that you know that these functions are called automatically by KVirc: - the constructor is called when the object is created and the destructor is called when the - object is being destroyed with [cmd]delete[/cmd].[br][br] - - The object functions can be reimplemented on-the-fly - by using the [cmd]privateimpl[/cmd] command: you can simply modify the behaviour of the function - by writing your own function body. - (This is an uncommon feature: unlike many other languages, you can reimplement object - functions at run-time, when the object has been already created.)[br][br] - - A more complex example[br] - [example] - %tmp = [fnc]$new[/fnc]([class]object[/class],0,myobject) - [cmd]foreach[/cmd](%i,1,2,3) - { - %tmpchild = [fnc]$new[/fnc]([class]object[/class],%tmp,child%i) - [cmd]privateimpl[/cmd](%tmpchild,destructor){ [cmd]echo[/cmd] Object [fnc]$this[/fnc] ([fnc]$this[/fnc]->[classfnc:object]$name[/classfnc]()) destroyed; } - } - [cmd]privateimpl[/cmd](%tmp,destructor) - { - %count = 0; - [cmd]foreach[/cmd](%t,[fnc]$this[/fnc]->[classfnc:object]$children[/classfnc]()) - { - [cmd]echo[/cmd] Children : %t->[classfnc:object]$name[/classfnc]() with class %t->[classfnc:object]$class[/classfnc]() - %count++ - } - [cmd]echo[/cmd] Just before destroying my %count children. - } - # Destroy the object and the children - [cmd]delete[/cmd] %tmp - [/example] - - In the example above four objects have been created. - A "parent" object named "myobject", and three children objects. - The destructor has been reimplemented for each child object, - to make it "say" its name (Please note the usage of [fnc]$this[/fnc]). - In the parent destructor the children have been counted and listed.[br] - Then the parent object is destroyed causing to:[br] - - trigger the parent destructor.[br] - - destroy all the children (and conseguently trigger all the "individual" destructors).[br][br] - - Not all the object functions must return a value: - If a function does not return a meaningful value, or you just want to ignore it, you can call it in the following way:[br] - [example] - %anyobject->$functionname() - [/example] - [br] - - [big]Classes[/big] - As said before, all objects are instances of a specific class. - This concept is common to almost all object oriented languages. - A class is a collection of methods that define an object's behaviour. - Hehe... it is not easy to explain it, so I'll try with an example:[br] - [b]Please note, that this is pseudo code. KVI++ does by no means employs - a "field" directive as shown below![/b] - [example] - class HostAddress - { - field hostname - function ipnumber() - function isLocalhost() - } - [/example] - The above class is a rappresentation of a host address. - You create an [b]instance of this class[/b] and set the hostname field, for example, - to www.kernel.org. - The object is now able to give you information about the hostname in a transparent way: - You can call the ipnumber() function, and the object will return you the - digits and dots rappresentation of www.kernel.org. - The isLocalhost() function will return true if the hostname refers to the local machine - The object internal job is hidden from the user, but probably it will be a huge job. - To obtain the IP number from the hostname, the object will probably have to perform a DNS call (usually a complex task). - To check if the hostname references the local machine, the object will have to obtain the local hostname - from the system (in some "unspecified" way) and then compare it with the given "hostname" field.[br][br] - - The internal job of the object is defined by the "implementation of the class". - Obviously, the programmer that creates the class has to write that implementation.[br] - - [example] - class HostAddress - { - field hostname - function ipnumber() - { - find the nearest DNS server - make the dns call - wait for the response - decode the response - } - function isLocalhost() - { - query the kernel for the local hostname - compare the obtained hostname with the hostname field - } - } - [/example] - In the above example I have "implemented" the two functions in pseudo code.[br][br] - - Let's go back to the real world.[br][br] - - KVirc contains a [doc:classes]set of built-in ready-to-use classes[/doc]. - The basic class is [class]object[/class]: all the other classes are derived from this (more about - object inheritance later in this doc).[br][br] - - Another available class is [class]socket[/class] that is an interface to the real system sockets. - An instance of the [class]socket[/class] class can connect and communicate with other hosts on the net.[br][br] - - The [b]class definitions are GLOBAL to the entire application[/b]: all server windows share them.[br][br] - - So now we can say that in KVIrc - [b]a CLASS is a collection of features that define the behaviour of an object. - The user interface to the class are the member functions and the events.[/b][br][br] - - [big]Inheritance[/big] - - Someone asked for derived classes?[br] - Here we go:[br] - The [cmd]class[/cmd] command allows you to define new object classes. - In KVI++, A new class must be always derived from some other class: the lowest possible - level of inheritance is 1: deriving from class [class]object[/class].[br] - [example] - [cmd]class[/cmd](helloworld,[class]object[/class]) - { - sayhello() - { - [cmd]echo[/cmd] Hello world! - } - } - [/example] - - The above class is named "helloworld". It inherits the [class]object[/class] class. - This means that it acquires all the [class]object[/class] functions: [classfnc:object]$name[/classfnc](), - [classfnc:object]$class[/class](), [classfnc:object]$children[/classfnc]()... - Additionally, it has the $sayhello() function, that "echoes Hello world" to the console. - Now you can create an instance of this class: - [example] - %instance = [fnc]$new[/fnc](helloworld) - %instance->$sayhello() - [/example] - You should see "Hello world" printed in the console. - Easy job... let's make the things a bit more complex now: - derive another class from helloworld and make it say "hello" in two different languages:[br] - [example] - [cmd]class[/cmd](localizedhelloworld,helloworld) - { - [comment]# define the setlanguage function[/comment] - [comment]# note that <$0 = language> is just a programmer reminder[/comment] - setlanguage(<$0 = language>) - { - [cmd]if[/cmd](($0 == english) || ($0 == italian)) - { - [fnc:$this]$$[/fnc]->%lang = $0 - [cmd]return[/cmd] 1 - } else { - [cmd]echo[/cmd] I don't know that language ($0) - [cmd]echo[/cmd] defaulting to english - [fnc:$this]$$[/fnc]->%lang = english - [cmd]return[/cmd] 0 - } - } - - sayhello() - { - [cmd]if[/cmd]([fnc:$this]$$[/fnc]->%lang == italian)[cmd]echo[/cmd] Ciao mondo! - else [fnc:$this]$$[/fnc]->$helloworld:sayhello() - } - } - [/example] - Now you can call:[br] - [example] - %m = [fnc]$new[/fnc](localizedhelloworld) - %m->$setLanguage(italian) - %m->$sayhello() - %m->$setLanguage(english) - %m->$sayhello() - %m->$setLanguage(turkish) - %m->$sayhello() - [cmd]delete[/cmd] %myobj - [/example] - The class defined above is inherited from the previously defined helloworld class: - so it inherits the "object" class functions and events and the sayhello function from "helloworld". - In addition a setlanguage function is defined that stores in a variable the language name passed - as a parameter (after checking its validity). ($0 evaluates to the first parameter passed) - If the language is unknown the setlanguage function will return 0 (false). - Now we want to be able to say "hello world" in Italian and English. - So we [b]override[/b] the inherited sayhello function. - "To override" means "to reimplement": if you call %object->$sayhello() and %object - contains the ID of an instance of class "localizedhelloworld", the new implementation of that function will be called (executed). - The inherited sayhello was able to say "hello world" only in English, so we can still use it in the new implementation - without rewriting its contents. So if the language set is "not Italian" we assume that it is English and - call the [b]base class implementation[/b].[br] - [example] - [fnc]$this[/fnc]->$helloworld:sayhello() - [comment]# equivalent to $$->$helloworld:sayhello(),[/comment] - [comment]# to $this->$helloworld::sayhello(),[/comment] - [comment]# and to $$->$helloworld::sayhello()[/comment] - [/example] - otherwise the language is Italian and we say "hello" in Italian :). - So, to call a base class implementation of a function we "prepend" the base class name before the function name in the call. - The base class name could be also [class]object[/class] in this case, but the [class]object[/class] class has no "sayhello" function defined - so it would result in an error.[br][br] - In the above example, all the values of [fnc]$this[/fnc]->%language - that are not equal to "italian" are assumed to be "english". - This is not always true, for example, just after the object creation the %language variable field - is effectively empty. The above class works correctly in this case, but we might want to have always - a coherent state of the field variables, so we need another concept: the class [b]constructor[/b] - that will be discussed in the next paragraph.[br][br] - - Note: multiple inheritance (inheritance from more than one base class) is not implemented, KVIrc is not a compiler. :)[br][br] - - Objects are much more powerful...[br][br] - - Do a [cmd]clearobjects[/cmd] to cleanup the old class definitions and read on.[br][br] - - [big]Constructors and destructors[/big] - - The class constructor is a [b]function[/b] that is called automatically just after the object - has been created internally by KVIrc and just before the [fnc]$new[/fnc] - function returns. It should be used to setup the internal object state.[br] - The constructor can and should list and initialize all the necessary object fields.[br] - [example] - [cmd]class[/cmd](myObject,[class]object[/class]) - { - constructor() - { - [fnc]$this[/fnc]->%test = "This is a sample object field." - } - } - - %myObject = [fnc]$new[/fnc](myObject,[class]object[/class]) - [cmd]echo[/cmd] %myObject->%test - [/example][br] - Will thus print "This is a sample object field."[br] - Unlike in C++, in KVIrc, the constructor CAN return a value:[br] - If it returns 0 it signals the object creation failure: the object - is immediately destroyed and [fnc]$new[/fnc]() returns 0 to the caller. - Any other return value is treated as success, so the object is effectively - created and [fnc]$new[/fnc]() returns its ID to the caller.[br] - This said, KVI++ will automatically return a value of 1 and you should [b]never[/b] - return a value other than 0 if something bad happened (like a mandatory parameter was not given in the $new() - call or the like.) KVIrc will also issue a warning message and remind you of this when a non-zero value is - returned.[br] - All the builtin classes have a constructor defined that will almost never fail (only if we run out of memory), - so you can avoid to check the [fnc]$new[/fnc]() return value - when creating the instances of the built-in classes.[br][br] - - In derived classes you can override the constructor to setup your object's state.[br] - You should [b]always call the base class constructor[/b] in your overridden one, to setup - the base class state, and propagate its return value (eventually modified if the base class - constructor is succesfull but your derived class initialization fails).[br] - This very basic example will illustrate how to do this (please read the paragraph about inheriting classes - above first):[br] - [example] - [cmd]class[/cmd](baseObject,[class]object[/class]) - { - constructor() - { - [cmd]echo[/cmd] "baseObject or derived object created." - } - } - - [cmd]class[/cmd](derivedObject,baseObject) - { - constructor() - { - [cmd]echo[/cmd] "derivedObject object created." - [fnc]$this[/fnc]->$baseObject::constructor() - } - } - [/example][br][br] - In practice, the builtin class constructors do nothing other than setting the return - value to 1 so you can even avoid to call them, but in any other case you must do it.[br][br] - - This is different from C (for example), where the constructors are called (more or less) - automatically.[br][br] - - [big]Signals and slots[/big] - - The signals and slots are a powerful mean of inter-object communication. - A signal is emitted by an object to notify a change in its state. - For example, the [class:button]button class[/class] emits the - [classsignal:button]clicked[/classsignal] signal when the user clicks the button.[br][br] - A signal is emitted by an object and can be received and handled by any other existing object - (including the object that emits the signal).[br] - The handler function for a signal is called "slot".[br] - It is just a convention: in fact, a slot is a normal object function (and any object function can be a slot). - More than one slot can be connected to a single signal, and more signals can be connected to a single slot.[br] - In this way, many objects can be notified of a change in a single object, as well as a single object - can easily handle state-changes for many objects.[br] - The signal/slot behaviour could be easily implemented by a careful usage of object functions. - [b]So why signals and slots?[/b][br] - Because signals are much more powerful in many situations. - The signals have no equivalent in C/C++... but they have been implemented in many highlevel - C/C++ libraries and development kits (including the system-wide signal/handler mechanism implemented - by all the modern kernels and used in inter-process communication).[br] -*/ - - - - -/////////////////////////////////////////////////////////////////////////////////////// - -/* - @doc: object - @keyterms: - object class, object, class - @title: - object class - @type: - class - @short: - Base class for all the KVIrc objects - @inherits: - none - @description: - This is the base class for all builtin KVirc object classes. - It exports functions to retrieve an object's name, to iterate - through child objects and to lookup a child object by name or class. - Additionally, this class provides builtin timer functionality. - The [classfnc]$constructor[/classfnc] and [classfnc]$destructor[/classfnc] - functions are empty implementations that all the other classes inherit. - @functions: - !fn: $constructor() - Constructor for this object class. - The default implementation does nothing. - !fn: $destructor() - Destructor for this object class. - The default implementation emits the signal "[classsignal]destroyed[/classsignal]". - !fn: $name() - Returns the name of this object. - !fn: $parent() - Returns the parent object of this object or 0 if this object has no parent. - !fn: $timerEvent() - Handler for the timer events. - The default implementation does nothing. - See also [classfnc]$startTimer[/classfnc]() - and [classfnc]$killTimer[/classfnc](). - !fn: $startTimer() - Starts a builtin timer for this object and returns its timer id - as a string or '-1' if was invalid. - The [classfnc]$timerEvent[/classfnc]() handler function - will be called every milliseconds until the timer is stopped by $killTimer(). - !fn: $killTimer() - Stops the timer specified by . - !fn: $className() - Returns the class name of this object instance - !fn: $findChild(,) - Returns the first child that matches and . - If is an empty string, any class matches, - if is an empty string, any name matches. - This function traverses the entire tree of children - but is NOT recursive. - !fn: $childCount() - Returns the number of child objects - !fn: $emit([,parameters]) - Emits the signal passing the optional [parameters]. - See the [doc:objects]objects documentation[/doc] for an overview of signals and slots. - !fn: $children() - Returns an array of child object identifiers. - !fn: $signalSender() - Returns the current signal sender when in a slot connected to a signal. - In other contexts this function returns an empty string. - You can safely use it to test if the current function has been - triggered directly or from a signal emission. - !fn: $signalName() - Returns the name of the last signal that has triggered one of this object's slots. - When called in a slot handler, the triggering signal name is returned. - !fn: $property([,bNowarning:boolean]) - This is for really advanced scripting.[br] - All KVIrc widgets are based on the Qt library ones.[br] - The Qt library allows to set and read special properties.[br] - You will have to take a look at the Qt documentation for each widget type - to see the available property names.[br] - The supported property types are: Rect, Size, Point, Color, String, CString, - Int, UInt, Bool and enumeration types.[br] - For example, the widget's x coordinate can be retrieved by using the [classfnc]$x[/classfnc]() - function or by calling $property(x).[br] - There are many properties that are available ony through the [classfnc]$property[/classfnc]() call:[br] - For example, you can find out if the widget accepts drops by calling [classfnc]$property[/classfnc](acceptDrops).[br] - This function will be mainly useful in the [class]wrapper[/class] class. - !fn: $setProperty(,) - Sets a qt property for this widget.[br] - This is for advanced scripting, and can control really many features of the Qt widgets.[br] - For example, the [class]multilineedit[/class] widgets can be set to - the "password" echo mode only by using this function call:[br] - [example] - %X=$new(lineedit, 0, a_name)[br] - %X->$show()[br] - %X->$setProperty(echoMode,Password)[br] - [/example] - The available properties to be set are listed by [classfnc]$listProperties[/classfnc]()[br] - and must appear in the list as writeable.[br] - This function will be mainly useful in the [class]wrapper[/class] class. - !fn: $listProperties([bArray]) - Lists the properties of this object.[br] - If is $true then the function returns the properties - as an array of descriptive strings, otherwise the properties are dumped to the - active window. If is not passed then it is assumed to be $false. - This function will be mainly useful in the [class]wrapper[/class] class. - @signals: - !sg: destroyed() - Emitted by the default implementation of [classfnc]$destructor[/classfnc]. - If you reimplement [classfnc]$destructor[/classfnc] in one of the derived - classes (or as a private implementation), and still want this signal - to be emitted you must emit it by yourself, or (better) call the base class - destructor. -*/ - -// we use a char * pointer just to store a number -// we don't use void * just because incrementing a void pointer doesn't look that good -static char * g_hNextObjectHandle = (char *)0; - - -KviKvsObject::KviKvsObject(KviKvsObjectClass * pClass,KviKvsObject * pParent,const QString &szName) -: QObject(pParent) -{ - setObjectName(szName); - - if(g_hNextObjectHandle == 0)g_hNextObjectHandle++; // make sure it's never 0 - m_hObject = (kvs_hobject_t)g_hNextObjectHandle; - g_hNextObjectHandle++; - - m_pObject = 0; - m_bObjectOwner = true; // true by default - - m_szName = szName; - - m_pClass = pClass; - - m_pChildList = new KviPointerList; - m_pChildList->setAutoDelete(false); - - m_pDataContainer = new KviKvsHash(); - - m_pFunctionHandlers = 0; // no local function handlers yet! - - m_bInDelayedDeath = false; - m_bDestructorCalled = false; - m_bAboutToDie = false; - - m_pSignalDict = 0; // no signals connected to remote slots - m_pConnectionList = 0; // no local slots connected to remote signals - - if(pParent) - pParent->registerChild(this); - - KviKvsKernel::instance()->objectController()->registerObject(this); - -// qDebug("Hello world!"); -// [root@localhost cvs3]# kvirc -// Hello world! -// [root@localhost cvs3]# date -// Tue Sep 5 21:53:54 CEST 2000 -// [root@localhost cvs3]# - -// Ported to KVS on 29.04.2005 -} - -KviKvsObject::~KviKvsObject() -{ - //KVI_TRACE_FUNCTION; - //KVI_TRACE("Destroying kvs object %x, child of %x",this,parentObject()); - - if(!m_bDestructorCalled) - { - // Destructor not called yet.. something is wrong. - if(!m_bAboutToDie) - { - // Ow... we are being deleted directly and not via die() or dieNow() - // This means that we need to call the kvs destructor here which - // is AFTER the C++ destructors of the derived classes. - // This means that a list object, for instance, will be already - // cleared in its kvs destructor which isn't that nice. - - // Complain to the developers so they fix the code. - KVI_ASSERT_MSG(m_bAboutToDie,"You should never delete a KviKvsObject directly, call dieNow() instead"); - - // If we pass the assert in some kind of build go ahead nicely - m_bAboutToDie = true; // don't attempt to die twice - } else { - // This might be an "early" delete after a delayedDie() call. - // It shouldn't happen very often but if it happens we can't do much about it... don't complain. - } - - // Well... need to call the destructor. - callDestructor(); - } else { - // Destructor already called. - m_bAboutToDie = true; // don't attempt to die twice - } - - // Kill any child not deleted by the user - while(m_pChildList->first()) - m_pChildList->first()->dieNow(); - - // Ok, from this point we shouldn't be touched by any one via KVS - // so we can start really deleting stuff... - delete m_pChildList; - - // Disconnect all the signals - for(;;) - { - if(!m_pSignalDict) - break; - KviPointerHashTableEntry * pSignalList = m_pSignalDict->firstEntry(); - if(!pSignalList) - break; - KviKvsObjectConnection * pConnection = pSignalList->data()->first(); - if(!pConnection) - break; - disconnectSignal(pSignalList->key(),pConnection); - } - - // Disconnect all the slots - for(;;) - { - if(!m_pConnectionList) - break; - KviKvsObjectConnection * pConnection = m_pConnectionList->first(); - if(!pConnection) - break; - // We need a copy of szSignal this since pConnection is deleted inside disconnectSignal() - // and pConnection->szSignal dies too (but is referenced after the connection delete) - QString szSignalCopy = pConnection->szSignal; - pConnection->pSourceObject->disconnectSignal(szSignalCopy,pConnection); - } - - // Detach from the kvs kernel - KviKvsKernel::instance()->objectController()->unregisterObject(this); - - // Detach from the parent object - if(parentObject()) - parentObject()->unregisterChild(this); - - // If we wrap a Qt object then detach and eventually delete - if(m_pObject) - { - // detach - disconnect(m_pObject,SIGNAL(destroyed()),this,SLOT(objectDestroyed())); - // delete if we own it - if(m_bObjectOwner) - delete m_pObject; - } - - // Kill member variables - delete m_pDataContainer; - // Kill function container - if(m_pFunctionHandlers) - delete m_pFunctionHandlers; - - // Bye bye :) -} - -void KviKvsObject::callDestructor() -{ - KVI_ASSERT(m_bAboutToDie); // this should be called by die(), dieNow() or ~KviKvsObject only, which set m_bAboutToDie to true. - KVI_ASSERT(!m_bDestructorCalled); // calling code must take care of this - - m_bDestructorCalled = true; - - // Note that children are still alive: the user can clean them up manually - callFunction(this,"destructor"); -} - -bool KviKvsObject::init(KviKvsRunTimeContext *,KviKvsVariantList *) -{ - return true; -} - -QWidget * KviKvsObject::parentScriptWidget() -{ - if(parentObject()) - { - if(parentObject()->object()) - { - if(parentObject()->object()->isWidgetType()) - return (QWidget *)(parentObject()->object()); - } - } - return 0; -} - -void KviKvsObject::unregisterChild(KviKvsObject *pChild) -{ - m_pChildList->removeRef(pChild); -} - -void KviKvsObject::registerChild(KviKvsObject *pChild) -{ - m_pChildList->append(pChild); -} - -// SIGNAL/SLOT stuff - -bool KviKvsObject::connectSignal(const QString &sigName,KviKvsObject * pTarget,const QString &slotName) -{ - if(!pTarget->lookupFunctionHandler(slotName))return false; // no such slot - - if(!m_pSignalDict) - { - m_pSignalDict = new KviPointerHashTable(7,false); - m_pSignalDict->setAutoDelete(true); - } - - KviKvsObjectConnectionList * l = m_pSignalDict->find(sigName); - if(!l) - { - l = new KviKvsObjectConnectionList; - l->setAutoDelete(true); - m_pSignalDict->insert(sigName,l); - } - - KviKvsObjectConnection * con = new KviKvsObjectConnection; - - con->pSourceObject = this; - con->pTargetObject = pTarget; - con->szSignal = sigName; - con->szSlot = slotName; - - l->append(con); - pTarget->registerConnection(con); - return true; -} - -void KviKvsObject::registerConnection(KviKvsObjectConnection *pConnection) -{ - if(!m_pConnectionList) - { - m_pConnectionList = new KviKvsObjectConnectionList; - m_pConnectionList->setAutoDelete(false); - } - m_pConnectionList->append(pConnection); -} - -bool KviKvsObject::disconnectSignal(const QString &sigName,KviKvsObject * pTarget,const QString &slotName) -{ - if(!m_pSignalDict)return false; //no such signal to disconnect - - KviKvsObjectConnectionList * l = m_pSignalDict->find(sigName); - if(!l)return false; - - KviKvsObjectConnectionListIterator it(*l); - - while(KviKvsObjectConnection * sl = it.current()) - { - if(sl->pTargetObject == pTarget) - { - if(KviQString::equalCI(sl->szSlot,slotName)) - { - pTarget->unregisterConnection(sl); - l->removeRef(sl); - if(l->isEmpty())m_pSignalDict->remove(sigName); - if(m_pSignalDict->isEmpty()) - { - delete m_pSignalDict; - m_pSignalDict = 0; - } - return true; - } - } - ++it; - } - return false; -} - -bool KviKvsObject::disconnectSignal(const QString &sigName,KviKvsObjectConnection * pConnection) -{ - if(!m_pSignalDict)return false; - KviKvsObjectConnectionList * l = m_pSignalDict->find(sigName); - //KVI_ASSERT(l); - if(!l)return false; - pConnection->pTargetObject->unregisterConnection(pConnection); - //KVI_ASSERT(l->findRef(pConnection) > -1); - l->removeRef(pConnection); - if(l->isEmpty())m_pSignalDict->remove(sigName); - if(m_pSignalDict->isEmpty()) - { - delete m_pSignalDict; - m_pSignalDict = 0; - } - return true; -} - -bool KviKvsObject::unregisterConnection(KviKvsObjectConnection * pConnection) -{ - if(!m_pConnectionList)return false; - bool bOk = m_pConnectionList->removeRef(pConnection); // no auto delete ! - if(!bOk)return false; - if(m_pConnectionList->isEmpty()) - { - delete m_pConnectionList; - m_pConnectionList = 0; - } - return true; -} - -int KviKvsObject::emitSignal(const QString &sigName,KviKvsObjectFunctionCall * pOuterCall,KviKvsVariantList * pParams) -{ - if(!m_pSignalDict)return 0; - - KviKvsObjectConnectionList * l = m_pSignalDict->find(sigName); - if(!l)return 0; // no slots registered - - KviKvsVariant retVal; - - // The objects we're going to disconnect - KviPointerList * pDis = 0; - - kvs_int_t emitted = 0; - - KviKvsObjectConnectionListIterator it(*l); - - while(KviKvsObjectConnection * s = it.current()) - { - // save it, since s may be destroyed in the call! - KviKvsObject * pTarget = s->pTargetObject; - - emitted++; - - kvs_hobject_t hTarget = pTarget->handle(); - kvs_hobject_t hOld = pTarget->signalSender(); - - pTarget->setSignalSender(m_hObject); - pTarget->setSignalName(sigName); - - if(!pTarget->callFunction(this,s->szSlot,QString(),pOuterCall->context(),&retVal,pParams)) - { - if(KviKvsKernel::instance()->objectController()->lookupObject(hTarget) && it.current()) - { - pOuterCall->warning( - __tr2qs_ctx("Broken slot '%Q' in target object '%Q::%Q' while emitting signal '%Q' from object '%Q::%Q': disconnecting","kvs"), - &(s->szSlot), - &(s->pTargetObject->getClass()->name()), - &(s->pTargetObject->getName()), - &(sigName), - &(getClass()->name()), - &m_szName); - - if(!pDis) - { - pDis = new KviPointerList; - pDis->setAutoDelete(false); - } - pDis->append(s); - } else { - // else destroyed in the call! (already disconnected) - - pOuterCall->warning( - __tr2qs_ctx("Slot target object destroyed while emitting signal '%Q' from object '%Q::%Q'","kvs"), - &(sigName), - &(getClass()->name()), - &m_szName); - } - } - - if(KviKvsKernel::instance()->objectController()->lookupObject(hTarget)) - { - pTarget->setSignalSender(hOld); - } - - ++it; - } - - if(pDis) - { - // we have some signals to disconnect (because they're broken) - for(KviKvsObjectConnection * con = pDis->first();con;con = pDis->next()) - disconnectSignal(sigName,con); - delete pDis; - } - - return emitted; -} - -bool KviKvsObject::function_name(KviKvsObjectFunctionCall * c) -{ - c->returnValue()->setString(getName()); - return true; -} - -bool KviKvsObject::function_parent(KviKvsObjectFunctionCall * c) -{ - KviKvsObject * o = parentObject(); - c->returnValue()->setHObject(o ? o->handle() : (kvs_hobject_t)0); - return true; -} - -bool KviKvsObject::function_className(KviKvsObjectFunctionCall * c) -{ - c->returnValue()->setString(getClass()->name()); - return true; -} - -bool KviKvsObject::function_childCount(KviKvsObjectFunctionCall * c) -{ - c->returnValue()->setInteger((kvs_int_t)(m_pChildList->count())); - return true; -} - -bool KviKvsObject::function_signalSender(KviKvsObjectFunctionCall * c) -{ - c->returnValue()->setHObject(m_hSignalSender); - return true; -} - -bool KviKvsObject::function_signalName(KviKvsObjectFunctionCall * c) -{ - c->returnValue()->setString(m_szSignalName); - return true; -} - -bool KviKvsObject::function_destructor(KviKvsObjectFunctionCall * c) -{ - emitSignal("destroyed",c); - return true; -} - -bool KviKvsObject::function_children(KviKvsObjectFunctionCall * c) -{ - KviKvsArray * a = new KviKvsArray(); - int id=0; - for(KviKvsObject * o = m_pChildList->first();o;o = m_pChildList->next()) - { - a->set(id,new KviKvsVariant(o->handle())); - id++; - } - c->returnValue()->setArray(a); - return true; -} - -bool KviKvsObject::function_findChild(KviKvsObjectFunctionCall * c) -{ - QString szClass,szName; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("className",KVS_PT_STRING,KVS_PF_OPTIONAL,szClass) - KVSO_PARAMETER("objectName",KVS_PT_STRING,KVS_PF_OPTIONAL,szName) - KVSO_PARAMETERS_END(c) - - KviKvsObject * o = findChild(szClass,szName); - c->returnValue()->setHObject(o ? o->handle() : (kvs_hobject_t)0); - - return true; -} - -bool KviKvsObject::function_emit(KviKvsObjectFunctionCall * c) -{ - QString szSignal; - KviKvsVariantList vList; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("signal",KVS_PT_NONEMPTYSTRING,0,szSignal) - KVSO_PARAMETER("params",KVS_PT_VARIANTLIST,KVS_PF_OPTIONAL,vList) - KVSO_PARAMETERS_END(c) - - emitSignal(szSignal,c,&vList); - return true; -} - -bool KviKvsObject::function_startTimer(KviKvsObjectFunctionCall * c) -{ - kvs_uint_t timeout; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("timeout",KVS_PT_UINT,0,timeout) - KVSO_PARAMETERS_END(c) - - c->returnValue()->setInteger((kvs_int_t)(startTimer(timeout))); - return true; -} - -bool KviKvsObject::function_killTimer(KviKvsObjectFunctionCall * c) -{ - kvs_int_t id; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("timerId",KVS_PT_INT,0,id) - KVSO_PARAMETERS_END(c) - killTimer(id); - return true; -} - -bool KviKvsObject::function_listProperties(KviKvsObjectFunctionCall * c) -{ - bool bArray = false; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("bArray",KVS_PT_BOOL,KVS_PF_OPTIONAL,bArray) - KVSO_PARAMETERS_END(c) - - c->returnValue()->setNothing(); - - KviKvsArray * a = bArray ? new KviKvsArray() : 0; - - KviWindow * w = c->context()->window(); - - if(!bArray) - w->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs_ctx("Listing Qt properties for object named '%Q' of KVS class %Q","kvs"),&m_szName,&(m_pClass->name())); - kvs_int_t cnt = 0; - if(m_pObject) - { - const QMetaObject *o = m_pObject->metaObject(); - if(!bArray) - w->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs_ctx("Properties for Qt class %s","kvs"),o->className()); - kvs_int_t idx = 0; - QMetaProperty prop = o->property(idx); - const QMetaProperty *p = ∝ - while(p) - { - QString szOut; - QString szName = p->name(); - QString szType = p->typeName(); - if(bArray) - KviQString::sprintf(szOut,"%Q, %Q",&szName,&szType); - else { - KviQString::sprintf(szOut,__tr2qs_ctx("Property: %c%Q%c, type %Q","kvs"),KVI_TEXT_BOLD,&szName,KVI_TEXT_BOLD,&szType); - szOut.prepend(" "); - } - - if(p->isEnumType()) - { - szOut += ", enum("; - szOut += ")"; - } - - - // FIXME: QT4 Need to read better the docs and check the changes: there seem to be too many - // for me to fix now. Actually I need to get the whole executable working... - if(p->isWritable())szOut += ", writable"; - if(bArray) - a->set(cnt,new KviKvsVariant(szOut)); - else - w->outputNoFmt(KVI_OUT_SYSTEMMESSAGE,szOut); - idx++; - if (idxpropertyCount()){ - prop = o->property(idx); - p = ∝ - } - else p=0; - cnt++; - } - - } - - if(bArray) - c->returnValue()->setArray(a); - else - w->output(KVI_OUT_SYSTEMMESSAGE,__tr2qs_ctx("%d properties listed","kvs"),cnt); - return true; -} - -bool KviKvsObject::function_setProperty(KviKvsObjectFunctionCall * c) -{ - QString szName; - KviKvsVariant * v; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("propertyName",KVS_PT_NONEMPTYSTRING,0,szName) - KVSO_PARAMETER("propertyValue",KVS_PT_VARIANT,0,v) - KVSO_PARAMETERS_END(c) - - c->returnValue()->setNothing(); - - if(!m_pObject) - { - // there are no Qt properties at all - c->warning(__tr2qs_ctx("The object named '%Q' of class '%Q' has no Qt properties","kvs"),&m_szName,&(m_pClass->name())); - return true; - } - - int idx = m_pObject->metaObject()->indexOfProperty(szName.toUtf8().data()); - if(idx < 0) - { - c->warning(__tr2qs_ctx("No Qt property named '%Q' for object named '%Q' of class '%Q'","kvs"),&szName,&m_szName,&(m_pClass->name())); - return true; - } - QMetaProperty prop = m_pObject->metaObject()->property(idx); - const QMetaProperty * p = ∝ - if(!p) - { - c->warning(__tr2qs_ctx("Can't find property named '%Q' for object named '%Q' of class '%Q': the property is indexed but it doesn't really exist","kvs"),&szName,&m_szName,&(m_pClass->name())); - return true; - } - - QVariant vv = m_pObject->property(szName.toUtf8().data()); - if(!vv.isValid()) - { - c->warning(__tr2qs_ctx("Can't find property named '%Q' for object named '%Q'of class '%Q': the property is indexed and defined but the returned variant is not valid","kvs"),&szName,&m_szName,&(m_pClass->name())); - return true; - } - - if(p->isEnumType()) - { - QString szKey; - v->asString(szKey); - int val = p->enumerator().keyToValue(szKey.toUtf8().data()); - QVariant var(val); - m_pObject->setProperty(szName.toUtf8().data(),var); - return true; - } - -#define WRONG_TYPE(__therighttype) \ - { \ - c->warning(__tr2qs_ctx("The property is of type %s but the supplied argument can't be converted to that type (expecting '%s')","kvs"),p->type(),__therighttype); \ - return true; \ - } - - switch(vv.type()) - { - case QVariant::Int: - { - kvs_int_t i; - if(!v->asInteger(i))WRONG_TYPE("integer") - m_pObject->setProperty(szName.toUtf8().data(),QVariant((int)i)); - } - break; - case QVariant::UInt: - { - kvs_int_t i; - if(!v->asInteger(i))WRONG_TYPE("unsigned integer") - if(i < 0)WRONG_TYPE("unsigned integer") - m_pObject->setProperty(szName.toUtf8().data(),QVariant((unsigned int)i)); - } - case QVariant::Double: - { - kvs_real_t i; - if(!v->asReal(i))WRONG_TYPE("real") - m_pObject->setProperty(szName.toUtf8().data(),QVariant((double)i)); - } - break; - case QVariant::Bool: - m_pObject->setProperty(szName.toUtf8().data(),QVariant(v->asBoolean())); - break; - case QVariant::String: - { - QString s; - v->asString(s); - m_pObject->setProperty(szName.toUtf8().data(),QVariant(s)); - } - break; - case QVariant::ByteArray: - { - QString s; - v->asString(s); - m_pObject->setProperty(szName.toUtf8().data(),QVariant(s.toUtf8())); - } - break; - case QVariant::Point: - { - if(!v->isArray())WRONG_TYPE("array(integer,integer)") - KviKvsArray * a = v->array(); - KviKvsVariant * x = a->at(0); - KviKvsVariant * y = a->at(1); - if(!x || !y)WRONG_TYPE("array(integer,integer)") - kvs_int_t iX,iY; - if(!x->asInteger(iX) || !y->asInteger(iY))WRONG_TYPE("array(integer,integer)") - m_pObject->setProperty(szName.toUtf8().data(),QVariant(QPoint(iX,iY))); - } - break; - case QVariant::Size: - { - if(!v->isArray())WRONG_TYPE("array(integer,integer)") - KviKvsArray * a = v->array(); - KviKvsVariant * w = a->at(0); - KviKvsVariant * h = a->at(1); - if(!w || !h)WRONG_TYPE("array(integer,integer)") - kvs_int_t iW,iH; - if(!w->asInteger(iW) || !h->asInteger(iH))WRONG_TYPE("array(integer,integer)") - m_pObject->setProperty(szName.toUtf8().data(),QVariant(QSize(iW,iH))); - } - break; - case QVariant::Rect: - { - if(!v->isArray())WRONG_TYPE("array(integer,integer,integer,integer)") - KviKvsArray * a = v->array(); - KviKvsVariant * x = a->at(0); - KviKvsVariant * y = a->at(1); - KviKvsVariant * w = a->at(2); - KviKvsVariant * h = a->at(3); - if(!x || !y || !w || !h)WRONG_TYPE("array(integer,integer,integer,integer)") - kvs_int_t iX,iY,iW,iH; - if(!x->asInteger(iX) || !y->asInteger(iY) || !w->asInteger(iW) || !h->asInteger(iH))WRONG_TYPE("array(integer,integer,integer,integer)") - m_pObject->setProperty(szName.toUtf8().data(),QVariant(QRect(iX,iY,iW,iH))); - } - break; - - case QVariant::Color: - { - if(!v->isArray())WRONG_TYPE("array(integer,integer,integer)") - KviKvsArray * a = v->array(); - KviKvsVariant * r = a->at(0); - KviKvsVariant * g = a->at(1); - KviKvsVariant * b = a->at(3); - if(!r || !g || !b)WRONG_TYPE("array(integer,integer,integer)") - kvs_int_t iR,iG,iB; - if(!r->asInteger(iR) || !g->asInteger(iG) || !b->asInteger(iB))WRONG_TYPE("array(integer,integer,integer)") - m_pObject->setProperty(szName.toUtf8().data(),QVariant(QColor(iR,iG,iB))); - } - break; - case QVariant::Font: - { - if(!v->isArray())WRONG_TYPE("array(string,integer,string)") - KviKvsArray * a = v->array(); - KviKvsVariant * ff = a->at(0); - KviKvsVariant * ps = a->at(1); - KviKvsVariant * fl = a->at(3); - if(!ff || !ps)WRONG_TYPE("array(string,integer,string)") - kvs_int_t iPs; - if(!ps->asInteger(iPs))WRONG_TYPE("array(string,integer,string)") - QString szFf,szFl; - ff->asString(szFf); - if(fl)fl->asString(szFl); - QFont fnt; - fnt.setFamily(szFf); - fnt.setPointSize(iPs); - if(szFl.indexOf('b',Qt::CaseInsensitive) != -1)fnt.setBold(true); - if(szFl.indexOf('i',Qt::CaseInsensitive) != -1)fnt.setItalic(true); - if(szFl.indexOf('u',Qt::CaseInsensitive) != -1)fnt.setUnderline(true); - if(szFl.indexOf('o',Qt::CaseInsensitive) != -1)fnt.setOverline(true); - if(szFl.indexOf('f',Qt::CaseInsensitive) != -1)fnt.setFixedPitch(true); - if(szFl.indexOf('s',Qt::CaseInsensitive) != -1)fnt.setStrikeOut(true); - m_pObject->setProperty(szName.toUtf8().data(),QVariant(fnt)); - } - break; - case QVariant::Pixmap|QVariant::Icon: - { - if(v->isHObject()) - { - if(v->hobject() == (kvs_hobject_t)0) - { - // null pixmap - if(vv.type() == QVariant::Pixmap) - m_pObject->setProperty(szName.toUtf8().data(),QVariant(QPixmap())); - else - m_pObject->setProperty(szName.toUtf8().data(),QVariant(QIcon())); - } else { - KviKvsObject * pix = KviKvsKernel::instance()->objectController()->lookupObject(v->hobject()); - if(!pix->inherits("KviScriptPixmapObject")) - c->warning(__tr2qs_ctx("A pixmap object, an image_id or an image file path is required for this property","kvs")); - else { - QVariant pixv = pix->property("pixmap"); - if(vv.type() == QVariant::Pixmap) - m_pObject->setProperty(szName.toUtf8().data(),QVariant(pixv.value())); - else - m_pObject->setProperty(szName.toUtf8().data(),QVariant(QIcon(pixv.value()))); - } - } - } else { - QString szStr; - v->asString(szStr); - QPixmap * pPix = g_pIconManager->getImage(szStr); - if(pPix) - { - if(vv.type() == QVariant::Pixmap) - m_pObject->setProperty(szName.toUtf8().data(),QVariant(*pPix)); - else - m_pObject->setProperty(szName.toUtf8().data(),QVariant(QIcon(*pPix))); - } - else - c->warning(__tr2qs_ctx("Can't find the requested image","kvs")); - } - } - - break; - - default: - c->warning(__tr2qs_ctx("Property '%Q' for object named '%Q' of class '%Q' has an unsupported data type","kvs"),&szName,&m_szName,&(m_pClass->name())); - c->returnValue()->setNothing(); - break; - } - return true; -} - -bool KviKvsObject::function_property(KviKvsObjectFunctionCall * c) -{ - QString szName; - bool bNoerror; - KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("propertyName",KVS_PT_NONEMPTYSTRING,0,szName) - KVSO_PARAMETER("bNowarning",KVS_PT_BOOL,KVS_PF_OPTIONAL,bNoerror) - KVSO_PARAMETERS_END(c) - - if(!m_pObject) - { - // there are no Qt properties at all - if (bNoerror) c->returnValue()->setString("No Qt properties"); - else - { - c->warning(__tr2qs_ctx("The object named '%Q' of class '%Q' has no Qt properties","kvs"),&m_szName,&(m_pClass->name())); - c->returnValue()->setNothing(); - } - return true; - } - - int idx = m_pObject->metaObject()->indexOfProperty(szName.toUtf8().data()); - if(idx < 0) - { - if(bNoerror) - c->returnValue()->setString("No Qt properties"); - else - { - c->warning(__tr2qs_ctx("No Qt property named '%Q' for object named '%Q' of class '%Q'","kvs"),&szName,&m_szName,&(m_pClass->name())); - c->returnValue()->setNothing(); - } - return true; - } - QMetaProperty prop = m_pObject->metaObject()->property(idx); - const QMetaProperty * p = ∝ - if(!p) - { - c->warning(__tr2qs_ctx("Can't find property named '%Q' for object named '%Q' of class '%Q': the property is indexed but it doesn't really exist","kvs"),&szName,&m_szName,&(m_pClass->name())); - c->returnValue()->setNothing(); - return true; - } - - QVariant v = m_pObject->property(szName.toUtf8().data()); - if(!v.isValid()) - { - c->warning(__tr2qs_ctx("Can't find property named '%Q' for object named '%Q' of class '%Q': the property is indexed and defined but the returned variant is not valid","kvs"),&szName,&m_szName,&(m_pClass->name())); - c->returnValue()->setNothing(); - return true; - } - - if(p->isEnumType()) - { - c->returnValue()->setString(p->enumerator().valueToKey(v.toInt())); - return true; - } - - switch(v.type()) - { - case QVariant::Int: - c->returnValue()->setInteger((kvs_int_t)v.toInt()); - break; - case QVariant::Double: - c->returnValue()->setReal((kvs_int_t)v.toDouble()); - break; - case QVariant::UInt: - c->returnValue()->setInteger((kvs_int_t)v.toUInt()); - break; - case QVariant::Bool: - c->returnValue()->setBoolean(v.toBool()); - break; - case QVariant::String: - c->returnValue()->setString(v.toString()); - break; - case QVariant::ByteArray: - c->returnValue()->setString(QString::fromUtf8(v.toByteArray().data())); - break; - case QVariant::Point: - { - QPoint p = v.toPoint(); - KviKvsArray * a = new KviKvsArray(); - a->set(0,new KviKvsVariant((kvs_int_t)p.x())); - a->set(1,new KviKvsVariant((kvs_int_t)p.y())); - c->returnValue()->setArray(a); - } - break; - case QVariant::Size: - { - QSize p = v.toSize(); - KviKvsArray * a = new KviKvsArray(); - a->set(0,new KviKvsVariant((kvs_int_t)p.width())); - a->set(1,new KviKvsVariant((kvs_int_t)p.height())); - c->returnValue()->setArray(a); - } - break; - case QVariant::Rect: - { - QRect p = v.toRect(); - KviKvsArray * a = new KviKvsArray(); - a->set(0,new KviKvsVariant((kvs_int_t)p.x())); - a->set(1,new KviKvsVariant((kvs_int_t)p.y())); - a->set(2,new KviKvsVariant((kvs_int_t)p.width())); - a->set(3,new KviKvsVariant((kvs_int_t)p.height())); - c->returnValue()->setArray(a); - } - break; - case QVariant::Color: - { - QColor clr = v.value(); - KviKvsArray * a = new KviKvsArray(); - a->set(0,new KviKvsVariant((kvs_int_t)clr.red())); - a->set(1,new KviKvsVariant((kvs_int_t)clr.green())); - a->set(2,new KviKvsVariant((kvs_int_t)clr.blue())); - c->returnValue()->setArray(a); - } - break; - case QVariant::Font: - { - QFont f = v.value(); - KviKvsArray * a = new KviKvsArray(); - a->set(0,new KviKvsVariant(f.family())); - a->set(1,new KviKvsVariant((kvs_int_t)f.pointSize())); - QString szFlags; - if(f.bold())szFlags += "b"; - if(f.underline())szFlags += "u"; - if(f.overline())szFlags += "o"; - if(f.strikeOut())szFlags += "s"; - if(f.fixedPitch())szFlags += "f"; - if(f.italic())szFlags += "i"; - a->set(2,new KviKvsVariant(szFlags)); - c->returnValue()->setString(szFlags); - } - break; - default: - if (bNoerror) c->returnValue()->setString("Unsupported_data_type"); - else - { - c->warning(__tr2qs_ctx("Property '%Q' for object named '%Q' of class '%Q' has an unsupported data type","kvs"),&szName,&m_szName,&(m_pClass->name())); - c->returnValue()->setNothing(); - } - break; - } - return true; -} - -void KviKvsObject::killAllChildrenWithClass(KviKvsObjectClass *cl) -{ - KviPointerList< QPointer > lDying; - lDying.setAutoDelete(true); - - KviKvsObject * pObject; - - QPointer guard(this); - - for(pObject = m_pChildList->first();pObject;pObject = m_pChildList->next()) - { - if(pObject->getClass() == cl) - { - lDying.append(new QPointer(pObject)); - } else { - pObject->killAllChildrenWithClass(cl); - if(guard.isNull()) - break; // argh.. circular delete - } - } - - for(QPointer * pObject = lDying.first();pObject;pObject = lDying.next()) - { - if(pObject->isNull()) - continue; // already dead ? - (*pObject)->dieNow(); - } -} - -bool KviKvsObject::inheritsClass(const QString &szClass) -{ - KviKvsObjectClass * pClass = KviKvsKernel::instance()->objectController()->lookupClass(szClass); - if (pClass) return inheritsClass(pClass); - else return false; -} -bool KviKvsObject::inheritsClass(KviKvsObjectClass * pClass) -{ - if(pClass == m_pClass)return true; - KviKvsObjectClass * cl = m_pClass->m_pParentClass; - while(cl) - { - if(cl == pClass)return true; - else cl = cl->m_pParentClass; - } - return false; -} - -KviKvsObjectClass * KviKvsObject::getClass(const QString & classOverride) -{ - if(classOverride.isEmpty())return m_pClass; - KviKvsObjectClass * cl = m_pClass; // class override can be also THIS class - // if object->$function() is a local override, class::object->$function() - // is the class member function (not the local override) - while(cl) - { - if(KviQString::equalCI(cl->name(),classOverride))break; - else cl = cl->m_pParentClass; - } - return cl; -} - -KviKvsObjectFunctionHandler * KviKvsObject::lookupFunctionHandler(const QString & funcName,const QString & classOverride) -{ - KviKvsObjectFunctionHandler * h = 0; - - if(classOverride.isEmpty() && m_pFunctionHandlers) - { - // lookup the local overrides - h = m_pFunctionHandlers->find(funcName); - } - - if(!h) - { - // not a local override function... lookup in the class - KviKvsObjectClass * cl = getClass(classOverride); - if(cl)return cl->lookupFunctionHandler(funcName); - } - - return h; -} - - -bool KviKvsObject::die() -{ - if(m_bAboutToDie) - return false; // hum.. recursive death attempt :D - - if(m_bInDelayedDeath) - return false; // we're alreadyi dying soon, dude, no need to repeat it over and over again... - - m_bInDelayedDeath = true; - - QTimer::singleShot(0,this,SLOT(delayedDie())); - return true; -} - -bool KviKvsObject::dieNow() -{ - if(m_bAboutToDie) - return false; // hum.. recursive death attempt :D - - m_bAboutToDie = true; - - KVI_ASSERT(!m_bDestructorCalled); - callDestructor(); - delete this; - - return true; -} - -void KviKvsObject::delayedDie() -{ - KVI_ASSERT(m_bInDelayedDeath); // must be true: never call it directly - KVI_ASSERT(!m_bAboutToDie); // if this is true something is wrong... - - m_bAboutToDie = true; - - KVI_ASSERT(!m_bDestructorCalled); - callDestructor(); - delete this; // byez! -} - -void KviKvsObject::setObject(QObject * o,bool bIsOwned) -{ - //__range_invalid(m_pObject); - m_bObjectOwner = bIsOwned; - m_pObject = o; - o->installEventFilter(this); - connect(m_pObject,SIGNAL(destroyed()),this,SLOT(objectDestroyed())); -} - -void KviKvsObject::objectDestroyed() -{ - m_pObject = 0; - die(); -} - -bool KviKvsObject::eventFilter(QObject *,QEvent *) -{ - return false; // do not stop -} - -void KviKvsObject::timerEvent(QTimerEvent *e) -{ - KviKvsVariant * v = new KviKvsVariant(); - v->setInteger(e->timerId()); - KviKvsVariantList parms(v); - - callFunction(this,"timerEvent",&parms); -} - -bool KviKvsObject::callFunction(KviKvsObject * pCaller,const QString &fncName,KviKvsVariant * pRetVal,KviKvsVariantList * pParams) -{ - KviKvsVariant rv; - if(!pRetVal)pRetVal = &rv; - KviKvsRunTimeContext ctx(0,g_pApp->activeConsole(),KviKvsKernel::instance()->emptyParameterList(),pRetVal,0); - if(!pParams)pParams = KviKvsKernel::instance()->emptyParameterList(); - return callFunction(pCaller,fncName,QString(),&ctx,pRetVal,pParams); -} - -bool KviKvsObject::callFunction(KviKvsObject * pCaller,const QString &fncName,KviKvsVariantList * pParams) -{ - KviKvsVariant fakeRetVal; - return callFunction(pCaller,fncName,&fakeRetVal,pParams); -} - -bool KviKvsObject::callFunction( - KviKvsObject * pCaller, - const QString & fncName, - const QString & classOverride, - KviKvsRunTimeContext * pContext, - KviKvsVariant * pRetVal, - KviKvsVariantList * pParams) -{ - KviKvsObjectFunctionHandler * h = lookupFunctionHandler(fncName,classOverride); - - if(!h) - { - if(classOverride.isEmpty()) - pContext->error(__tr2qs_ctx("Cannot find object function $%Q for object named '%Q' of class '%Q'","kvs"),&fncName,&m_szName,&(getClass()->name())); - else - pContext->error(__tr2qs_ctx("Cannot find object function $%Q::%Q for object named '%Q' of class '%Q'","kvs"),&classOverride,&fncName,&m_szName,&(getClass()->name())); - return false; - } - - if(h->flags() & KviKvsObjectFunctionHandler::Internal) - { - if(pCaller != this) - { - pContext->error(__tr2qs_ctx("Cannot call internal object function $%Q (for object named '%Q' of class '%Q') from this context","kvs"),&fncName,&m_szName,&(getClass()->name())); - return false; - } - } - - KviKvsObjectFunctionCall fc(pContext,pParams,pRetVal); - - return h->call(this,&fc); - - // Not only gcc spits out compiler errors: - // 25.09.2001, at this point in file - - // c:\programmi\microsoft visual studio\myprojects\kvirc3\src\kvirc\uparser\kvi_scriptobject.cpp(1234) : fatal error C1001: INTERNAL COMPILER ERROR - // (compiler file 'E:\8168\vc98\p2\src\P2\main.c', line 494) - // Please choose the Technical Support command on the Visual C++ - // Help menu, or open the Technical Support help file for more information -} - -void KviKvsObject::registerPrivateImplementation(const QString &szFunctionName,const QString &szCode) -{ - if(szCode.isEmpty()) - { - if(m_pFunctionHandlers) - { - m_pFunctionHandlers->remove(szFunctionName); - if(m_pFunctionHandlers->isEmpty()) - { - delete m_pFunctionHandlers; - m_pFunctionHandlers = 0; - } - } - } else { - if(!m_pFunctionHandlers) - { - m_pFunctionHandlers = new KviPointerHashTable(7,false); - m_pFunctionHandlers->setAutoDelete(true); - } - - QString szContext = m_pClass->name(); - szContext += "[privateimpl]::"; - szContext += szFunctionName; - - m_pFunctionHandlers->replace(szFunctionName,new KviKvsObjectScriptFunctionHandler(szContext,szCode,QString(""))); - } -} - -KviKvsObject * KviKvsObject::findChild(const QString &szClass,const QString &szName) -{ - for(KviKvsObject * o = m_pChildList->first();o;o= m_pChildList->next()) - { - if(szClass.isEmpty()) - { - // any class matches - if(szName.isEmpty())return o; // any name matches - // name must match - if(KviQString::equalCI(szName,o->objectName()))return o; - } else { - if(KviQString::equalCI(szClass,o->getClass()->name())) - { - if(szName.isEmpty())return o; // any name matches - // name must match - if(KviQString::equalCI(szName,o->objectName()))return o; - } - } - KviKvsObject * c = o->findChild(szClass,szName); - if(c)return c; - } - return 0; -} diff --git a/src/kvirc/kvs/KviKvsObject.h b/src/kvirc/kvs/KviKvsObject.h deleted file mode 100644 index 60bc44433..000000000 --- a/src/kvirc/kvs/KviKvsObject.h +++ /dev/null @@ -1,199 +0,0 @@ -#ifndef _KVI_KVS_OBJECT_H_ -#define _KVI_KVS_OBJECT_H_ -//============================================================================= -// -// File : KviKvsObject.h -// Creation date : Wed 08 Oct 2003 02:31:57 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2003-2010 Szymon Stefanek -// -// 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_settings.h" -#include "KviQString.h" -#include "KviPointerList.h" -#include "KviKvsRunTimeCall.h" -#include "KviKvsParameterProcessor.h" -#include "KviKvsObjectFunctionHandler.h" -#include "KviKvsTypes.h" - -#include - - -class KviKvsObjectFunctionCall; - -typedef struct _KviKvsObjectConnection -{ - KviKvsObject * pSourceObject; // source object (owner of the struct) - KviKvsObject * pTargetObject; // target object - QString szSignal; // source signal name - QString szSlot; // target slot function -} KviKvsObjectConnection; - -typedef KviPointerList KviKvsObjectConnectionList; -typedef KviPointerListIterator KviKvsObjectConnectionListIterator; - -class KVIRC_API KviKvsObject : public QObject -{ - friend class KviKvsObjectController; - friend class KviKvsObjectClass; - Q_OBJECT -public: - KviKvsObject(KviKvsObjectClass * pClass,KviKvsObject * pParent,const QString &szName); - virtual ~KviKvsObject(); -protected: - // main data - QString m_szName; // object name - kvs_hobject_t m_hObject; // global object handle - KviKvsObjectClass * m_pClass; // the class definition - - KviKvsHash * m_pDataContainer; // member variables - - KviPointerList * m_pChildList; - - KviPointerHashTable * m_pFunctionHandlers; // our function handlers - - KviPointerHashTable * m_pSignalDict; // our signals connected to other object functions - - KviKvsObjectConnectionList * m_pConnectionList; // signals connected to this object functions - - // this is valid when processing one of our slots - kvs_hobject_t m_hSignalSender; - QString m_szSignalName; - - // if this object wraps a qt one, it is here - QObject * m_pObject; - bool m_bObjectOwner; // do we have to destroy it ? - - // We're going to die soon after the control is given back to the event loop - bool m_bInDelayedDeath; - // We're going to die BEFORE the control is given back to the event loop - bool m_bAboutToDie; - // Did we already call the destructor ? - bool m_bDestructorCalled; -public: - kvs_hobject_t handle(){ return m_hObject; }; - - // the wrapped Qt object (may be 0!) - QObject * object() const { return m_pObject; }; - void setObject(QObject * o,bool bIsOwned = true); - - const QString & getName(){ return m_szName; }; - - KviKvsObject * parentObject(){ return (KviKvsObject *)parent(); }; - QWidget * parentScriptWidget(); - - bool connectSignal(const QString &sigName,KviKvsObject * target,const QString &slotName); - bool disconnectSignal(const QString &sigName,KviKvsObjectConnection * con); - bool disconnectSignal(const QString &sigName,KviKvsObject * target,const QString & slotName); - - // Emits a signal by calling all the attacched slots in an unspecified order. - // Returns the number of slots called (may be 0, if no slot is connected) - // The parameters are preserved. - // this is intended to be called from other function calls (the parameters are copied from pOuterCall) - // since we should NEVER emit totally spontaneous signals: all of them - // should be generated inside object functions (either from scripting or by core calls) - int emitSignal(const QString &sigName,KviKvsObjectFunctionCall * pOuterCall,KviKvsVariantList * pParams = 0); - - void setSignalSender(kvs_hobject_t hObject){ m_hSignalSender = hObject; }; - kvs_hobject_t signalSender(){ return m_hSignalSender; }; - void setSignalName(const QString &szSigName){ m_szSignalName = szSigName; }; - - KviPointerHashTable * functionHandlers(){ return m_pFunctionHandlers; }; - - KviKvsHash * dataContainer(){ return m_pDataContainer; }; - - bool die(); - bool dieNow(); - - KviKvsObjectClass * getExactClass(){ return m_pClass; }; - KviKvsObjectClass * getClass(const QString & classOverride = QString()); - bool inheritsClass(KviKvsObjectClass * pClass); - bool inheritsClass(const QString &szClass); - - KviKvsObjectFunctionHandler * lookupFunctionHandler(const QString & funcName,const QString & classOverride = QString()); - - // Registers a private implementation of a function - // The function may or may not be already registered in the class - // If szCode is empty the the private implementation is removed instead - void registerPrivateImplementation(const QString &szFunctionName,const QString &szCode); - - // ONLY pCaller can be zero here! - // please use one of the wrappers, if possible - bool callFunction( - KviKvsObject * pCaller, // calling object, can be zero (used for the "internal" access list verification) - const QString & fncName, // name of the function to call - const QString & classOverride, // eventual class override for the functon call, may be QString() - KviKvsRunTimeContext * pContext, // calling runtime context (you'll have problems with instantiating this... :P ) - KviKvsVariant * pRetVal, // the return value - KviKvsVariantList * pParams); // the parameters for the call - // a nice and simple wrapper: it accepts a parameter list only (eventually 0) - bool callFunction(KviKvsObject * pCaller,const QString &fncName,KviKvsVariantList * pParams = 0); - // this one gets a non null ret val too - bool callFunction(KviKvsObject * pCaller,const QString &fncName,KviKvsVariant * pRetVal,KviKvsVariantList * pParams = 0); - - KviKvsObject * findChild(const QString &szClass,const QString &szName); - void killAllChildrenWithClass(KviKvsObjectClass *cl); -protected: - void registerConnection(KviKvsObjectConnection * con); - bool unregisterConnection(KviKvsObjectConnection * con); - - virtual bool init(KviKvsRunTimeContext * pContext,KviKvsVariantList *pParams); - - void registerChild(KviKvsObject * c); - void unregisterChild(KviKvsObject *c); - - virtual bool eventFilter(QObject *o,QEvent *e); //necessary ? - virtual void timerEvent(QTimerEvent *e); -protected: - bool function_name(KviKvsObjectFunctionCall *c); - bool function_startTimer(KviKvsObjectFunctionCall *c); - bool function_killTimer(KviKvsObjectFunctionCall *c); - bool function_className(KviKvsObjectFunctionCall *c); - bool function_findChild(KviKvsObjectFunctionCall *c); - bool function_childCount(KviKvsObjectFunctionCall *c); - bool function_emit(KviKvsObjectFunctionCall *c); - bool function_children(KviKvsObjectFunctionCall *c); - bool function_signalSender(KviKvsObjectFunctionCall *c); - bool function_signalName(KviKvsObjectFunctionCall *c); - bool function_destructor(KviKvsObjectFunctionCall *c); - bool function_parent(KviKvsObjectFunctionCall *c); - bool function_property(KviKvsObjectFunctionCall *c); - bool function_setProperty(KviKvsObjectFunctionCall *c); - bool function_listProperties(KviKvsObjectFunctionCall *c); -protected slots: - void delayedDie(); - void objectDestroyed(); -private: - void callDestructor(); -}; - - -#define KVSO_PARAMETER(a,b,c,d) KVS_PARAMETER(a,b,c,d) - -#define KVSO_PARAMETERS_BEGIN(pCall) \ - KVS_PARAMETERS_BEGIN(parameter_format_list) - -#define KVSO_PARAMETERS_END(pCall) \ - KVS_PARAMETERS_END \ - if(!KviKvsParameterProcessor::process(pCall->params(),pCall->context(),parameter_format_list))return false; - - - - -#endif //!_KVI_KVS_OBJECT_H_ diff --git a/src/kvirc/kvs/KviKvsObjectClass.cpp b/src/kvirc/kvs/KviKvsObjectClass.cpp deleted file mode 100644 index 1240910a6..000000000 --- a/src/kvirc/kvs/KviKvsObjectClass.cpp +++ /dev/null @@ -1,235 +0,0 @@ -//============================================================================= -// -// File : kvi_kvs_objectclass.cpp -// Creation date : Sat 23 Apr 2005 20:31:32 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2005-2010 Szymon Stefanek -// -// 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 "KviKvsObjectClass.h" -#include "KviKvsObjectController.h" -#include "KviKvsObject.h" -#include "KviKvsKernel.h" -#include "KviKvsObjectFunctionHandlerImpl.h" -#include "KviKvsObjectFunctionCall.h" -#include "KviKvsRunTimeContext.h" -#include "KviKvsVariantList.h" -#include "KviKvsScript.h" -#include "KviFileUtils.h" -#include "KviWindow.h" -#include "KviCommandFormatter.h" -#include "KviLocale.h" - -KviKvsObjectClass::KviKvsObjectClass( - KviKvsObjectClass * pParent, - const QString &szName, - KviKvsObjectAllocateInstanceProc pProc, - bool bBuiltin) -{ - m_pParentClass = pParent; - if(m_pParentClass) - m_pParentClass->registerChildClass(this); - m_szName = szName; - m_bBuiltin = bBuiltin; - m_bDirty = !bBuiltin; - m_pFunctionHandlers = new KviPointerHashTable(17,false); - m_pFunctionHandlers->setAutoDelete(true); - m_pChildClasses = new KviPointerList; - m_pChildClasses->setAutoDelete(false); - m_allocProc = pProc ? pProc : pParent->m_allocProc; - - // inherit everything from the class above - if(pParent) - { - KviPointerHashTableIterator it(*(pParent->functionHandlers())); - while(KviKvsObjectFunctionHandler * fh = it.current()) - { - m_pFunctionHandlers->insert(it.currentKey(),fh->clone()); - KviKvsObjectFunctionHandler * f=m_pFunctionHandlers->find(it.currentKey()); - if (f->isScriptHandler()){ - f->setClone(true); - } - ++it; - } - } - - // "object" class is automatically registered in the controller constructor - KviKvsKernel::instance()->objectController()->registerClass(this); -} - -KviKvsObjectClass::~KviKvsObjectClass() -{ - // order here is critical - - // first of all kill our child classes - while(m_pChildClasses->first())delete m_pChildClasses->first(); - // then kill all objects that belong to our class - KviKvsKernel::instance()->objectController()->killAllObjectsWithClass(this); - // now we're quite clean: should have no object depending on us alive - // unregister from the parent, if any - if(m_pParentClass)m_pParentClass->unregisterChildClass(this); - // unregister from the object controller - KviKvsKernel::instance()->objectController()->unregisterClass(this); - // and start effectively dying - delete m_pFunctionHandlers; - // this is empty now - delete m_pChildClasses; -} - -void KviKvsObjectClass::registerFunctionHandler(const QString & szFunctionName,KviKvsObjectFunctionHandlerProc pProc,unsigned int uFlags) -{ - m_pFunctionHandlers->replace(szFunctionName,new KviKvsObjectCoreCallFunctionHandler(pProc,uFlags)); -} - -void KviKvsObjectClass::registerFunctionHandler(const QString & szFunctionName,const QString &szBuffer,const QString &szReminder,unsigned int uFlags) -{ - QString szContext = m_szName; - szContext += "::"; - szContext += szFunctionName; - m_pFunctionHandlers->replace(szFunctionName,new KviKvsObjectScriptFunctionHandler(szContext,szBuffer,szReminder,uFlags)); -} - -void KviKvsObjectClass::registerStandardNothingReturnFunctionHandler(const QString &szFunctionName) -{ - m_pFunctionHandlers->replace(szFunctionName,new KviKvsObjectStandardNothingReturnFunctionHandler()); -} - -void KviKvsObjectClass::registerStandardTrueReturnFunctionHandler(const QString &szFunctionName) -{ - m_pFunctionHandlers->replace(szFunctionName,new KviKvsObjectStandardTrueReturnFunctionHandler()); -} - -void KviKvsObjectClass::registerStandardFalseReturnFunctionHandler(const QString &szFunctionName) -{ - m_pFunctionHandlers->replace(szFunctionName,new KviKvsObjectStandardFalseReturnFunctionHandler()); -} - - -KviKvsObject * KviKvsObjectClass::allocateInstance(KviKvsObject * pParent,const QString &szName,KviKvsRunTimeContext * pContext,KviKvsVariantList * pParams) -{ - if(!m_allocProc) - return 0; - - KviKvsObject * pObject = m_allocProc(this,pParent,szName); - if(!pObject) - return 0; - - if(!pObject->init(pContext,pParams)) - { - // internal init failure : abort - pObject->dieNow(); - return 0; - } - - // copy params - KviKvsVariantList copy; - copy.setAutoDelete(false); - - KviKvsVariant * v = pParams->first(); - - while(v) - { - copy.append(v); - v = pParams->next(); - } - KviKvsVariant ret; - - if(!pObject->callFunction(pObject,"constructor",QString(),pContext,&ret,©)) - { - // ops...constructor failed (script error!) - pObject->dieNow(); - return 0; - } - - if(!ret.isEmpty()) - pContext->warning(__tr2qs_ctx("It's not allowed to return values in the constructor","kvs")); - - return pObject; -} - -void KviKvsObjectClass::registerChildClass(KviKvsObjectClass *pClass) -{ - m_pChildClasses->append(pClass); -} - -void KviKvsObjectClass::unregisterChildClass(KviKvsObjectClass *pClass) -{ - m_pChildClasses->removeRef(pClass); -} - -bool KviKvsObjectClass::save(const QString &szFileName) -{ - if(!m_pParentClass)return false; - if(isBuiltin())return false; - - - QString szBuffer; - QString szParentName = m_pParentClass->name(); - - KviQString::sprintf(szBuffer, - "# Automatically generated KVS class dump\n\n" \ - "class(\"%Q\",\"%Q\")\n" \ - "{\n", - &m_szName,&szParentName); - - KviPointerHashTableIterator it(*m_pFunctionHandlers); - - while(KviKvsObjectFunctionHandler * h = it.current()) - { - if(h->isScriptHandler() && !h->isClone()) - { - szBuffer += " "; - if(h->flags() & KviKvsObjectFunctionHandler::Internal) - szBuffer += "internal "; - szBuffer += "function "; - szBuffer += it.currentKey(); - szBuffer += "("+h->reminder()+")\n"; - QString szCode = h->scriptHandlerCode(); - KviCommandFormatter::blockFromBuffer(szCode); - KviCommandFormatter::indent(szCode); - szBuffer += szCode; - szBuffer += "\n"; - } - ++it; - } - - szBuffer += "}\n"; - - return KviFileUtils::writeFile(szFileName,szBuffer); -} -void KviKvsObjectClass::getFunctionCode(QString &szCode,KviKvsObjectFunctionHandler &h) -{ - szCode=h.scriptHandlerCode(); -} - -void KviKvsObjectClass::setReminder(const QString &szReminder,KviKvsObjectFunctionHandler *h) -{ - h->setReminder(szReminder); -} -QString KviKvsObjectClass::reminder(KviKvsObjectFunctionHandler *h) -{ - return h->reminder(); -} - -bool KviKvsObjectClass::load(const QString &szFileName) -{ - QString szBuffer; - if(!KviFileUtils::readFile(szFileName,szBuffer,0xffffff))return false; - return KviKvsScript::run(szBuffer,g_pActiveWindow); -} diff --git a/src/kvirc/kvs/KviKvsObjectClass.h b/src/kvirc/kvs/KviKvsObjectClass.h deleted file mode 100644 index 0845c1cb6..000000000 --- a/src/kvirc/kvs/KviKvsObjectClass.h +++ /dev/null @@ -1,112 +0,0 @@ -#ifndef _KVI_KVS_OBJECTCLASS_H_ -#define _KVI_KVS_OBJECTCLASS_H_ -//============================================================================= -// -// File : kvi_kvs_objectclass.h -// Creation date : Sat 23 Apr 2005 20:31:32 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2005-2010 Szymon Stefanek -// -// 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_settings.h" -#include "KviQString.h" -#include "KviPointerList.h" - -#include "KviPointerHashTable.h" - -#include "KviKvsObjectFunctionHandler.h" - -class KviKvsObject; -class KviKvsObjectClass; -class KviKvsRunTimeContext; -class KviKvsVariantList; -class KviKvsVariant; -// Object allocation function -// parameters are: the class, the parent object (eventually 0), the object name (eventually empty) -typedef KviKvsObject * (*KviKvsObjectAllocateInstanceProc)(KviKvsObjectClass *,KviKvsObject *,const QString &); - -// An object function callback -typedef bool (KviKvsObject::*KviKvsObjectFunctionHandlerProc)(KviKvsObjectFunctionCall * pCall); - - -// The descriptor of a kvirc object class - -class KVIRC_API KviKvsObjectClass -{ - friend class KviKvsObject; - friend class KviKvsObjectController; -public: - KviKvsObjectClass( - KviKvsObjectClass * pParent, // parent class - const QString & szName, // class name - KviKvsObjectAllocateInstanceProc proc, // intance allocation proc - bool bBuiltin = true // this is a builtin or script based class ? - ); - ~KviKvsObjectClass(); -protected: - KviKvsObjectClass * m_pParentClass; // the parent (base) class - QString m_szName; // the class name - bool m_bBuiltin; // is this a builtin or script based class ? - KviPointerHashTable * m_pFunctionHandlers; // all our function handlers - KviPointerList * m_pChildClasses; // - KviKvsObjectAllocateInstanceProc m_allocProc; - bool m_bDirty; // not yet flushed to disk (only for not builtin classes) -protected: - void registerChildClass(KviKvsObjectClass *pClass); - void unregisterChildClass(KviKvsObjectClass *pClass); - KviPointerHashTable * functionHandlers(){ return m_pFunctionHandlers; }; -public: - void clearDirtyFlag(){ m_bDirty = false; }; - bool isDirty(){ return m_bDirty; }; - bool isBuiltin(){ return m_bBuiltin; }; - bool isScriptHandler(const QString & szFunctionName) - { - KviKvsObjectFunctionHandler *pFunctionHandler=m_pFunctionHandlers->find(szFunctionName); - if (pFunctionHandler) return pFunctionHandler->isScriptHandler(); - else return false; - }; - void setReminder(const QString &szReminder,KviKvsObjectFunctionHandler *h); - QString reminder(KviKvsObjectFunctionHandler *h); - - - const QString & name(){ return m_szName; }; - KviKvsObjectClass * parentClass(){ return m_pParentClass; }; - // pProc CAN'T be zero here! - void registerFunctionHandler(const QString & szFunctionName,KviKvsObjectFunctionHandlerProc pProc,unsigned int uFlags = 0); - void registerFunctionHandler(const QString & szFunctionName,const QString &szBuffer,const QString &szReminder,unsigned int uFlags = 0); - - // registers an empty handler that returns "nothing" - void registerStandardNothingReturnFunctionHandler(const QString & szFunc); - // retisters an empty handler that returns $true - void registerStandardTrueReturnFunctionHandler(const QString & szFunc); - // retisters an empty handler that returns $false - void registerStandardFalseReturnFunctionHandler(const QString & szFunc); - - KviKvsObjectFunctionHandler * lookupFunctionHandler(const QString & szFunc){ return m_pFunctionHandlers->find(szFunc); }; - KviKvsObject * allocateInstance(KviKvsObject * pParent,const QString &szName,KviKvsRunTimeContext * pContext,KviKvsVariantList * pParams); - - bool save(const QString &szFileName); - static bool load(const QString &szFileName); - void getFunctionCode(QString &szCode,KviKvsObjectFunctionHandler &h); - KviPointerHashTable * getHandlers(){return m_pFunctionHandlers;}; - -}; - - -#endif //!_KVI_KVS_OBJECTCLASS_H_ diff --git a/src/kvirc/kvs/KviKvsObjectController.cpp b/src/kvirc/kvs/KviKvsObjectController.cpp deleted file mode 100644 index 4d9105021..000000000 --- a/src/kvirc/kvs/KviKvsObjectController.cpp +++ /dev/null @@ -1,258 +0,0 @@ -//============================================================================= -// -// File : KviKvsObjectController.cpp -// Creation date : Sun 24 Apr 2005 05:23:04 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2005-2010 Szymon Stefanek -// -// 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 "KviKvsObjectController.h" -#include "KviModuleManager.h" -#include "KviFileUtils.h" -#include "KviApplication.h" - -#include - -//////////////////////////////////////////////////////////////////////////////////////// - -static KviKvsObject * objectClassCreateInstance(KviKvsObjectClass *pClass,KviKvsObject *pParent,const QString &szName) -{ - return new KviKvsObject(pClass,pParent,szName); -} - -//////////////////////////////////////////////////////////////////////////////////////// - -KviKvsObjectController::KviKvsObjectController() -{ - m_pTopLevelObjectList = new KviPointerList; - m_pTopLevelObjectList->setAutoDelete(false); - m_pObjectDict = new KviPointerHashTable(101); - m_pObjectDict->setAutoDelete(false); - m_pClassDict = new KviPointerHashTable(31,false); - m_pClassDict->setAutoDelete(false); -} - -KviKvsObjectController::~KviKvsObjectController() -{ - flushUserClasses(); - while(m_pTopLevelObjectList->first()) - m_pTopLevelObjectList->first()->dieNow(); - delete m_pTopLevelObjectList; // empty list - delete m_pObjectDict; // empty dict - m_pObjectDict = 0; - delete m_pObjectClass; // delete the class tree - delete m_pClassDict; // empty dict -} - -void KviKvsObjectController::init() -{ - // allocate the "object" builtin class - // this is the only one that is always in core memory - m_pObjectClass = new KviKvsObjectClass(0,"object",objectClassCreateInstance,true); - - m_pObjectClass->registerFunctionHandler("name",KVI_PTR2MEMBER(KviKvsObject::function_name)); - m_pObjectClass->registerFunctionHandler("startTimer",KVI_PTR2MEMBER(KviKvsObject::function_startTimer)); - m_pObjectClass->registerFunctionHandler("killTimer",KVI_PTR2MEMBER(KviKvsObject::function_killTimer)); - m_pObjectClass->registerFunctionHandler("className",KVI_PTR2MEMBER(KviKvsObject::function_className)); - m_pObjectClass->registerFunctionHandler("findChild",KVI_PTR2MEMBER(KviKvsObject::function_findChild)); - m_pObjectClass->registerFunctionHandler("childCount",KVI_PTR2MEMBER(KviKvsObject::function_childCount)); - m_pObjectClass->registerFunctionHandler("emit",KVI_PTR2MEMBER(KviKvsObject::function_emit)); - m_pObjectClass->registerFunctionHandler("children",KVI_PTR2MEMBER(KviKvsObject::function_children)); - m_pObjectClass->registerFunctionHandler("signalSender",KVI_PTR2MEMBER(KviKvsObject::function_signalSender)); - m_pObjectClass->registerFunctionHandler("signalName",KVI_PTR2MEMBER(KviKvsObject::function_signalName)); - m_pObjectClass->registerFunctionHandler("destructor",KVI_PTR2MEMBER(KviKvsObject::function_destructor)); - m_pObjectClass->registerFunctionHandler("parent",KVI_PTR2MEMBER(KviKvsObject::function_parent)); - m_pObjectClass->registerFunctionHandler("property",KVI_PTR2MEMBER(KviKvsObject::function_property)); - m_pObjectClass->registerFunctionHandler("setProperty",KVI_PTR2MEMBER(KviKvsObject::function_setProperty)); - m_pObjectClass->registerFunctionHandler("listProperties",KVI_PTR2MEMBER(KviKvsObject::function_listProperties)); - - m_pObjectClass->registerStandardNothingReturnFunctionHandler("constructor"); - m_pObjectClass->registerStandardNothingReturnFunctionHandler("timerEvent"); - - m_pClassDict->insert("object",m_pObjectClass); -} - -void KviKvsObjectController::killAllObjectsWithClass(KviKvsObjectClass * pClass) -{ - if(!m_pObjectDict) - return; // no more objects at all... - - KviPointerList< QPointer > lDying; - lDying.setAutoDelete(true); - - KviKvsObject * pObject; - - for(pObject = m_pTopLevelObjectList->first();pObject;pObject = m_pTopLevelObjectList->next()) - { - if(pObject->getClass() == pClass) - { - lDying.append(new QPointer(pObject)); - } else { - pObject->killAllChildrenWithClass(pClass); - } - } - - for(QPointer * pObject = lDying.first();pObject;pObject = lDying.next()) - { - if(pObject->isNull()) - continue; // already dead ? - (*pObject)->dieNow(); - } -} - -void KviKvsObjectController::clearUserClasses() -{ - flushUserClasses(); - KviPointerHashTableIterator it(*m_pClassDict); - KviPointerList lDying; - lDying.setAutoDelete(false); - while(it.current()) - { - if(!(it.current()->isBuiltin())) - lDying.append(it.current()); - ++it; - } - - for(KviKvsObjectClass * pDyingClass = lDying.first();pDyingClass;pDyingClass = lDying.next()) - { - if(!m_pClassDict->findRef(pDyingClass)) - continue; // already deleted (by parent <-> child relations) - delete pDyingClass; - } -} - -void KviKvsObjectController::clearInstances() -{ - while(m_pTopLevelObjectList->first()) - m_pTopLevelObjectList->first()->dieNow(); - - delete m_pTopLevelObjectList; // empty list - delete m_pObjectDict; // empty dict - - m_pTopLevelObjectList = new KviPointerList; - m_pTopLevelObjectList->setAutoDelete(false); - - m_pObjectDict = new KviPointerHashTable(101); - m_pObjectDict->setAutoDelete(false); -} - -void KviKvsObjectController::registerClass(KviKvsObjectClass *pClass) -{ - m_pClassDict->insert(pClass->name(),pClass); -} - -void KviKvsObjectController::unregisterClass(KviKvsObjectClass *pClass) -{ - if(!pClass->isBuiltin()) - { - if(pClass->isDirty())flushUserClasses(); - } - m_pClassDict->remove(pClass->name()); -} - -void KviKvsObjectController::registerObject(KviKvsObject *pObject) -{ - m_pObjectDict->insert(pObject->handle(),pObject); - if(pObject->parent() == 0)m_pTopLevelObjectList->append(pObject); -} - -void KviKvsObjectController::unregisterObject(KviKvsObject *pObject) -{ - m_pObjectDict->remove(pObject->handle()); - if(pObject->parent() == 0)m_pTopLevelObjectList->removeRef(pObject); -} - -void KviKvsObjectController::flushUserClasses() -{ - KviPointerHashTableIterator it(*m_pClassDict); - while(KviKvsObjectClass * c = it.current()) - { - if(!c->isBuiltin()) - { - if(c->isDirty()) - { - QString szPath; - QString szFileName = c->name().toLower(); - szFileName += ".kvs"; - szFileName.replace("::","--"); - g_pApp->getLocalKvircDirectory(szPath,KviApplication::Classes,szFileName); - if(c->save(szPath)) - c->clearDirtyFlag(); - else - qDebug("Oops.. failed to save the object class %s",c->name().toLatin1().data()); - } - } - ++it; - } -} - -KviKvsObjectClass * KviKvsObjectController::lookupClass(const QString &szClass,bool bBuiltinOnly) -{ - KviKvsObjectClass * pC = m_pClassDict->find(szClass); - if(!pC) - { - // maybe we need to load the object library ? - KviModule * pModule = g_pModuleManager->getModule("objects"); - if(!pModule) - { - qDebug("ops...something wrong with the libkviobjects module!"); - return 0; - } else pC = m_pClassDict->find(szClass); - if(!pC) - { - if(bBuiltinOnly)return 0; - // maybe we need to load it from permanent storage... - QString szPath; - QString szFileName = szClass.toLower(); - szFileName += ".kvs"; - szFileName.replace("::","--"); - g_pApp->getLocalKvircDirectory(szPath,KviApplication::Classes,szFileName); - if(!KviFileUtils::fileExists(szPath)) - g_pApp->getGlobalKvircDirectory(szPath,KviApplication::Classes,szFileName); - if(!KviFileUtils::fileExists(szPath))return 0; - if(!KviKvsObjectClass::load(szPath))return 0; - pC = m_pClassDict->find(szClass); - if(pC)pC->clearDirtyFlag(); // just loaded from disk: no need to sync it - } - } else { - if(bBuiltinOnly) - { - if(!pC->isBuiltin())return 0; - } - } - return pC; -}; - - -void KviKvsObjectController::deleteClass(KviKvsObjectClass * pClass) -{ - KVI_ASSERT(pClass); - - pClass->clearDirtyFlag(); // don't flush it to disk - - QString szPath; - QString szFileName = pClass->name().toLower(); - szFileName += ".kvs"; - szFileName.replace("::","--"); - g_pApp->getLocalKvircDirectory(szPath,KviApplication::Classes,szFileName); - KviFileUtils::removeFile(szPath); - - delete pClass; -} - diff --git a/src/kvirc/kvs/KviKvsObjectController.h b/src/kvirc/kvs/KviKvsObjectController.h deleted file mode 100644 index 9e4b5b790..000000000 --- a/src/kvirc/kvs/KviKvsObjectController.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef _KVI_KVS_OBJECT_CONTROLLER_H_ -#define _KVI_KVS_OBJECT_CONTROLLER_H_ -//============================================================================= -// -// File : KviKvsObjectController.h -// Creation date : Sun 24 Apr 2005 05:23:04 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2005-2010 Szymon Stefanek -// -// 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_settings.h" - -#include "KviQString.h" -#include "KviPointerList.h" - -#include "KviPointerHashTable.h" -#include "KviPointerHashTable.h" - -#include "KviKvsObject.h" -#include "KviKvsObjectClass.h" - -class KVIRC_API KviKvsObjectController -{ - friend class KviKvsObject; - friend class KviKvsObjectClass; -public: - KviKvsObjectController(); - ~KviKvsObjectController(); -protected: - KviPointerList * m_pTopLevelObjectList; - KviPointerHashTable * m_pObjectDict; - KviPointerHashTable * m_pClassDict; - KviKvsObjectClass * m_pObjectClass; //base class -protected: - // the classes and the objects register themselves with the controller - void registerObject(KviKvsObject *pObject); - void unregisterObject(KviKvsObject *pObject); - void registerClass(KviKvsObjectClass *pClass); - void unregisterClass(KviKvsObjectClass *pClass); -public: - void init(); - void deleteClass(KviKvsObjectClass * pClass); - void clearInstances(); - void clearUserClasses(); - void flushUserClasses(); - void killAllObjectsWithClass(KviKvsObjectClass * pClass); - KviKvsObjectClass * lookupClass(const QString &szClass,bool bBuiltinOnly = false); - KviKvsObject * lookupObject(kvs_hobject_t hObject){ return m_pObjectDict->find(hObject); }; - KviPointerHashTable * objectDict(){ return m_pObjectDict; }; - KviPointerHashTable * classDict(){ return m_pClassDict; }; -}; - -#endif //!_KVI_KVS_OBJECT_CONTROLLER_H_ diff --git a/src/kvirc/kvs/KviKvsObjectFunctionCall.cpp b/src/kvirc/kvs/KviKvsObjectFunctionCall.cpp deleted file mode 100644 index c873ab645..000000000 --- a/src/kvirc/kvs/KviKvsObjectFunctionCall.cpp +++ /dev/null @@ -1,26 +0,0 @@ -//============================================================================= -// -// File : KviKvsObjectFunctionCall.cpp -// Creation date : Sun 24 Apr 2005 04:05:54 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2005-2010 Szymon Stefanek -// -// 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 "KviKvsObjectFunctionCall.h" - diff --git a/src/kvirc/kvs/KviKvsObjectFunctionCall.h b/src/kvirc/kvs/KviKvsObjectFunctionCall.h deleted file mode 100644 index 86cb2a3f5..000000000 --- a/src/kvirc/kvs/KviKvsObjectFunctionCall.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef _KVI_KVS_OBJECT_FUNCTIONCALL_H_ -#define _KVI_KVS_OBJECT_FUNCTIONCALL_H_ -//============================================================================= -// -// File : KviKvsObjectFunctionCall.h -// Creation date : Sun 24 Apr 2005 04:05:54 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2005-2010 Szymon Stefanek -// -// 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_settings.h" - -#include "KviKvsRunTimeCall.h" -#include "KviKvsVariantList.h" -#include "KviKvsVariant.h" - - -class KVIRC_API KviKvsObjectFunctionCall : public KviKvsRunTimeCall -{ -protected: - KviKvsVariant * m_pResult; -public: - KviKvsObjectFunctionCall(KviKvsRunTimeContext * pContext, - KviKvsVariantList * pParams, - KviKvsVariant * pResult) - : KviKvsRunTimeCall(pContext,pParams), m_pResult(pResult) - {}; - ~KviKvsObjectFunctionCall(){}; -public: - KviKvsVariant * returnValue(){ return m_pResult; }; -}; - -#endif //!_KVI_KVS_OBJECT_FUNCTIONCALL_H_ diff --git a/src/kvirc/kvs/KviKvsObjectFunctionHandler.cpp b/src/kvirc/kvs/KviKvsObjectFunctionHandler.cpp deleted file mode 100644 index 032f7aa73..000000000 --- a/src/kvirc/kvs/KviKvsObjectFunctionHandler.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//============================================================================= -// -// File : KviKvsObjectFunctionHandler.cpp -// Creation date : Sat 23 Apr 2005 21:53:23 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2005-2010 Szymon Stefanek -// -// 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 "KviKvsObjectFunctionHandler.h" - -KviKvsObjectFunctionHandler::KviKvsObjectFunctionHandler(unsigned int uFlags) -: m_uFlags(uFlags) -{ - m_bClone=false; -} - -KviKvsObjectFunctionHandler::~KviKvsObjectFunctionHandler() -{ -} - -bool KviKvsObjectFunctionHandler::isScriptHandler() -{ - return false; -} - -QString KviKvsObjectFunctionHandler::scriptHandlerCode() -{ - return QString(); -} -QString KviKvsObjectFunctionHandler::reminder() -{ - return QString(); -} -void KviKvsObjectFunctionHandler::setReminder(const QString &) -{ -} - -bool KviKvsObjectFunctionHandler::isClone() -{ - return m_bClone; -} diff --git a/src/kvirc/kvs/KviKvsObjectFunctionHandler.h b/src/kvirc/kvs/KviKvsObjectFunctionHandler.h deleted file mode 100644 index 05a23173c..000000000 --- a/src/kvirc/kvs/KviKvsObjectFunctionHandler.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef _KVI_KVS_OBJECT_FUNCTIONHANDLER_H_ -#define _KVI_KVS_OBJECT_FUNCTIONHANDLER_H_ -//============================================================================= -// -// File : KviKvsObjectFunctionHandler.h -// Creation date : Sat 23 Apr 2005 21:53:23 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2005-2010 Szymon Stefanek -// -// 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_settings.h" -#include "KviQString.h" - -class KviKvsObjectClass; -class KviKvsObjectFunctionCall; -class KviKvsObject; - - -class KVIRC_API KviKvsObjectFunctionHandler -{ - friend class KviKvsObject; - friend class KviKvsObjectClass; -public: - enum Flags { Internal = 1 }; -protected: - unsigned int m_uFlags; - bool m_bClone; -protected: - KviKvsObjectFunctionHandler(unsigned int uFlags = 0); -public: - virtual ~KviKvsObjectFunctionHandler(); -public: - void setClone(bool bCl){m_bClone=bCl;}; - bool isClone(); - unsigned int flags(){ return m_uFlags; }; -protected: - virtual bool isScriptHandler(); - virtual QString scriptHandlerCode(); - virtual QString reminder(); - virtual void setReminder(const QString &szReminder); - virtual KviKvsObjectFunctionHandler * clone() = 0; - virtual bool call(KviKvsObject * pObject,KviKvsObjectFunctionCall * pCall) = 0; -}; - - -#endif //!_KVI_KVS_OBJECT_FUNCTIONHANDLER_H_ diff --git a/src/kvirc/kvs/KviKvsObjectFunctionHandlerImpl.cpp b/src/kvirc/kvs/KviKvsObjectFunctionHandlerImpl.cpp deleted file mode 100644 index e885cf843..000000000 --- a/src/kvirc/kvs/KviKvsObjectFunctionHandlerImpl.cpp +++ /dev/null @@ -1,147 +0,0 @@ -//============================================================================= -// -// File : KviKvsObjectFunctionHandlerImpl.cpp -// Creation date : Sun 24 Apr 2005 04:01:14 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2005-2010 Szymon Stefanek -// -// 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 "KviKvsObjectFunctionHandlerImpl.h" -#include "KviKvsObjectFunctionCall.h" -#include "KviKvsScript.h" - - - -KviKvsObjectFunctionHandler * KviKvsObjectStandardTrueReturnFunctionHandler::clone() -{ - return new KviKvsObjectStandardTrueReturnFunctionHandler(); -} - -bool KviKvsObjectStandardTrueReturnFunctionHandler::call(KviKvsObject *,KviKvsObjectFunctionCall * pCall) -{ - pCall->returnValue()->setBoolean(true); - return true; -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -KviKvsObjectFunctionHandler * KviKvsObjectStandardFalseReturnFunctionHandler::clone() -{ - return new KviKvsObjectStandardFalseReturnFunctionHandler(); -} - -bool KviKvsObjectStandardFalseReturnFunctionHandler::call(KviKvsObject *,KviKvsObjectFunctionCall * pCall) -{ - pCall->returnValue()->setBoolean(false); - return true; -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -KviKvsObjectFunctionHandler * KviKvsObjectStandardNothingReturnFunctionHandler::clone() -{ - return new KviKvsObjectStandardNothingReturnFunctionHandler(); -} - -bool KviKvsObjectStandardNothingReturnFunctionHandler::call(KviKvsObject *,KviKvsObjectFunctionCall * pCall) -{ - pCall->returnValue()->setNothing(); - return true; -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -KviKvsObjectCoreCallFunctionHandler::KviKvsObjectCoreCallFunctionHandler(KviKvsObjectFunctionHandlerProc pProc,unsigned int uFlags) -: KviKvsObjectFunctionHandler(uFlags) -{ - m_pProc = pProc; -} - -KviKvsObjectCoreCallFunctionHandler::KviKvsObjectCoreCallFunctionHandler(const KviKvsObjectCoreCallFunctionHandler &h) -: KviKvsObjectFunctionHandler(h.m_uFlags) -{ - m_pProc = h.m_pProc; -} - -KviKvsObjectCoreCallFunctionHandler::~KviKvsObjectCoreCallFunctionHandler() -{ -} - -KviKvsObjectFunctionHandler * KviKvsObjectCoreCallFunctionHandler::clone() -{ - return new KviKvsObjectCoreCallFunctionHandler(*this); -} - -bool KviKvsObjectCoreCallFunctionHandler::call(KviKvsObject * pObject,KviKvsObjectFunctionCall * pCall) -{ - // Actually m_pProc can't be 0: if it's zero then it's a BUG and should be traced down: we just crash - //if(m_pProc) - return (pObject->*m_pProc)(pCall); - //else { - // empty handler - //pCall->returnValue()->setNothing(); - //return true; - //} -} - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -KviKvsObjectScriptFunctionHandler::KviKvsObjectScriptFunctionHandler(const QString &szScriptContext,const QString &szCode,const QString &szReminder,unsigned int uFlags) -: KviKvsObjectFunctionHandler(uFlags) -{ - m_pHandler = new KviKvsScript(szScriptContext,szCode,KviKvsScript::InstructionList); - m_szReminder = szReminder; -} - -KviKvsObjectScriptFunctionHandler::KviKvsObjectScriptFunctionHandler(const KviKvsObjectScriptFunctionHandler &h) -: KviKvsObjectFunctionHandler(h.m_uFlags) -{ - // ref - m_pHandler = new KviKvsScript(*(h.m_pHandler)); -} - -KviKvsObjectScriptFunctionHandler::~KviKvsObjectScriptFunctionHandler() -{ - delete m_pHandler; -} - -bool KviKvsObjectScriptFunctionHandler::isScriptHandler() -{ - return true; -} - -QString KviKvsObjectScriptFunctionHandler::scriptHandlerCode() -{ - return m_pHandler->code(); -} -QString KviKvsObjectScriptFunctionHandler::reminder() -{ - return m_szReminder; -} - -KviKvsObjectFunctionHandler * KviKvsObjectScriptFunctionHandler::clone() -{ - return new KviKvsObjectScriptFunctionHandler(*this); -} - -bool KviKvsObjectScriptFunctionHandler::call(KviKvsObject * pObject,KviKvsObjectFunctionCall * pCall) -{ - KviKvsExtendedRunTimeData rd(pObject); - return m_pHandler->run(pCall->window(),pCall->params(),pCall->returnValue(),KviKvsScript::PreserveParams,&rd); -} diff --git a/src/kvirc/kvs/KviKvsObjectFunctionHandlerImpl.h b/src/kvirc/kvs/KviKvsObjectFunctionHandlerImpl.h deleted file mode 100644 index fb4d824ff..000000000 --- a/src/kvirc/kvs/KviKvsObjectFunctionHandlerImpl.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef _KVI_KVS_OBJECT_FUNCTIONHANDLERIMPL_H_ -#define _KVI_KVS_OBJECT_FUNCTIONHANDLERIMPL_H_ -//============================================================================= -// -// File : KviKvsObjectFunctionHandlerImpl.h -// Creation date : Sun 24 Apr 2005 04:01:14 by Szymon Stefanek -// -// This file is part of the KVIrc IRC client distribution -// Copyright (C) 2005-2010 Szymon Stefanek -// -// 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_settings.h" -#include "KviKvsObject.h" -#include "KviKvsObjectClass.h" -#include "KviKvsObjectFunctionHandler.h" -#include "KviQString.h" - -class KviKvsObjectClass; -class KviKvsScript; -class KviKvsObjectFunctionCall; - - -class KVIRC_API KviKvsObjectCoreCallFunctionHandler : public KviKvsObjectFunctionHandler -{ - friend class KviKvsObject; - friend class KviKvsObjectClass; -protected: - KviKvsObjectCoreCallFunctionHandler(KviKvsObjectFunctionHandlerProc pProc,unsigned int uFlags = 0); - KviKvsObjectCoreCallFunctionHandler(const KviKvsObjectCoreCallFunctionHandler &h); -public: - virtual ~KviKvsObjectCoreCallFunctionHandler(); -protected: - KviKvsObjectFunctionHandlerProc m_pProc; -protected: - virtual KviKvsObjectFunctionHandler * clone(); - virtual bool call(KviKvsObject * pObject,KviKvsObjectFunctionCall * pCall); -}; - -class KVIRC_API KviKvsObjectScriptFunctionHandler : public KviKvsObjectFunctionHandler -{ - friend class KviKvsObject; - friend class KviKvsObjectClass; -protected: - KviKvsObjectScriptFunctionHandler(const QString &szScriptContext,const QString &szCode,const QString &szReminder,unsigned int uFlags = 0); - KviKvsObjectScriptFunctionHandler(const KviKvsObjectScriptFunctionHandler &h); -public: - virtual ~KviKvsObjectScriptFunctionHandler(); -protected: - KviKvsScript * m_pHandler; - QString m_szReminder; -protected: - virtual bool isScriptHandler(); - virtual QString scriptHandlerCode(); - virtual QString reminder(); - virtual void setReminder(const QString &szReminder){m_szReminder=szReminder;}; - - virtual KviKvsObjectFunctionHandler * clone(); - virtual bool call(KviKvsObject * pObject,KviKvsObjectFunctionCall * pCall); -}; - -class KVIRC_API KviKvsObjectStandardTrueReturnFunctionHandler : public KviKvsObjectFunctionHandler -{ - friend class KviKvsObject; - friend class KviKvsObjectClass; -protected: - KviKvsObjectStandardTrueReturnFunctionHandler() - : KviKvsObjectFunctionHandler() {}; -public: - virtual ~KviKvsObjectStandardTrueReturnFunctionHandler(){}; -protected: - virtual KviKvsObjectFunctionHandler * clone(); - virtual bool call(KviKvsObject * pObject,KviKvsObjectFunctionCall * pCall); -}; - -class KVIRC_API KviKvsObjectStandardFalseReturnFunctionHandler : public KviKvsObjectFunctionHandler -{ - friend class KviKvsObject; - friend class KviKvsObjectClass; -protected: - KviKvsObjectStandardFalseReturnFunctionHandler() - : KviKvsObjectFunctionHandler() {}; -public: - virtual ~KviKvsObjectStandardFalseReturnFunctionHandler(){}; -protected: - virtual KviKvsObjectFunctionHandler * clone(); - virtual bool call(KviKvsObject * pObject,KviKvsObjectFunctionCall * pCall); -}; - -class KVIRC_API KviKvsObjectStandardNothingReturnFunctionHandler : public KviKvsObjectFunctionHandler -{ - friend class KviKvsObject; - friend class KviKvsObjectClass; -protected: - KviKvsObjectStandardNothingReturnFunctionHandler() - : KviKvsObjectFunctionHandler() {}; -public: - virtual ~KviKvsObjectStandardNothingReturnFunctionHandler(){}; -protected: - virtual KviKvsObjectFunctionHandler * clone(); - virtual bool call(KviKvsObject * pObject,KviKvsObjectFunctionCall * pCall); -}; - -#endif //!_KVI_KVS_OBJECT_FUNCTIONHANDLERIMPL_H_ diff --git a/src/kvirc/kvs/KviKvsParser.cpp b/src/kvirc/kvs/KviKvsParser.cpp deleted file mode 100644 index 30a0777b5..000000000 --- a/src/kvirc/kvs/KviKvsParser.cpp +++ /dev/null @@ -1,3909 +0,0 @@ -//============================================================================= -// -// File : KviKvsParser.cpp -// Creation date : Thu 25 Sep 2003 05.12 CEST by Szymon Stefanek -// -// This file is part of the KVirc irc client distribution -// Copyright (C) 2003-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. -// -//============================================================================= - -#include "KviKvsParser.h" -#include "KviKvsTreeNode.h" -#include "KviKvsReport.h" -#include "KviKvsKernel.h" -#include "KviKvsScript.h" -#include "KviKvsParserMacros.h" -#include "KviLocale.h" -#include "KviOptions.h" - -//FIXME: @ == $$-> == $this-> - -KviKvsParser::KviKvsParser(KviKvsScript * pScript,KviWindow * pOutputWindow) -{ - // no need to initialize m_pBuffer - // no need to initialize m_ptr - // no need to initialize m_bError - m_pGlobals = 0; - m_pScript = pScript; - m_pWindow = pOutputWindow; -} - -KviKvsParser::~KviKvsParser() -{ - if(m_pGlobals)delete m_pGlobals; -} - -void KviKvsParser::init() -{ - KviKvsKernel * pKern = KviKvsKernel::instance(); - -#define _REG_CNTRL_CMD(__cntrlCmdName,__parsingRoutine) \ - { \ - KviKvsSpecialCommandParsingRoutine * r = new KviKvsSpecialCommandParsingRoutine; \ - r->proc = KVI_PTR2MEMBER(KviKvsParser::__parsingRoutine); \ - pKern->registerSpecialCommandParsingRoutine(QString(__cntrlCmdName),r); \ - } - - _REG_CNTRL_CMD("break",parseSpecialCommandBreak); - _REG_CNTRL_CMD("class",parseSpecialCommandClass); - _REG_CNTRL_CMD("continue",parseSpecialCommandContinue); - _REG_CNTRL_CMD("defpopup",parseSpecialCommandDefpopup); - _REG_CNTRL_CMD("do",parseSpecialCommandDo); - _REG_CNTRL_CMD("for",parseSpecialCommandFor); - _REG_CNTRL_CMD("foreach",parseSpecialCommandForeach); - _REG_CNTRL_CMD("global",parseSpecialCommandGlobal); - _REG_CNTRL_CMD("help",parseSpecialCommandHelp); - _REG_CNTRL_CMD("if",parseSpecialCommandIf); - _REG_CNTRL_CMD("switch",parseSpecialCommandSwitch); - _REG_CNTRL_CMD("unset",parseSpecialCommandUnset); - _REG_CNTRL_CMD("while",parseSpecialCommandWhile); -#undef _REG_CNTRL_CMD -} - -void KviKvsParser::report(bool bError,const QChar * pLocation,const QString &szMsgFmt,kvi_va_list va) -{ - QString szMsg; - KviQString::vsprintf(szMsg,szMsgFmt,va); - - KviPointerList * pCodeListing = 0; - QString szLocation; - - if(pLocation) - { - pCodeListing = new KviPointerList; - pCodeListing->setAutoDelete(true); - - int iLine,iCol; - - KviKvsReport::findLineColAndListing(m_pBuffer,pLocation,iLine,iCol,pCodeListing); - - KviQString::sprintf(szLocation,__tr2qs_ctx("line %d, near character %d","kvs"),iLine,iCol); - } else { - szLocation = __tr2qs_ctx("beginning of input","kvs"); - } - - KviKvsReport rep(bError ? KviKvsReport::ParserError : KviKvsReport::ParserWarning,m_pScript->name(),szMsg,szLocation,m_pWindow); - if(pCodeListing)rep.setCodeListing(pCodeListing); - - KviKvsReport::report(&rep,m_pWindow); -} - -void KviKvsParser::errorBadChar(const QChar * pLocation,char cExpected,const char * szCommandName) -{ - if(pLocation->unicode()) - error(pLocation,__tr2qs_ctx("Found character '%q' (unicode 0x%x) where '%c' was expected: see \"/help %s\" for the command syntax","kvs"), - pLocation,pLocation->unicode(),cExpected,szCommandName); - else - error(pLocation,__tr2qs_ctx("Found end of input where character '%c' was expected: see \"/help %s\" for the command syntax","kvs"), - cExpected,szCommandName); -} - -void KviKvsParser::error(const QChar * pLocation,const QString &szMsgFmt,...) -{ - m_bError = true; - - kvi_va_list va; - kvi_va_start_by_reference(va,szMsgFmt); - report(true,pLocation,szMsgFmt,va); - kvi_va_end(va); -} - -void KviKvsParser::warning(const QChar * pLocation,const QString &szMsgFmt,...) -{ - kvi_va_list va; - kvi_va_start_by_reference(va,szMsgFmt); - report(false,pLocation,szMsgFmt,va); - kvi_va_end(va); -} - -KviKvsTreeNodeInstruction * KviKvsParser::parse(const QChar * pBuffer,int iFlags) -{ - m_iFlags = iFlags; - - m_bError = false; - if(m_pGlobals)m_pGlobals->clear(); // this shouldn't be needed since this is a one time parser - - m_pBuffer = pBuffer; - m_ptr = pBuffer; - - if(!pBuffer) - { - error(0,__tr2qs_ctx("Empty script","kvs")); - return 0; - } - return parseInstructionList(); -} - -KviKvsTreeNodeInstruction * KviKvsParser::parseAsExpression(const QChar * pBuffer,int iFlags) -{ - m_iFlags = iFlags; - - m_bError = false; - if(m_pGlobals)m_pGlobals->clear(); // this shouldn't be needed since this is a one time parser - - m_pBuffer = pBuffer; - m_ptr = pBuffer; - - if(!pBuffer) - { - error(0,__tr2qs_ctx("Empty script","kvs")); - return 0; - } - - KviKvsTreeNodeExpression * expr = parseExpression(0); - if(!expr)return 0; - return new KviKvsTreeNodeExpressionReturn(pBuffer,expr); -} - -KviKvsTreeNodeInstruction * KviKvsParser::parseAsParameter(const QChar * pBuffer,int iFlags) -{ - m_iFlags = iFlags; - - m_bError = false; - if(m_pGlobals)m_pGlobals->clear(); // this shouldn't be needed since this is a one time parser - - m_pBuffer = pBuffer; - m_ptr = pBuffer; - - if(!pBuffer) - { - error(0,__tr2qs_ctx("Empty script","kvs")); - return 0; - } - - KviKvsTreeNodeDataList * l = parseCommandParameterList(); - if(!l)return 0; - - return new KviKvsTreeNodeParameterReturn(pBuffer,l); -} - - - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// THE REAL KVS -// -//