From eda6abdccdef3094a2ee0dce8c824a24f1505f49 Mon Sep 17 00:00:00 2001 From: SticklyMan Date: Sun, 4 Feb 2018 17:26:08 -0700 Subject: [PATCH 1/3] ULib should be calling UCLChanged after registerAccess. --- lua/ulib/server/ucl.lua | 5 ++++- ulib.build | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/ulib/server/ucl.lua b/lua/ulib/server/ucl.lua index d996d69..be5b583 100644 --- a/lua/ulib/server/ucl.lua +++ b/lua/ulib/server/ucl.lua @@ -990,7 +990,10 @@ function ucl.registerAccess( access, groups, comment, category ) table.insert( ucl.groups[ group ].allow, access ) end - timer.Create( "ULibSaveGroups", 1, 1, ucl.saveGroups ) -- 1 sec delay, 1 rep + timer.Create( "ULibSaveGroups", 1, 1, function() -- 1 sec delay, 1 rep + ucl.saveGroups() + hook.Call( ULib.HOOK_UCLCHANGED ) + end ) end end diff --git a/ulib.build b/ulib.build index b79f135..f287b29 100644 --- a/ulib.build +++ b/ulib.build @@ -1 +1 @@ -1507560100 +1517790368 From 4926b5b9aac72d48a21086f281fadb1d5262dc5a Mon Sep 17 00:00:00 2001 From: SticklyMan Date: Sun, 4 Feb 2018 17:30:01 -0700 Subject: [PATCH 2/3] Add ULib.HOOK_ACCESS_REGISTERED to let anyone (XGUI) know when new accesses are registered. Decided to keep the hook "grouped" when multiple accesses are added at once, thus, this callback will have no parameters. --- lua/ulib/server/ucl.lua | 1 + lua/ulib/shared/defines.lua | 11 +++++++++++ ulib.build | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lua/ulib/server/ucl.lua b/lua/ulib/server/ucl.lua index be5b583..b647667 100644 --- a/lua/ulib/server/ucl.lua +++ b/lua/ulib/server/ucl.lua @@ -993,6 +993,7 @@ function ucl.registerAccess( access, groups, comment, category ) timer.Create( "ULibSaveGroups", 1, 1, function() -- 1 sec delay, 1 rep ucl.saveGroups() hook.Call( ULib.HOOK_UCLCHANGED ) + hook.Call( ULib.HOOK_ACCESS_REGISTERED ) end ) end end diff --git a/lua/ulib/shared/defines.lua b/lua/ulib/shared/defines.lua index 84cef58..d779638 100644 --- a/lua/ulib/shared/defines.lua +++ b/lua/ulib/shared/defines.lua @@ -87,6 +87,17 @@ ULib.HOOK_UCLAUTH = "UCLAuthed" ]] ULib.HOOK_UCLCHANGED = "UCLChanged" +--[[ + Hook: UCLAccessRegistered + + Called *on both server and client* when one or more unrecognized accesses are registered. No parameters are passed to callbacks. + + Revisions: + + v2.70 - Initial +]] +ULib.HOOK_ACCESS_REGISTERED = "UCLAccessRegistered" + --[[ Hook: ULibReplicatedCvarChanged diff --git a/ulib.build b/ulib.build index f287b29..a6b53b2 100644 --- a/ulib.build +++ b/ulib.build @@ -1 +1 @@ -1517790368 +1517790602 From 6db4df49c0548f9410d07e6ae9c50cd45478c5cd Mon Sep 17 00:00:00 2001 From: SticklyMan Date: Sun, 11 Feb 2018 02:36:02 -0700 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 1 + ulib.build | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ae558e..be121b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # ULib Changelog ## v2.70 - *(00/00/00)* +* [ADD] Hook when a new, previously unknown access is registered. UCLChanged is now called as well. * [CHANGE] Moved bans to SQLite. * [FIX] Lua error with unspecified optional player arguments from server console (thanks, Timmy). * [FIX] Overridden chat commands now respect the hidden-state (thanks, Timmy). diff --git a/ulib.build b/ulib.build index a6b53b2..fb75076 100644 --- a/ulib.build +++ b/ulib.build @@ -1 +1 @@ -1517790602 +1518341763