Skip to content

Commit 49716de

Browse files
authored
Merge pull request #719 from naussika/revert-dpp
Revert dpp to previous version
2 parents 4cefb4f + dce5793 commit 49716de

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+8358
-27951
lines changed

3rdParty/dpp/appcommand.h

Lines changed: 221 additions & 668 deletions
Large diffs are not rendered by default.

3rdParty/dpp/application.h

Lines changed: 61 additions & 422 deletions
Large diffs are not rendered by default.

3rdParty/dpp/auditlog.h

Lines changed: 145 additions & 412 deletions
Large diffs are not rendered by default.

3rdParty/dpp/automod.h

Lines changed: 100 additions & 140 deletions
Large diffs are not rendered by default.

3rdParty/dpp/ban.h

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
*
33
* D++, A Lightweight C++ library for Discord
44
*
5-
* SPDX-License-Identifier: Apache-2.0
65
* Copyright 2021 Craig Edwards and D++ contributors
76
* (https://github.com/brainboxdotcc/DPP/graphs/contributors)
87
*
@@ -23,7 +22,7 @@
2322
#pragma once
2423
#include <dpp/export.h>
2524
#include <dpp/snowflake.h>
26-
#include <dpp/json_fwd.h>
25+
#include <dpp/nlohmann/json_fwd.hpp>
2726
#include <dpp/json_interface.h>
2827
#include <unordered_map>
2928

@@ -34,36 +33,35 @@ namespace dpp {
3433
*
3534
*/
3635
class DPP_EXPORT ban : public json_interface<ban> {
37-
protected:
38-
friend struct json_interface<ban>;
39-
40-
/** Read class values from json object
41-
* @param j A json object to read from
42-
* @return A reference to self
43-
*/
44-
ban& fill_from_json_impl(nlohmann::json* j);
45-
4636
public:
47-
/**
48-
* @brief The ban reason.
49-
*/
37+
/** The ban reason */
5038
std::string reason;
51-
52-
/**
53-
* @brief User ID the ban applies to.
54-
*/
39+
/** User ID the ban applies to */
5540
snowflake user_id;
56-
41+
5742
/** Constructor */
5843
ban();
5944

6045
/** Destructor */
6146
virtual ~ban() = default;
47+
48+
/** Read class values from json object
49+
* @param j A json object to read from
50+
* @return A reference to self
51+
*/
52+
ban& fill_from_json(nlohmann::json* j);
53+
54+
/**
55+
* @brief Build json representation of a ban
56+
* @param with_id Include ID in json
57+
*
58+
* @return std::string stringified json
59+
*/
60+
std::string build_json(bool with_id = false) const;
6261
};
6362

64-
/**
65-
* @brief A group of bans. The key is the user ID.
63+
/** A group of bans
6664
*/
6765
typedef std::unordered_map<snowflake, ban> ban_map;
6866

69-
}
67+
};

3rdParty/dpp/bignum.h

Lines changed: 0 additions & 101 deletions
This file was deleted.

3rdParty/dpp/cache.h

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
*
33
* D++, A Lightweight C++ library for Discord
44
*
5-
* SPDX-License-Identifier: Apache-2.0
65
* Copyright 2021 Craig Edwards and D++ contributors
76
* (https://github.com/brainboxdotcc/DPP/graphs/contributors)
87
*
@@ -65,7 +64,7 @@ template<class T> class cache {
6564
/**
6665
* @brief Construct a new cache object.
6766
*
68-
* @note Caches must contain classes derived from dpp::managed.
67+
* Caches must contain classes derived from dpp::managed.
6968
*/
7069
cache() {
7170
cache_map = new std::unordered_map<snowflake, T*>;
@@ -109,7 +108,7 @@ template<class T> class cache {
109108
} else if (object != existing->second) {
110109
/* Flag old pointer for deletion and replace */
111110
std::lock_guard<std::mutex> delete_lock(deletion_mutex);
112-
deletion_queue[existing->second] = time(nullptr);
111+
deletion_queue[existing->second] = time(NULL);
113112
(*cache_map)[object->id] = object;
114113
}
115114
}
@@ -134,7 +133,7 @@ template<class T> class cache {
134133
auto existing = cache_map->find(object->id);
135134
if (existing != cache_map->end()) {
136135
cache_map->erase(existing);
137-
deletion_queue[object] = time(nullptr);
136+
deletion_queue[object] = time(NULL);
138137
}
139138
}
140139

@@ -250,18 +249,17 @@ template<class T> class cache {
250249
*/
251250
size_t bytes() {
252251
std::shared_lock l(cache_mutex);
253-
return sizeof(*this) + (cache_map->bucket_count() * sizeof(size_t));
252+
return sizeof(this) + (cache_map->bucket_count() * sizeof(size_t));
254253
}
255254

256255
};
257256

258-
/**
259-
* Run garbage collection across all caches removing deleted items
257+
/** Run garbage collection across all caches removing deleted items
260258
* that have been deleted over 60 seconds ago.
261259
*/
262260
void DPP_EXPORT garbage_collection();
263261

264-
#define cache_decl(type, setter, getter, counter) /** Find an object in the cache by id. @return type* Pointer to the object or nullptr when it's not found */ DPP_EXPORT class type * setter (snowflake id); DPP_EXPORT cache<class type> * getter (); /** Get the amount of cached type objects. */ DPP_EXPORT uint64_t counter ();
262+
#define cache_decl(type, setter, getter, counter) DPP_EXPORT class type * setter (snowflake id); DPP_EXPORT cache<class type> * getter (); DPP_EXPORT uint64_t counter ();
265263

266264
/* Declare major caches */
267265
cache_decl(user, find_user, get_user_cache, get_user_count);
@@ -270,5 +268,5 @@ cache_decl(role, find_role, get_role_cache, get_role_count);
270268
cache_decl(channel, find_channel, get_channel_cache, get_channel_count);
271269
cache_decl(emoji, find_emoji, get_emoji_cache, get_emoji_count);
272270

273-
}
271+
};
274272

0 commit comments

Comments
 (0)