From 57d3fc8aede610b0a5665437012397b74696329a Mon Sep 17 00:00:00 2001 From: lantisnt Date: Sun, 9 Apr 2023 20:04:14 +0200 Subject: [PATCH 1/3] Add Full creator return --- source/LogEntry.lua | 4 ++++ source/LogEntryCrossRealm.lua | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/source/LogEntry.lua b/source/LogEntry.lua index 1be610f..0911249 100644 --- a/source/LogEntry.lua +++ b/source/LogEntry.lua @@ -130,6 +130,10 @@ function LogEntry:creator() return self[privateCreator] end +function LogEntry:creatorFull() + return self[privateCreator] +end + function LogEntry:counter() return self[privateCounter] end diff --git a/source/LogEntryCrossRealm.lua b/source/LogEntryCrossRealm.lua index 5e79dd4..e2404c7 100644 --- a/source/LogEntryCrossRealm.lua +++ b/source/LogEntryCrossRealm.lua @@ -144,6 +144,10 @@ function LogEntry:realm() return self[privateRealm] end +function LogEntry:creatorFull() + return {self[privateRealm], self[privateCreator]} +end + function LogEntry:counter() return self[privateCounter] end From 05e1b8b655f202e9e0b4bfe3a46921de8c136da5 Mon Sep 17 00:00:00 2001 From: lantisnt Date: Mon, 10 Apr 2023 15:50:43 +0200 Subject: [PATCH 2/3] feat: set creator check for submission as optional parameter. move responsibility to checking self-sending from libray to user --- source/LedgerFactory.lua | 6 +++--- source/ListSync.lua | 6 +----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/source/LedgerFactory.lua b/source/LedgerFactory.lua index afddd9e..ddaf0c2 100644 --- a/source/LedgerFactory.lua +++ b/source/LedgerFactory.lua @@ -1,6 +1,6 @@ local _, LibEventSourcing = ... -local LedgerFactory, _ = LibStub:NewLibrary("EventSourcing/LedgerFactory", 2) +local LedgerFactory, _ = LibStub:NewLibrary("EventSourcing/LedgerFactory", 3) if not LedgerFactory then return end @@ -71,10 +71,10 @@ LedgerFactory.createLedger = function(table, send, registerReceiveHandler, autho registerMutator = function(metatable, mutatorFunc) stateManager:registerHandler(metatable, mutatorFunc) end, - submitEntry = function(entry) + submitEntry = function(entry, creator) -- not applying timetravel before auth, because from an addon perspective it is the current time. -- check authorization - if not authorizationHandler(entry, UnitName("player")) then + if not authorizationHandler(entry, creator or UnitName("player")) then error("Attempted to submit entries for which you are not authorized") return end diff --git a/source/ListSync.lua b/source/ListSync.lua index 491f4aa..a6a02fd 100644 --- a/source/ListSync.lua +++ b/source/ListSync.lua @@ -2,7 +2,7 @@ Sync lists in lua ]]-- -local ListSync, _ = LibStub:NewLibrary("EventSourcing/ListSync", 2) +local ListSync, _ = LibStub:NewLibrary("EventSourcing/ListSync", 3) if not ListSync then return end @@ -262,10 +262,6 @@ end local function handleMessage(listSync, message, distribution, sender) - if sender == listSync.playerName then - return - end - if not Message.cast(message) then listSync.logger:Warning("Ignoring invalid message from %s", sender) return From 5916ed26c216f9a430cd4062693ca40ce29254c1 Mon Sep 17 00:00:00 2001 From: lantisnt Date: Wed, 3 May 2023 18:45:01 +0200 Subject: [PATCH 3/3] feat: Add support for classic era --- source/LogEntry.lua | 7 ++++--- source/LogEntryCrossRealm.lua | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/LogEntry.lua b/source/LogEntry.lua index 0911249..30137c6 100644 --- a/source/LogEntry.lua +++ b/source/LogEntry.lua @@ -1,7 +1,8 @@ -local WoW10 = select(4, GetBuildInfo()) >= 100000 -if WoW10 then return end +local WoW10 = select(4, GetBuildInfo()) >= 100000 +local WoWEra = select(4, GetBuildInfo()) < 30000 +if WoW10 or WoWEra then return end -local LogEntry, _ = LibStub:NewLibrary("EventSourcing/LogEntry", 1) +local LogEntry, _ = LibStub:NewLibrary("EventSourcing/LogEntry", 3) if not LogEntry then return end diff --git a/source/LogEntryCrossRealm.lua b/source/LogEntryCrossRealm.lua index e2404c7..a338f66 100644 --- a/source/LogEntryCrossRealm.lua +++ b/source/LogEntryCrossRealm.lua @@ -1,7 +1,8 @@ -local WoW10 = select(4, GetBuildInfo()) >= 100000 -if not WoW10 then return end +local WoW10 = select(4, GetBuildInfo()) >= 100000 +local WoWEra = select(4, GetBuildInfo()) < 30000 +if not (WoW10 or WoWEra) then return end -local LogEntry, _ = LibStub:NewLibrary("EventSourcing/LogEntry", 2) +local LogEntry, _ = LibStub:NewLibrary("EventSourcing/LogEntry", 4) if not LogEntry then return end