Skip to content

Commit 99bb1fd

Browse files
committed
v4.3.13: cross-version compat wrappers, updated README, all TOCs bumped
1 parent 6d9978e commit 99bb1fd

14 files changed

Lines changed: 176 additions & 110 deletions

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22

33
All notable changes to Postal (TBC Anniversary) will be documented in this file.
44

5+
## [4.3.13] - 2026-02-17
6+
7+
### Fixed
8+
- **Cross-version compatibility**: Added safe wrappers for all container and item APIs that differ between WoW versions
9+
- `C_Container.GetContainerNumFreeSlots` / `GetContainerNumFreeSlots`
10+
- `C_Container.GetContainerNumSlots` / `GetContainerNumSlots`
11+
- `C_Container.GetContainerItemID` / `GetContainerItemID`
12+
- `C_Container.PickupContainerItem` / `PickupContainerItem`
13+
- `C_Container.GetContainerFreeSlots` / `GetContainerFreeSlots`
14+
- `C_Item.GetItemInfo` / `GetItemInfo`
15+
- `C_Item.GetItemCount` / `GetItemCount`
16+
- **Select.lua**: Replaced all hardcoded `C_Container` and `C_Item` calls with safe compat wrappers
17+
- **OpenAll.lua**: Replaced direct `C_Container.GetContainerItemInfo` and `C_Item` calls with compat wrappers; added nil guard for `OpenAllMail` (may not exist on all clients)
18+
- **Express.lua**: Replaced `C_Item.GetItemInfo` calls with safe wrapper
19+
- **Forward.lua**: Replaced all `C_Container` and `C_Item` calls with safe wrappers; removed version-branching `if/else` blocks
20+
- **QuickAttach.lua**: Replaced `C_Item.GetItemInfo` call with safe wrapper
21+
522
## [4.3.12] - 2026-02-15
623

724
### Fixed

