From f6c504534a52b5537b847cdd0fa19b6c72163bf0 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 10 Jan 2024 20:15:05 +0100 Subject: [PATCH] Set up a new smtp module. It will be based on https://github.com/Relintai/gdMail . --- modules/smtp/COPYRIGHT.txt | 44 +++++++++++++++++++++++ modules/smtp/LICENSE | 22 ++++++++++++ modules/smtp/SCsub | 25 +++++++++++++ modules/smtp/config.py | 22 ++++++++++++ modules/smtp/doc_classes/EMail.xml | 13 +++++++ modules/smtp/doc_classes/SMTPClient.xml | 13 +++++++ modules/smtp/email.cpp | 42 ++++++++++++++++++++++ modules/smtp/email.h | 47 +++++++++++++++++++++++++ modules/smtp/register_types.cpp | 44 +++++++++++++++++++++++ modules/smtp/register_types.h | 39 ++++++++++++++++++++ modules/smtp/smtp_client.cpp | 43 ++++++++++++++++++++++ modules/smtp/smtp_client.h | 47 +++++++++++++++++++++++++ 12 files changed, 401 insertions(+) create mode 100644 modules/smtp/COPYRIGHT.txt create mode 100644 modules/smtp/LICENSE create mode 100644 modules/smtp/SCsub create mode 100644 modules/smtp/config.py create mode 100644 modules/smtp/doc_classes/EMail.xml create mode 100644 modules/smtp/doc_classes/SMTPClient.xml create mode 100644 modules/smtp/email.cpp create mode 100644 modules/smtp/email.h create mode 100644 modules/smtp/register_types.cpp create mode 100644 modules/smtp/register_types.h create mode 100644 modules/smtp/smtp_client.cpp create mode 100644 modules/smtp/smtp_client.h diff --git a/modules/smtp/COPYRIGHT.txt b/modules/smtp/COPYRIGHT.txt new file mode 100644 index 000000000..2c0a6f4dc --- /dev/null +++ b/modules/smtp/COPYRIGHT.txt @@ -0,0 +1,44 @@ +# Exhaustive licensing information for files in the Godot Engine repository +# ========================================================================= +# +# This file aims at documenting the copyright and license for every source +# file in the Godot Engine repository, and especially outline the files +# whose license differs from the MIT/Expat license used by Godot Engine. +# +# It is written as a machine-readable format following the debian/copyright +# specification. Globbing patterns (e.g. "Files: *") mean that they affect +# all corresponding files (also recursively in subfolders), apart from those +# with a more explicit copyright statement. +# +# Licenses are given with their debian/copyright short name (or SPDX identifier +# if no standard short name exists) and are all included in plain text at the +# end of this file (in alphabetical order). +# +# Disclaimer for thirdparty libraries: +# ------------------------------------ +# +# Licensing details for thirdparty libraries in the 'thirdparty/' directory +# are given in summarized form, i.e. with only the "main" license described +# in the library's license statement. Different licenses of single files or +# code snippets in thirdparty libraries are not documented here. +# For example: +# Files: ./thirdparty/zlib/ +# Copyright: 1995-2017, Jean-loup Gailly and Mark Adler +# License: Zlib +# The exact copyright for each file in that library *may* differ, and some +# files or code snippets might be distributed under other compatible licenses +# (e.g. a public domain dedication), but as far as Godot Engine is concerned +# the library is considered as a whole under the Zlib license. +# +# Nota: When linking dynamically against thirdparty libraries instead of +# building them into the Godot binary, you may remove the corresponding +# license details from this file. + +----------------------------------------------------------------------- + +Files: modules/smtp/* +Comment: SMTP Module +Copyright: Copyright (c) 2024-present Péter Magyar + Copyright (c) 2021-2024 Nicolò Santilio +License: Expat + diff --git a/modules/smtp/LICENSE b/modules/smtp/LICENSE new file mode 100644 index 000000000..01b0e7e98 --- /dev/null +++ b/modules/smtp/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2024-present Péter Magyar +Copyright (c) 2021-2024 Nicolò Santilio + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/modules/smtp/SCsub b/modules/smtp/SCsub new file mode 100644 index 000000000..720f0f26e --- /dev/null +++ b/modules/smtp/SCsub @@ -0,0 +1,25 @@ +import os + +Import('env') + +module_env = env.Clone() + +sources = [ + "register_types.cpp", + + "email.cpp", + "smtp_client.cpp", +] + +if ARGUMENTS.get('custom_modules_shared', 'no') == 'yes': + # Shared lib compilation + module_env.Append(CCFLAGS=['-fPIC']) + module_env['LIBS'] = [] + shared_lib = module_env.SharedLibrary(target='#bin/smtp', source=sources) + shared_lib_shim = shared_lib[0].name.rsplit('.', 1)[0] + env.Append(LIBS=[shared_lib_shim]) + env.Append(LIBPATH=['#bin']) +else: + # Static compilation + module_env.add_source_files(env.modules_sources, sources) + diff --git a/modules/smtp/config.py b/modules/smtp/config.py new file mode 100644 index 000000000..a60e8e5ac --- /dev/null +++ b/modules/smtp/config.py @@ -0,0 +1,22 @@ + + +def can_build(env, platform): + return True + #return False + +def configure(env): + pass + + +def get_doc_classes(): + return [ + "EMail", + "SMTPClient", + ] + +def get_doc_path(): + return "doc_classes" + +def get_license_file(): + return "COPYRIGHT.txt" + diff --git a/modules/smtp/doc_classes/EMail.xml b/modules/smtp/doc_classes/EMail.xml new file mode 100644 index 000000000..5cb769e45 --- /dev/null +++ b/modules/smtp/doc_classes/EMail.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/modules/smtp/doc_classes/SMTPClient.xml b/modules/smtp/doc_classes/SMTPClient.xml new file mode 100644 index 000000000..345b503d3 --- /dev/null +++ b/modules/smtp/doc_classes/SMTPClient.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/modules/smtp/email.cpp b/modules/smtp/email.cpp new file mode 100644 index 000000000..33d75b812 --- /dev/null +++ b/modules/smtp/email.cpp @@ -0,0 +1,42 @@ +/*************************************************************************/ +/* email.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* PANDEMONIUM ENGINE'S SMTP MODULE */ +/* https://github.com/Relintai/pandemonium_engine */ +/*************************************************************************/ +/* Copyright (c) 2022-present Péter Magyar. */ +/* Copyright (c) 2021-2024 Nicolò Santilio */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "email.h" + +EMail::EMail() { +} +EMail::~EMail() { +} + +void EMail::_bind_methods() { + //ClassDB::bind_method(D_METHOD("get_ignored_urls"), &EMail::get_ignored_urls); + //ClassDB::bind_method(D_METHOD("set_ignored_urls", "val"), &EMail::set_ignored_urls); + //ADD_PROPERTY(PropertyInfo(Variant::POOL_STRING_ARRAY, "ignored_urls"), "set_ignored_urls", "get_ignored_urls"); +} diff --git a/modules/smtp/email.h b/modules/smtp/email.h new file mode 100644 index 000000000..c45dbf349 --- /dev/null +++ b/modules/smtp/email.h @@ -0,0 +1,47 @@ +#ifndef EMAIL_H +#define EMAIL_H + +/*************************************************************************/ +/* email.h */ +/*************************************************************************/ +/* This file is part of: */ +/* PANDEMONIUM ENGINE'S SMTP MODULE */ +/* https://github.com/Relintai/pandemonium_engine */ +/*************************************************************************/ +/* Copyright (c) 2022-present Péter Magyar. */ +/* Copyright (c) 2021-2024 Nicolò Santilio */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "core/object/reference.h" + +class EMail : public Reference { + GDCLASS(EMail, Reference); + +public: + EMail(); + ~EMail(); + +protected: + static void _bind_methods(); +}; + +#endif diff --git a/modules/smtp/register_types.cpp b/modules/smtp/register_types.cpp new file mode 100644 index 000000000..15ab89046 --- /dev/null +++ b/modules/smtp/register_types.cpp @@ -0,0 +1,44 @@ +/*************************************************************************/ +/* register_types.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* PANDEMONIUM ENGINE'S SMTP MODULE */ +/* https://github.com/Relintai/pandemonium_engine */ +/*************************************************************************/ +/* Copyright (c) 2022-present Péter Magyar. */ +/* Copyright (c) 2021-2024 Nicolò Santilio */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "register_types.h" + +#include "email.h" +#include "smtp_client.h" + +void register_smtp_types(ModuleRegistrationLevel p_level) { + if (p_level == MODULE_REGISTRATION_LEVEL_SCENE) { + ClassDB::register_class(); + ClassDB::register_class(); + } +} + +void unregister_smtp_types(ModuleRegistrationLevel p_level) { +} diff --git a/modules/smtp/register_types.h b/modules/smtp/register_types.h new file mode 100644 index 000000000..4fe864cb2 --- /dev/null +++ b/modules/smtp/register_types.h @@ -0,0 +1,39 @@ +#ifndef SMTP_REGISTER_TYPES_H +#define SMTP_REGISTER_TYPES_H + +/*************************************************************************/ +/* register_types.h */ +/*************************************************************************/ +/* This file is part of: */ +/* PANDEMONIUM ENGINE'S SMTP MODULE */ +/* https://github.com/Relintai/pandemonium_engine */ +/*************************************************************************/ +/* Copyright (c) 2022-present Péter Magyar. */ +/* Copyright (c) 2021-2024 Nicolò Santilio */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "modules/register_module_types.h" + +void register_smtp_types(ModuleRegistrationLevel p_level); +void unregister_smtp_types(ModuleRegistrationLevel p_level); + +#endif diff --git a/modules/smtp/smtp_client.cpp b/modules/smtp/smtp_client.cpp new file mode 100644 index 000000000..693493225 --- /dev/null +++ b/modules/smtp/smtp_client.cpp @@ -0,0 +1,43 @@ +/*************************************************************************/ +/* smtp_client.cpp */ +/*************************************************************************/ +/* This file is part of: */ +/* PANDEMONIUM ENGINE'S SMTP MODULE */ +/* https://github.com/Relintai/pandemonium_engine */ +/*************************************************************************/ +/* Copyright (c) 2022-present Péter Magyar. */ +/* Copyright (c) 2021-2024 Nicolò Santilio */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "smtp_client.h" + + +SMTPClient::SMTPClient() { +} +SMTPClient::~SMTPClient() { +} + +void SMTPClient::_bind_methods() { + //ClassDB::bind_method(D_METHOD("get_ignored_urls"), &SMTPClient::get_ignored_urls); + //ClassDB::bind_method(D_METHOD("set_ignored_urls", "val"), &SMTPClient::set_ignored_urls); + //ADD_PROPERTY(PropertyInfo(Variant::POOL_STRING_ARRAY, "ignored_urls"), "set_ignored_urls", "get_ignored_urls"); +} diff --git a/modules/smtp/smtp_client.h b/modules/smtp/smtp_client.h new file mode 100644 index 000000000..a2913b95a --- /dev/null +++ b/modules/smtp/smtp_client.h @@ -0,0 +1,47 @@ +#ifndef SMTP_CLIENT_H +#define SMTP_CLIENT_H + +/*************************************************************************/ +/* smtp_client.h */ +/*************************************************************************/ +/* This file is part of: */ +/* PANDEMONIUM ENGINE'S SMTP MODULE */ +/* https://github.com/Relintai/pandemonium_engine */ +/*************************************************************************/ +/* Copyright (c) 2022-present Péter Magyar. */ +/* Copyright (c) 2021-2024 Nicolò Santilio */ +/* */ +/* Permission is hereby granted, free of charge, to any person obtaining */ +/* a copy of this software and associated documentation files (the */ +/* "Software"), to deal in the Software without restriction, including */ +/* without limitation the rights to use, copy, modify, merge, publish, */ +/* distribute, sublicense, and/or sell copies of the Software, and to */ +/* permit persons to whom the Software is furnished to do so, subject to */ +/* the following conditions: */ +/* */ +/* The above copyright notice and this permission notice shall be */ +/* included in all copies or substantial portions of the Software. */ +/* */ +/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ +/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ +/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/ +/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ +/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ +/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ +/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/*************************************************************************/ + +#include "scene/main/node.h" + +class SMTPClient : public Node { + GDCLASS(SMTPClient, Node); + +public: + SMTPClient(); + ~SMTPClient(); + +protected: + static void _bind_methods(); +}; + +#endif