Browse Source

GenericCommand as IRCCommand instantiation moved to new plugin named IRC.Core

Removed old wrappers
Updated plugins as necessary
Updated Jupiter (bug fix)
pull/3/head
Jessica James 9 years ago
parent
commit
fe5417046d
  1. 4
      Bot/IRC_Bot.cpp
  2. 86
      Bot/IRC_Command.cpp
  3. 153
      Bot/IRC_Command.h
  4. 2
      CoreCommands/CoreCommands.cpp
  5. 12
      ExtraCommands/ExtraCommands.cpp
  6. 84
      IRC.Core/IRC.Core.vcxproj
  7. 35
      IRC.Core/IRC.Core.vcxproj.filters
  8. 52
      IRC.Core/IRC_Core.cpp
  9. 47
      IRC.Core/IRC_Core.h
  10. 2
      Jupiter
  11. 11
      Jupiter Bot.sln
  12. 3
      PluginManager/PluginManager.cpp
  13. BIN
      Release/Bot.lib
  14. BIN
      Release/Plugins/RenX.Core.lib
  15. 1
      RenX.Ladder/RenX_Ladder.cpp

4
Bot/IRC_Bot.cpp

@ -145,8 +145,6 @@ void IRC_Bot::setCommandAccessLevels()
command = this->getCommand(tmp_key);
if (command != nullptr)
command->setAccessLevel(tmp_sub_key, pair->getValue().asInt());
else if (this->getPrintOutput() != nullptr)
fprintf(this->getPrintOutput(), "Unable to find command \"%.*s\"" ENDL, tmp_key.size(), tmp_key.ptr());
}
}
else
@ -155,8 +153,6 @@ void IRC_Bot::setCommandAccessLevels()
command = this->getCommand(pair->getKey());
if (command != nullptr)
command->setAccessLevel(pair->getValue().asInt());
else if (this->getPrintOutput() != nullptr)
fprintf(this->getPrintOutput(), "Unable to find command \"%.*s\"" ENDL, pair->getKey().size(), pair->getKey().ptr());
}
}
}

86
Bot/IRC_Command.cpp

@ -1,5 +1,5 @@
/**
* Copyright (C) 2013-2015 Jessica James.
* Copyright (C) 2013-2016 Jessica James.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -21,6 +21,8 @@
Jupiter::ArrayList<IRCCommand> _IRCMasterCommandList;
Jupiter::ArrayList<IRCCommand> *IRCMasterCommandList = &_IRCMasterCommandList;
/** IRCCommand */
IRCCommand::IRCCommand()
{
IRCCommand::access = 0;
@ -120,4 +122,84 @@ void IRCCommand::setAccessLevel(const Jupiter::ReadableString &channel, int acce
pair->channel = channel;
pair->access = accessLevel;
IRCCommand::channels.add(pair);
}
}
void IRCCommand::create()
{
}
/** GenericCommandWrapperIRCCommand */
GenericCommandWrapperIRCCommand::GenericCommandWrapperIRCCommand(GenericCommandWrapperIRCCommand &in_command) : IRCCommand(in_command)
{
GenericCommandWrapperIRCCommand::m_command = in_command.m_command;
// Copy triggers
size_t index = 0;
while (index != GenericCommandWrapperIRCCommand::m_command->getTriggerCount())
{
this->addTrigger(GenericCommandWrapperIRCCommand::m_command->getTrigger(index));
++index;
}
}
GenericCommandWrapperIRCCommand::GenericCommandWrapperIRCCommand(Jupiter::GenericCommand &in_command) : IRCCommand()
{
GenericCommandWrapperIRCCommand::m_command = &in_command;
// Copy triggers
size_t index = 0;
while (index != GenericCommandWrapperIRCCommand::m_command->getTriggerCount())
{
this->addTrigger(GenericCommandWrapperIRCCommand::m_command->getTrigger(index));
++index;
}
if (serverManager != nullptr)
serverManager->addCommand(this);
}
// GenericCommandWrapperIRCCommand functions
void GenericCommandWrapperIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &in_channel, const Jupiter::ReadableString &in_nick, const Jupiter::ReadableString &in_parameters)
{
Jupiter::GenericCommand::ResponseLine *del;
Jupiter::GenericCommand::ResponseLine *result = GenericCommandWrapperIRCCommand::m_command->trigger(in_parameters);
while (result != nullptr)
{
switch (result->type)
{
case Jupiter::GenericCommand::DisplayType::PublicSuccess:
case Jupiter::GenericCommand::DisplayType::PublicError:
source->sendMessage(in_channel, result->response);
break;
case Jupiter::GenericCommand::DisplayType::PrivateSuccess:
case Jupiter::GenericCommand::DisplayType::PrivateError:
source->sendNotice(in_nick, result->response);
break;
default:
source->sendMessage(in_nick, result->response);
break;
}
del = result;
result = result->next;
delete del;
}
}
const Jupiter::ReadableString &GenericCommandWrapperIRCCommand::getHelp(const Jupiter::ReadableString &parameters)
{
return GenericCommandWrapperIRCCommand::m_command->getHelp(parameters);
}
IRCCommand *GenericCommandWrapperIRCCommand::copy()
{
return new GenericCommandWrapperIRCCommand(*this);
}
const Jupiter::GenericCommand &GenericCommandWrapperIRCCommand::getGenericCommand() const
{
return *GenericCommandWrapperIRCCommand::m_command;
}

