Browse Source

Added jessilib submodule, linked to Bot

Added duration parsing to addban and addexemption
release/1.1
Jessica James 3 years ago
parent
commit
0a9b74827f
  1. 3
      .gitmodules
  2. 2
      src/Bot/src/CMakeLists.txt
  3. 3
      src/CMakeLists.txt
  4. 7
      src/Plugins/RenX/RenX.Commands/RenX_Commands.cpp
  5. 1
      src/jessilib

3
.gitmodules

@ -1,3 +1,6 @@
[submodule "Jupiter"]
path = src/Jupiter
url = https://github.com/JAJames/Jupiter.git
[submodule "src/jessilib"]
path = src/jessilib
url = https://github.com/JAJames/jessilib.git

2
src/Bot/src/CMakeLists.txt

@ -15,7 +15,7 @@ add_executable(Bot ${SOURCE_FILES})
target_include_directories(Bot PUBLIC ../include)
# Setup additionally needed libs
target_link_libraries(Bot jupiter)
target_link_libraries(Bot jupiter jessilib)
# Enable exports
set_target_properties(Bot PROPERTIES

3
src/CMakeLists.txt

@ -3,8 +3,9 @@ set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_SHARED_LIBRARY_PREFIX)
# Add jupiter and Bot
# Add primary components (Jupiter, Bot, jessilib)
add_subdirectory(Jupiter)
add_subdirectory(jessilib)
add_subdirectory(Bot)
# Setup output paths for plugins

7
src/Plugins/RenX/RenX.Commands/RenX_Commands.cpp

@ -19,6 +19,7 @@
#include <forward_list>
#include <functional>
#include "Jupiter/Functions.h"
#include "duration.hpp"
#include "IRC_Bot.h"
#include "RenX_Commands.h"
#include "RenX_Core.h"
@ -2344,7 +2345,8 @@ void AddBanIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableString &c
return;
}
duration = std::chrono::seconds(Jupiter::ReferenceString::getWord(parameters, index++, ADDBAN_WHITESPACE).asUnsignedLongLong());
const auto& duration_str = Jupiter::ReferenceString::getWord(parameters, index++, ADDBAN_WHITESPACE);
duration = jessilib::duration_from_string(duration_str.ptr(), duration_str.ptr() + duration_str.size()).duration;
}
else if (word.equalsi("Game"_jrs))
flags |= RenX::BanDatabase::Entry::FLAG_TYPE_GAME;
@ -2751,7 +2753,8 @@ void AddExemptionIRCCommand::trigger(IRC_Bot *source, const Jupiter::ReadableStr
return;
}
duration = std::chrono::seconds(Jupiter::ReferenceString::getWord(parameters, index++, ADDEXEMPTION_WHITESPACE).asUnsignedLongLong());
const auto& duration_str = Jupiter::ReferenceString::getWord(parameters, index++, ADDEXEMPTION_WHITESPACE);
duration = jessilib::duration_from_string(duration_str.ptr(), duration_str.ptr() + duration_str.size()).duration;
}
else if (word.equalsi("Ban"_jrs))
flags |= RenX::ExemptionDatabase::Entry::FLAG_TYPE_BAN;

1
src/jessilib

@ -0,0 +1 @@
Subproject commit 59d04d737ac4445ba96c9c117dcf8d95654719a3
Loading…
Cancel
Save