Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Added current user subscription functions, and renamed GetUserModRati…
Browse files Browse the repository at this point in the history
…ng to GetCurrentUserModRating
  • Loading branch information
Turupawn committed Oct 3, 2019
1 parent c84ee65 commit a14c25a
Show file tree
Hide file tree
Showing 25 changed files with 5,060 additions and 22 deletions.
Binary file not shown.
3 changes: 2 additions & 1 deletion Source/ThirdParty/mod.io-sdk-v0.11.3-DEV/include/Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace modio
extern bool RETRIEVE_MODS_FROM_OTHER_GAMES;
extern std::string MODIO_URL;
extern std::string MODIO_VERSION_PATH;
extern u32 MAX_CACHE_TIME;
extern u32 MAX_CACHE_TIME_SECONDS;
extern u32 LAST_MOD_EVENT_POLL_ID;
extern u32 LAST_MOD_EVENT_POLL_TIME;
extern u32 MOD_EVENT_POLL_INTERVAL;
Expand All @@ -31,6 +31,7 @@ namespace modio
extern ModioUser current_user;
extern std::vector<u32> downloaded_mods;
extern std::map<u32,u32> current_user_ratings; // maps[mod_id, rating_type]
extern std::set<u32> current_user_subscriptions; // set[mod_id]
extern void (*event_listener_callback)(ModioResponse response, ModioModEvent* events_array, u32 events_array_size);
extern void (*download_callback)(u32 response_code, u32 mod_id);
extern void (*upload_callback)(u32 response_code, u32 mod_id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ namespace modio
{
void onUpdateCurrentUser(void *object, ModioResponse response, ModioUser user);
void onUpdateCurrentUserRatings(void* object, ModioResponse response, ModioRating ratings[], u32 ratings_size);
void onUpdateCurrentUserSubscriptions(void* object, ModioResponse response, ModioMod mods[], u32 mods_size);
void addModsToDownloadQueue(std::vector<u32> mod_ids);
void pollEvents();
void updateAuthenticatedUser(std::string access_token);
void updateUserRatings();
void updateUserSubscriptions();
void addGameIdFilter(ModioFilterCreator &filter);

// Error handling
Expand Down
2 changes: 1 addition & 1 deletion Source/ThirdParty/mod.io-sdk-v0.11.3-DEV/include/Utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void writeLogLine(const std::string &text, u32 debug_level);
void clearLog();

// Time methods
u32 getCurrentTime();
u32 getCurrentTimeSeconds();
double getCurrentTimeMillis();

// Json methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,13 @@ class MODIO_DLL Instance

//Ratings Methods
void addModRating(u32 mod_id, bool vote_up, const std::function<void(const modio::Response &response)> &callback);
u32 getUserModRating(u32 mod_id);
u32 getCurrentUserModRating(u32 mod_id);

//Subscription Methods
void subscribeToMod(u32 mod_id, const std::function<void(const modio::Response &response, const modio::Mod &mod)> &callback);
void unsubscribeFromMod(u32 mod_id, const std::function<void(const modio::Response &response)> &callback);
bool isCurrentUserSubscribed(u32 mod_id);
const std::vector<u32> getCurrentUserSubscriptions();

//Me Methods
void getAuthenticatedUser(const std::function<void(const modio::Response &response, const modio::User &user)> &callback);
Expand Down
5 changes: 4 additions & 1 deletion Source/ThirdParty/mod.io-sdk-v0.11.3-DEV/include/c/ModioC.h
Original file line number Diff line number Diff line change
Expand Up @@ -565,11 +565,14 @@ extern "C"

//Ratings Methods
void MODIO_DLL modioAddModRating(void* object, u32 mod_id, bool vote_up, void (*callback)(void* object, ModioResponse response));
u32 MODIO_DLL modioGetUserModRating(u32 mod_id);
u32 MODIO_DLL modioGetCurrentUserModRating(u32 mod_id);

//Subscription Methods
void MODIO_DLL modioSubscribeToMod(void* object, u32 mod_id, void (*callback)(void* object, ModioResponse response, ModioMod mod));
void MODIO_DLL modioUnsubscribeFromMod(void* object, u32 mod_id, void (*callback)(void* object, ModioResponse response));
bool MODIO_DLL modioIsCurrentUserSubscribed(u32 mod_id);
u32 MODIO_DLL modioGetCurrentUserSubscriptionsCount();
void MODIO_DLL modioGetCurrentUserSubscriptions(u32 *mod_id_array);

//Tags Methods
void MODIO_DLL modioGetModTags(void* object, u32 mod_id, void (*callback)(void* object, ModioResponse response, ModioTag* tags_array, u32 tags_array_size));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,19 @@
struct SubscribeToModParams
{
void* object;
u32 mod_id;
void (*callback)(void* object, ModioResponse response, ModioMod mod);
};

struct UnsubscribeFromModParams
{
void* object;
u32 mod_id;
void (*callback)(void* object, ModioResponse response);
};

extern std::map< u32, SubscribeToModParams* > subscribe_to_mod_callbacks;
extern std::map< u32, GenericRequestParams* > unsubscribe_from_mod_callbacks;
extern std::map< u32, UnsubscribeFromModParams* > unsubscribe_from_mod_callbacks;

void modioOnSubscribeToMod(u32 call_number, u32 response_code, nlohmann::json response_json);
void modioOnUnsubscribeFromMod(u32 call_number, u32 response_code, nlohmann::json response_json);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
curlver.h.dist
stamp-h2
stamp-h3
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://curl.haxx.se/docs/copyright.html.
#
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
# copies of the Software, and permit persons to whom the Software is
# furnished to do so, under the terms of the COPYING file.
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
# KIND, either express or implied.
#
###########################################################################
pkginclude_HEADERS = \
curl.h curlver.h easy.h mprintf.h stdcheaders.h multi.h \
typecheck-gcc.h system.h urlapi.h

pkgincludedir= $(includedir)/curl

CHECKSRC = $(CS_$(V))
CS_0 = @echo " RUN " $@;
CS_1 =
CS_ = $(CS_0)

checksrc:
$(CHECKSRC)@PERL@ $(top_srcdir)/lib/checksrc.pl -D$(top_srcdir)/include/curl $(pkginclude_HEADERS)

if CURLDEBUG
# for debug builds, we scan the sources on all regular make invokes
all-local: checksrc
endif
Loading

0 comments on commit a14c25a

Please sign in to comment.