153
Bot/IRC_Command.h

@ -1,5 +1,5 @@
/**
* Copyright (C) 2013-2015 Jessica James.
* Copyright (C) 2013-2016 Jessica James.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -105,6 +105,11 @@ public:
*/
void setAccessLevel(const Jupiter::ReadableString &channel, int accessLevel);
/**
* @brief Called when the command is intially created. Define triggers and access levels here.
*/
virtual void create();
/**
* @brief Called when the command is to be executed.
*
@ -115,11 +120,6 @@ public:
*/
virtual void trigger(IRC_Bot *source, const Jupiter::ReadableString &channel, const Jupiter::ReadableString &nick, const Jupiter::ReadableString &parameters) = 0;
/**
* @brief Called when the command is intially created. Define triggers and access levels here.
*/
virtual void create() = 0;
/**
* @brief Creates a copy of a command.
* Note: This is primarily for internal usage.
@ -169,6 +169,55 @@ private:
Jupiter::ArrayList<IRCCommand::ChannelAccessPair> channels; /** Access levels for specific channels */
};
class JUPITER_BOT_API GenericCommandWrapperIRCCommand : public IRCCommand
{
public:
/**
* @brief Triggers the underlying GenericCommand and outputs the result
*
* @param in_server IRC server to deliver result to
* @param in_channel Name of the channel to deliver result to (if result is not 'Private' type)
* @param in_nick Name of the user to deliver result to (if result is 'Private' type)
* @param in_parameters Parameters to pass to the GenericCommand's trigger()
*/
void trigger(IRC_Bot *in_server, const Jupiter::ReadableString &in_channel, const Jupiter::ReadableString &in_nick, const Jupiter::ReadableString &in_parameters) override;
/**
* @brief Forwards the help message from the underlying GenericCommand
*
* @param in_parameters Parameters to forward to the GenericCommand's getHelp()
* @return Help string from the GenericCommand
*/
const Jupiter::ReadableString &getHelp(const Jupiter::ReadableString &in_parameters) override;
/**
* @brief Copies the GenericCommandWrapperIRCCommand
*
* @return Copy of the GenericCommandWrapperIRCCommand
*/
IRCCommand *copy() override;
/**
* @brief Fetches the underlying GenericCommand
*
* @return GenericCommand this wrapper interfaces with
*/
const Jupiter::GenericCommand &getGenericCommand() const;
/**
* @brief Copy constructor for the GenericCommandWrapperIRCCommand class
*/
GenericCommandWrapperIRCCommand(GenericCommandWrapperIRCCommand &in_command);
/**
* @brief Wrapper constructor for the GenericCommandWrapperIRCCommand class
*/
GenericCommandWrapperIRCCommand(Jupiter::GenericCommand &in_command);
private:
Jupiter::GenericCommand *m_command;
};
/** IRC Command Macros */
/** Defines the core of an IRC command's declaration. This should be included in every IRC command. */
@ -191,98 +240,6 @@ class CLASS : public IRCCommand { \
CLASS CLASS ## _instance; \
IRCCommand *CLASS::copy() { return new CLASS(*this); }
/** GenericCommand to IRCCommand conversion */
/** Generates an IRC command from a generic command. */
template<typename T> class Generic_Command_As_IRC_Command : public IRCCommand
{
public:
virtual void trigger(IRC_Bot *source, const Jupiter::ReadableString &channel, const Jupiter::ReadableString &nick, const Jupiter::ReadableString &parameters) override;
virtual const Jupiter::ReadableString &getHelp(const Jupiter::ReadableString &parameters) override;
void copyTriggers();
Generic_Command_As_IRC_Command();
Generic_Command_As_IRC_Command(const Generic_Command_As_IRC_Command<T> &cmd);
};
template<typename T> Generic_Command_As_IRC_Command<T>::Generic_Command_As_IRC_Command() : IRCCommand()
{
Generic_Command_As_IRC_Command<T>::copyTriggers();
}
template<typename T> Generic_Command_As_IRC_Command<T>::Generic_Command_As_IRC_Command(const Generic_Command_As_IRC_Command<T> &cmd) : IRCCommand(cmd)
{
Generic_Command_As_IRC_Command<T>::copyTriggers();
}
template<typename T> void Generic_Command_As_IRC_Command<T>::trigger(IRC_Bot *source, const Jupiter::ReadableString &channel, const Jupiter::ReadableString &nick, const Jupiter::ReadableString &parameters)
{
Jupiter::GenericCommand::ResponseLine *del;
Jupiter::GenericCommand::ResponseLine *ret = T::instance.trigger(parameters);
while (ret != nullptr)
{
switch (ret->type)
{
case Jupiter::GenericCommand::DisplayType::PublicSuccess:
case Jupiter::GenericCommand::DisplayType::PublicError:
source->sendMessage(channel, ret->response);
break;
case Jupiter::GenericCommand::DisplayType::PrivateSuccess:
case Jupiter::GenericCommand::DisplayType::PrivateError:
source->sendNotice(nick, ret->response);
break;
default:
source->sendMessage(nick, ret->response);
break;
}
del = ret;
ret = ret->next;
delete del;
}
}
template<typename T> const Jupiter::ReadableString &Generic_Command_As_IRC_Command<T>::getHelp(const Jupiter::ReadableString &parameters)
{
return T::instance.getHelp(parameters);
}
template<typename T> void Generic_Command_As_IRC_Command<T>::copyTriggers()
{
size_t index = 0;
while (index != T::instance.getTriggerCount())
this->addTrigger(T::instance.getTrigger(index++));
}
/** Defines the core of an IRC command's declaration. This should be included in every Generic to IRC command conversion. */
#define GENERIC_COMMAND_AS_IRC_COMMAND_2_BASE(CLASS, NEW_CLASS) \
public: \
void create(); \
IRCCommand *copy() override; \
NEW_CLASS() : Generic_Command_As_IRC_Command< CLASS >() { \
this->create(); \
if (serverManager != nullptr) serverManager->addCommand(this); } \
NEW_CLASS(const NEW_CLASS &cmd) : Generic_Command_As_IRC_Command< CLASS >(cmd) { this->create(); }
/** Generates an IRC command from a generic command. */
#define GENERIC_COMMAND_AS_IRC_COMMAND_2(CLASS, NEW_CLASS) \
class NEW_CLASS : public Generic_Command_As_IRC_Command< CLASS > { \
GENERIC_COMMAND_AS_IRC_COMMAND_2_BASE(CLASS, NEW_CLASS) }; \
IRC_COMMAND_INIT(NEW_CLASS)
/** Generates an IRC command from a generic command. */
#define GENERIC_COMMAND_AS_IRC_COMMAND(CLASS) \
GENERIC_COMMAND_AS_IRC_COMMAND_2(CLASS, CLASS ## _AS_IRC_COMMAND);
/** Generates an IRC command from a generic command, and defines a default create() function. */
#define GENERIC_COMMAND_AS_IRC_COMMAND_NO_CREATE(CLASS) \
GENERIC_COMMAND_AS_IRC_COMMAND(CLASS) \
void CLASS ## _AS_IRC_COMMAND::create() {}
/** Generates an IRC command from a generic command, and defines an access-setting create() function. */
#define GENERIC_COMMAND_AS_IRC_COMMAND_ACCESS_CREATE(CLASS, ACCESS_LEVEL) \
GENERIC_COMMAND_AS_IRC_COMMAND(CLASS) \
void CLASS ## _AS_IRC_COMMAND::create() { this->setAccessLevel(ACCESS_LEVEL); }
/** Re-enable warnings */
#if defined _MSC_VER
#pragma warning(pop)

2
CoreCommands/CoreCommands.cpp

@ -146,7 +146,6 @@ const Jupiter::ReadableString &VersionGenericCommand::getHelp(const Jupiter::Rea
GENERIC_COMMAND_INIT(VersionGenericCommand)
GENERIC_COMMAND_AS_CONSOLE_COMMAND(VersionGenericCommand)
GENERIC_COMMAND_AS_IRC_COMMAND_NO_CREATE(VersionGenericCommand)
// Rehash Command
@ -173,7 +172,6 @@ const Jupiter::ReadableString &RehashGenericCommand::getHelp(const Jupiter::Read
GENERIC_COMMAND_INIT(RehashGenericCommand)
GENERIC_COMMAND_AS_CONSOLE_COMMAND(RehashGenericCommand)
GENERIC_COMMAND_AS_IRC_COMMAND_ACCESS_CREATE(RehashGenericCommand, 4)
// Plugin instantiation and entry point.
CoreCommandsPlugin pluginInstance;

12
ExtraCommands/ExtraCommands.cpp

@ -1,5 +1,5 @@
/**
* Copyright (C) 2014-2015 Jessica James.
* Copyright (C) 2014-2016 Jessica James.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -59,7 +59,6 @@ const Jupiter::ReadableString &SelectGenericCommand::getHelp(const Jupiter::Read
GENERIC_COMMAND_INIT(SelectGenericCommand)
GENERIC_COMMAND_AS_CONSOLE_COMMAND(SelectGenericCommand)
GENERIC_COMMAND_AS_IRC_COMMAND_ACCESS_CREATE(SelectGenericCommand, 4)
// Deselect Command
@ -92,7 +91,6 @@ const Jupiter::ReadableString &DeselectGenericCommand::getHelp(const Jupiter::Re
GENERIC_COMMAND_INIT(DeselectGenericCommand)
GENERIC_COMMAND_AS_CONSOLE_COMMAND(DeselectGenericCommand)
GENERIC_COMMAND_AS_IRC_COMMAND_ACCESS_CREATE(DeselectGenericCommand, 4)
// Raw Command
@ -127,7 +125,6 @@ const Jupiter::ReadableString &RawGenericCommand::getHelp(const Jupiter::Readabl
GENERIC_COMMAND_INIT(RawGenericCommand)
GENERIC_COMMAND_AS_CONSOLE_COMMAND(RawGenericCommand)
GENERIC_COMMAND_AS_IRC_COMMAND_ACCESS_CREATE(RawGenericCommand, 5)
// Message Command
@ -163,7 +160,6 @@ const Jupiter::ReadableString &IRCMessageGenericCommand::getHelp(const Jupiter::
GENERIC_COMMAND_INIT(IRCMessageGenericCommand)
GENERIC_COMMAND_AS_CONSOLE_COMMAND(IRCMessageGenericCommand)
GENERIC_COMMAND_AS_IRC_COMMAND_ACCESS_CREATE(IRCMessageGenericCommand, 5)
// Join Command
@ -201,7 +197,6 @@ const Jupiter::ReadableString &JoinGenericCommand::getHelp(const Jupiter::Readab
GENERIC_COMMAND_INIT(JoinGenericCommand)
GENERIC_COMMAND_AS_CONSOLE_COMMAND(JoinGenericCommand)
GENERIC_COMMAND_AS_IRC_COMMAND_ACCESS_CREATE(JoinGenericCommand, 3)
// Part Command
@ -239,7 +234,6 @@ const Jupiter::ReadableString &PartGenericCommand::getHelp(const Jupiter::Readab
GENERIC_COMMAND_INIT(PartGenericCommand)
GENERIC_COMMAND_AS_CONSOLE_COMMAND(PartGenericCommand)
GENERIC_COMMAND_AS_IRC_COMMAND_ACCESS_CREATE(PartGenericCommand, 3)
// DebugInfo Command
@ -291,7 +285,6 @@ const Jupiter::ReadableString &DebugInfoGenericCommand::getHelp(const Jupiter::R
GENERIC_COMMAND_INIT(DebugInfoGenericCommand)
GENERIC_COMMAND_AS_CONSOLE_COMMAND(DebugInfoGenericCommand)
GENERIC_COMMAND_AS_IRC_COMMAND_ACCESS_CREATE(DebugInfoGenericCommand, 4)
// Exit command
@ -313,7 +306,6 @@ const Jupiter::ReadableString &ExitGenericCommand::getHelp(const Jupiter::Readab
GENERIC_COMMAND_INIT(ExitGenericCommand)
GENERIC_COMMAND_AS_CONSOLE_COMMAND(ExitGenericCommand)
GENERIC_COMMAND_AS_IRC_COMMAND_ACCESS_CREATE(ExitGenericCommand, 5)
// IRC Connect command
@ -357,7 +349,6 @@ const Jupiter::ReadableString &IRCConnectGenericCommand::getHelp(const Jupiter::
GENERIC_COMMAND_INIT(IRCConnectGenericCommand)
GENERIC_COMMAND_AS_CONSOLE_COMMAND(IRCConnectGenericCommand)
GENERIC_COMMAND_AS_IRC_COMMAND_ACCESS_CREATE(IRCConnectGenericCommand, 5)
// IRC Disconnect command
@ -388,7 +379,6 @@ const Jupiter::ReadableString &IRCDisconnectGenericCommand::getHelp(const Jupite
GENERIC_COMMAND_INIT(IRCDisconnectGenericCommand)
GENERIC_COMMAND_AS_CONSOLE_COMMAND(IRCDisconnectGenericCommand)
GENERIC_COMMAND_AS_IRC_COMMAND_ACCESS_CREATE(IRCDisconnectGenericCommand, 5)
// Plugin instantiation and entry point.
FunCommandsPlugin pluginInstance;

84
IRC.Core/IRC.Core.vcxproj

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{89368D08-5E06-4530-B82A-AD2BC07B09E7}</ProjectGuid>
<RootNamespace>IRC.Core</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration)\Plugins\</OutDir>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>../Bot;../Jupiter</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="IRC_Core.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="IRC_Core.cpp" />
</ItemGroup>
<ItemGroup>
<Library Include="..\Jupiter\Release\Jupiter.lib" />
<Library Include="..\Release\Bot.lib" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

35
IRC.Core/IRC.Core.vcxproj.filters

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="IRC_Core.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="IRC_Core.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Library Include="..\Release\Bot.lib">
<Filter>Resource Files</Filter>
</Library>
<Library Include="..\Jupiter\Release\Jupiter.lib">
<Filter>Resource Files</Filter>
</Library>
</ItemGroup>
</Project>

52
IRC.Core/IRC_Core.cpp

@ -0,0 +1,52 @@
/**
* Copyright (C) 2016 Jessica James.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Written by Jessica James <jessica.aj@outlook.com>
*/
#include "Jupiter/GenericCommand.h"
#include "ServerManager.h"
#include "IRC_Command.h"
#include "IRC_Core.h"
IRCCorePlugin::~IRCCorePlugin()
{
IRCCorePlugin::m_wrapped_commands.emptyAndDelete();
}
void IRCCorePlugin::OnGenericCommandAdd(Jupiter::GenericCommand &in_command)
{
IRCCorePlugin::m_wrapped_commands.add(new GenericCommandWrapperIRCCommand(in_command));
}
void IRCCorePlugin::OnGenericCommandRemove(Jupiter::GenericCommand &in_command)
{
for (size_t index = 0; index != IRCCorePlugin::m_wrapped_commands.size(); ++index)
if (&IRCCorePlugin::m_wrapped_commands.get(index)->getGenericCommand() == &in_command)
{
delete IRCCorePlugin::m_wrapped_commands.remove(index);
return;
}
}
// Plugin instantiation and entry point.
IRCCorePlugin pluginInstance;
extern "C" __declspec(dllexport) Jupiter::Plugin *getPlugin()
{
return &pluginInstance;
}

47
IRC.Core/IRC_Core.h

@ -0,0 +1,47 @@
/**
* Copyright (C) 2016 Jessica James.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Written by Jessica James <jessica.aj@outlook.com>
*/
#if !defined _IRC_CORE_H_HEADER
#define _IRC_CORE_H_HEADER
#include "Jupiter/Plugin.h"
#include "Jupiter/Reference_String.h"
class IRCCorePlugin : public Jupiter::Plugin
{
public:
/**
* @brief This is called when a GenericCommand is instantiated.
*/
virtual void OnGenericCommandAdd(Jupiter::GenericCommand &command);
/**
* @brief This is called when a GenericCommand is deleted.
*/
virtual void OnGenericCommandRemove(Jupiter::GenericCommand &command);
/**
* @brief Destructor for the IRCCorPlugin class
*/
~IRCCorePlugin();
private:
Jupiter::ArrayList<GenericCommandWrapperIRCCommand> m_wrapped_commands;
};
#endif // _IRC_CORE_H_HEADER

2
Jupiter

@ -1 +1 @@
Subproject commit 5a34f8989d4f9bdd3fb44efeb8b8bc90a5dd02b2
Subproject commit 5966674d67b66f380b73ba3028d6176c0d3af2cb

11
Jupiter Bot.sln

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Bot", "Bot\Bot.vcxproj", "{C188871B-5F32-4946-B301-24CA2EBB275D}"
EndProject
@ -212,6 +212,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RenX.ServerList", "RenX.Ser
{BB048D6F-F001-4E9B-95F4-886081E0807A} = {BB048D6F-F001-4E9B-95F4-886081E0807A}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IRC.Core", "IRC.Core\IRC.Core.vcxproj", "{89368D08-5E06-4530-B82A-AD2BC07B09E7}"
ProjectSection(ProjectDependencies) = postProject
{C188871B-5F32-4946-B301-24CA2EBB275D} = {C188871B-5F32-4946-B301-24CA2EBB275D}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -362,6 +367,10 @@ Global
{6B0D59BA-B153-4DE8-8DD4-FBE5D810B033}.Debug|Win32.Build.0 = Debug|Win32
{6B0D59BA-B153-4DE8-8DD4-FBE5D810B033}.Release|Win32.ActiveCfg = Release|Win32
{6B0D59BA-B153-4DE8-8DD4-FBE5D810B033}.Release|Win32.Build.0 = Release|Win32
{89368D08-5E06-4530-B82A-AD2BC07B09E7}.Debug|Win32.ActiveCfg = Debug|Win32
{89368D08-5E06-4530-B82A-AD2BC07B09E7}.Debug|Win32.Build.0 = Debug|Win32
{89368D08-5E06-4530-B82A-AD2BC07B09E7}.Release|Win32.ActiveCfg = Release|Win32
{89368D08-5E06-4530-B82A-AD2BC07B09E7}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

3
PluginManager/PluginManager.cpp

@ -1,5 +1,5 @@
/**
* Copyright (C) 2014-2015 Jessica James.
* Copyright (C) 2014-2016 Jessica James.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -83,7 +83,6 @@ const Jupiter::ReadableString &PluginGenericCommand::getHelp(const Jupiter::Read
GENERIC_COMMAND_INIT(PluginGenericCommand)
GENERIC_COMMAND_AS_CONSOLE_COMMAND(PluginGenericCommand)
GENERIC_COMMAND_AS_IRC_COMMAND_ACCESS_CREATE(PluginGenericCommand, 5)
// Plugin instantiation and entry point.
PluginManager pluginInstance;

BIN
Release/Bot.lib

Binary file not shown.

BIN
Release/Plugins/RenX.Core.lib

Binary file not shown.

1
RenX.Ladder/RenX_Ladder.cpp

@ -137,7 +137,6 @@ const Jupiter::ReadableString &LadderGenericCommand::getHelp(const Jupiter::Read
GENERIC_COMMAND_INIT(LadderGenericCommand)
GENERIC_COMMAND_AS_CONSOLE_COMMAND(LadderGenericCommand)
GENERIC_COMMAND_AS_IRC_COMMAND_NO_CREATE(LadderGenericCommand)
// Ladder Game Command

Loading…
Cancel
Save