Modules/Express.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ function Postal_Express:ContainerFrameItemButtonOnModifiedClick(bag, slot, butto
179179
if not itemid then return end
180180
local itemInfo = Postal:GetContainerItemInfoCompat(bag, slot)
181181
local itemlocked = itemInfo and itemInfo.isLocked or false
182-
local itemq, _,_, itemc, itemsc, _, itemes = select(3,C_Item.GetItemInfo(itemid))
182+
local itemq, _,_, itemc, itemsc, _, itemes = select(3,Postal.GetItemInfoSafe(itemid))
183183
itemes = itemes and #itemes > 0
184184
if Postal.db.profile.Express.BulkSend and itemq and itemc then
185185
local itemsinmail = 0
@@ -203,7 +203,7 @@ function Postal_Express:ContainerFrameItemButtonOnModifiedClick(bag, slot, butto
203203
if not tid or itemlocked2 or Postal_Express_IsSoulbound(b, s) then
204204
-- item locked, already attached, soulbound
205205
else
206-
local tq, _,_, tc, tsc, _, tes = select(3,C_Item.GetItemInfo(tid))
206+
local tq, _,_, tc, tsc, _, tes = select(3,Postal.GetItemInfoSafe(tid))
207207
-- tc = (tq or "").."."..(tc or "")
208208
tsc = (tc or "").."."..(tsc or "")
209209
tes = tes and #tes > 0

Modules/Forward.lua

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ local function ContainsStackableItem(messageindex)
5151
for itemIndex = 1, ATTACHMENTS_MAX_SEND do
5252
itemID = select(2, GetInboxItem(messageindex, itemIndex))
5353
if itemID ~= nil then
54-
itemStackCount = select(8,C_Item.GetItemInfo(itemID))
54+
itemStackCount = select(8,Postal.GetItemInfoSafe(itemID))
5555
if itemStackCount > 1 then return true end
5656
end
5757
end
@@ -64,11 +64,7 @@ local function FreeBagSpace()
6464
local FreeSpace = 0
6565
for bagID = 0, 4, 1 do
6666
local numberOfFreeSlots, bagType
67-
-- if Postal.WOWBCClassic then
68-
-- numberOfFreeSlots, bagType = GetContainerNumFreeSlots(bagID)
69-
-- else
70-
numberOfFreeSlots, bagType = C_Container.GetContainerNumFreeSlots(bagID)
71-
-- end
67+
numberOfFreeSlots, bagType = Postal.GetContainerNumFreeSlotsSafe(bagID)
7268
FreeSpace = FreeSpace + numberOfFreeSlots
7369
end
7470
return FreeSpace
@@ -82,9 +78,9 @@ local function Postal_Inventory_Change(action)
8278
wipe(PostalForwardTable)
8379
for bagID = 0, 4, 1 do
8480
if Postal.WOWBCClassic then
85-
table.insert(PostalForwardTable, GetContainerFreeSlots(bagID))
81+
table.insert(PostalForwardTable, Postal.GetContainerFreeSlotsSafe(bagID))
8682
else
87-
table.insert(PostalForwardTable, C_Container.GetContainerFreeSlots(bagID))
83+
table.insert(PostalForwardTable, Postal.GetContainerFreeSlotsSafe(bagID))
8884
end
8985
end
9086
return 0, 0
@@ -93,9 +89,9 @@ local function Postal_Inventory_Change(action)
9389
wipe(TempTable)
9490
for bagID = 0, 4, 1 do
9591
if Postal.WOWBCClassic then
96-
TempTable = GetContainerFreeSlots(bagID)
92+
TempTable = Postal.GetContainerFreeSlotsSafe(bagID)
9793
else
98-
TempTable = C_Container.GetContainerFreeSlots(bagID)
94+
TempTable = Postal.GetContainerFreeSlotsSafe(bagID)
9995
end
10096
for Key = 1, #PostalForwardTable[bagID + 1], 1 do
10197
if not contains(TempTable, PostalForwardTable[bagID + 1][Key]) then
@@ -159,11 +155,7 @@ function Postal_Forward_ForwardMailItems(action)
159155
if action == 2 then
160156
Postal_Forward:UnregisterEvent("BAG_UPDATE_DELAYED","Postal_Forward_ForwardMailItemsEvent")
161157
bagID, itemIndex = Postal_Inventory_Change(2)
162-
if Postal.WOWBCClassic then
163-
PickupContainerItem(bagID, itemIndex)
164-
else
165-
C_Container.PickupContainerItem(bagID, itemIndex)
166-
end
158+
Postal.PickupContainerItemSafe(bagID, itemIndex)
167159
ClickSendMailItemButton()
168160
Postal_Forward_ForwardMailItems(1)
169161
return

Modules/OpenAll.lua

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Postal_OpenAll.description2 = L[ [[|cFFFFCC00*|r Simple filters are available fo
1313
local MAX_MAIL_SHOWN = 100
1414
local GetContainerNumFreeSlotsSafe = (C_Container and C_Container.GetContainerNumFreeSlots) or GetContainerNumFreeSlots
1515
local GetContainerNumSlotsSafe = (C_Container and C_Container.GetContainerNumSlots) or GetContainerNumSlots
16-
local GetContainerItemInfoSafe = C_Container and C_Container.GetContainerItemInfo or nil
16+
-- Uses Postal:GetContainerItemInfoCompat() from Postal.lua
1717
local mailIndex, attachIndex
1818
local numUnshownItems
1919
local lastItem, lastNumAttach, lastNumGold
@@ -133,7 +133,7 @@ function Postal_OpenAll:OnEnable()
133133
Postal_OpenAll:RegisterEvent("PLAYER_INTERACTION_MANAGER_FRAME_SHOW")
134134
end
135135
-- For enabling after a disable
136-
OpenAllMail:Hide() -- hide Blizzard's Open All button
136+
if OpenAllMail then OpenAllMail:Hide() end -- hide Blizzard's Open All button
137137
button:Show()
138138
Postal_OpenAllMenuButton:SetScript("OnHide", Postal_DropDownMenu.HideMenu)
139139
Postal_OpenAllMenuButton:Show()
@@ -142,7 +142,7 @@ end
142142
function Postal_OpenAll:OnDisable()
143143
self:Reset()
144144
button:Hide()
145-
OpenAllMail:Show() -- show Blizzard's Open All button
145+
if OpenAllMail then OpenAllMail:Show() end -- show Blizzard's Open All button
146146
Postal_OpenAllMenuButton:SetScript("OnHide", nil)
147147
Postal_OpenAllMenuButton:Hide()
148148
end
@@ -306,24 +306,19 @@ function Postal_OpenAll:ProcessNext()
306306
local name, itemID, itemTexture, count, quality, canUse = GetInboxItem(mailIndex, attachIndex)
307307
local link = GetInboxItemLink(mailIndex, attachIndex)
308308
local itemID = strmatch(link, "item:(%d+)")
309-
local stackSize = select(8, C_Item.GetItemInfo(link))
310-
if itemID and stackSize and C_Item.GetItemCount(itemID) > 0 then
309+
local stackSize = select(8, Postal.GetItemInfoSafe(link))
310+
if itemID and stackSize and Postal.GetItemCountSafe(itemID) > 0 then
311311
for bag = 0, NUM_BAG_SLOTS do
312312
local containerNumSlots = GetContainerNumSlotsSafe(bag)
313313
for slot = 1, containerNumSlots do
314314
local count2, link2
315-
if Postal.WOWBCClassic then
316-
count2 = select(2, GetContainerItemInfo(bag, slot))
317-
link2 = select(7, GetContainerItemInfo(bag, slot))
315+
local itemInfo = Postal:GetContainerItemInfoCompat(bag, slot)
316+
if itemInfo then
317+
count2 = itemInfo.stackCount
318+
link2 = itemInfo.hyperlink
318319
else
319-
if GetContainerItemInfoSafe and GetContainerItemInfoSafe(bag, slot) then
320-
local itemInfo = GetContainerItemInfoSafe(bag, slot)
321-
count2 = itemInfo.stackCount
322-
link2 = itemInfo.hyperlink
323-
else
324-
count2 = 0
325-
link2 = nil
326-
end
320+
count2 = 0
321+
link2 = nil
327322
end
328323
if link2 then
329324
local itemID2 = strmatch(link2, "item:(%d+)")

Modules/QuickAttach.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ function Postal_QuickAttachLeftButtonClick(classID, subclassID)
223223
itemID = itemInfo and itemInfo.itemID or nil
224224
if itemID then
225225
if not itemInfoCache[itemID] then
226-
itemInfoCache[itemID] = {C_Item.GetItemInfo(itemID)}
226+
itemInfoCache[itemID] = {Postal.GetItemInfoSafe(itemID)}
227227
end
228228
local info = itemInfoCache[itemID]
229229
bindType = info[14]

Modules/Select.lua

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -350,11 +350,7 @@ function Postal_Select:ProcessNext()
350350
local free = 0
351351
for bag = 0, NUM_BAG_SLOTS do
352352
local bagFree, bagFam
353-
-- if Postal.WOWBCClassic then
354-
-- bagFree, bagFam = GetContainerNumFreeSlots(bag)
355-
-- else
356-
bagFree, bagFam = C_Container.GetContainerNumFreeSlots(bag)
357-
-- end
353+
bagFree, bagFam = Postal.GetContainerNumFreeSlotsSafe(bag)
358354
if bagFam == 0 then
359355
free = free + bagFree
360356
end
@@ -374,29 +370,19 @@ function Postal_Select:ProcessNext()
374370
local name, itemID, itemTexture, count, quality, canUse = GetInboxItem(mailIndex, attachIndex)
375371
local link = GetInboxItemLink(mailIndex, attachIndex)
376372
itemID = strmatch(link, "item:(%d+)")
377-
local stackSize = select(8, C_Item.GetItemInfo(link))
378-
if itemID and stackSize and C_Item.GetItemCount(itemID) > 0 then
373+
local stackSize = select(8, Postal.GetItemInfoSafe(link))
374+
if itemID and stackSize and Postal.GetItemCountSafe(itemID) > 0 then
379375
for bag = 0, NUM_BAG_SLOTS do
380-
local ContainerNumSlots
381-
if Postal.WOWBCClassic then
382-
ContainerNumSlots = GetContainerNumSlots(bag)
383-
else
384-
ContainerNumSlots = C_Container.GetContainerNumSlots(bag)
385-
end
376+
local ContainerNumSlots = Postal.GetContainerNumSlotsSafe(bag)
386377
for slot = 1, ContainerNumSlots do
387378
local count2, link2
388-
if Postal.WOWBCClassic then
389-
count2 = select(2, GetContainerItemInfo(bag, slot))
390-
link2 = select(7, GetContainerItemInfo(bag, slot))
379+
local itemInfo = Postal:GetContainerItemInfoCompat(bag, slot)
380+
if itemInfo then
381+
count2 = itemInfo.stackCount
382+
link2 = itemInfo.hyperlink
391383
else
392-
if C_Container and C_Container.GetContainerItemInfo(bag, slot) then
393-
local itemInfo = C_Container.GetContainerItemInfo(bag, slot)
394-
count2 = itemInfo.stackCount
395-
link2 = itemInfo.hyperlink
396-
else
397-
count2 = 0
398-
link2 = nil
399-
end
384+
count2 = 0
385+
link2 = nil
400386
end
401387
if link2 then
402388
local itemID2 = strmatch(link2, "item:(%d+)")

Postal.lua

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,27 @@ end
117117
-- Shared Compat Utilities --
118118
-------------------------------
119119

120+
-- Container API wrappers: prefer C_Container namespace (Retail/modern), fall back to legacy globals (Classic/TBC)
121+
local GetContainerNumFreeSlotsSafe = (C_Container and C_Container.GetContainerNumFreeSlots) or GetContainerNumFreeSlots
122+
local GetContainerNumSlotsSafe = (C_Container and C_Container.GetContainerNumSlots) or GetContainerNumSlots
123+
local GetContainerItemIDSafe = (C_Container and C_Container.GetContainerItemID) or GetContainerItemID
124+
local PickupContainerItemSafe = (C_Container and C_Container.PickupContainerItem) or PickupContainerItem
125+
local GetContainerFreeSlotsSafe = (C_Container and C_Container.GetContainerFreeSlots) or GetContainerFreeSlots
126+
127+
-- Item API wrappers: prefer C_Item namespace (Retail/modern), fall back to legacy globals (Classic/TBC)
128+
local GetItemInfoSafe = (C_Item and C_Item.GetItemInfo) or GetItemInfo
129+
local GetItemCountSafe = (C_Item and C_Item.GetItemCount) or GetItemCount
130+
131+
-- Export safe wrappers so modules can use them via Postal
132+
Postal.GetContainerNumFreeSlotsSafe = GetContainerNumFreeSlotsSafe
133+
Postal.GetContainerNumSlotsSafe = GetContainerNumSlotsSafe
134+
Postal.GetContainerItemIDSafe = GetContainerItemIDSafe
135+
Postal.PickupContainerItemSafe = PickupContainerItemSafe
136+
Postal.GetContainerFreeSlotsSafe = GetContainerFreeSlotsSafe
137+
Postal.GetItemInfoSafe = GetItemInfoSafe
138+
Postal.GetItemCountSafe = GetItemCountSafe
139+
140+
-- GetContainerItemInfo compat: returns a table with .iconFileID, .stackCount, .isLocked, .hyperlink, .itemID
120141
local GetContainerItemInfoSafe = C_Container and C_Container.GetContainerItemInfo or nil
121142
local GetContainerItemInfoLegacy = GetContainerItemInfo
122143

Postal.toc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## Interface: 110205
22
## Title: Postal
3-
## Version: 4.3.12
4-
## X-Build: 663
5-
## X-ReleaseDate: 2025-10-29T20:49:10Z
3+
## Version: 4.3.13
4+
## X-Build: 673
5+
## X-ReleaseDate: 2026-02-17T00:00:00Z
66
## X-Revision: 663
77
## Author: paradosi@Dreamscythe
88
## X-Credits: Ammo, Rabbit, Grennon, Mikk, oscarucb, Jonny aka The_Original_Manbot

Postal_Cata.toc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## Interface: 40402
22
## Title: Postal
3-
## Version: v4.3.4
4-
## X-Build: 663
5-
## X-ReleaseDate: 2025-10-29T20:49:10Z
3+
## Version: 4.3.13
4+
## X-Build: 673
5+
## X-ReleaseDate: 2026-02-17T00:00:00Z
66
## X-Revision: 663
77
## Author: paradosi@Dreamscythe
88
## X-Credits: Ammo, Rabbit, Grennon, Mikk, oscarucb, Jonny aka The_Original_Manbot

Postal_Mists.toc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## Interface: 50502
22
## Title: Postal
3-
## Version: v4.3.4
4-
## X-Build: 663
5-
## X-ReleaseDate: 2025-10-29T20:49:10Z
3+
## Version: 4.3.13
4+
## X-Build: 673
5+
## X-ReleaseDate: 2026-02-17T00:00:00Z
66
## X-Revision: 663
77
## Author: paradosi@Dreamscythe
88
## X-Credits: Ammo, Rabbit, Grennon, Mikk, oscarucb, Jonny aka The_Original_Manbot

0 commit comments

Comments
 (0)