/trunk
## Title: Cellular |
## Notes: Instant messenger for whispers |
## Author: TotalPackage |
## Version: 6.1.001 |
## Version: 6.1.002 |
## SavedVariables: CellularDB |
## SavedVariablesPerCharacter: CellularCharDB, Cellular_History |
------------------------------------------ |
function a:CHAT_MSG_BN_WHISPER_INFORM(...) -- battle.net outgoing whisper |
------------------------------------------ |
local a1, a2 = Filter("CHAT_MSG_BN_WHISPER_INFORM", ...) |
local a1,a2,_,_,_,_,_,_,_,_,_,_,a13 = Filter("CHAT_MSG_BN_WHISPER_INFORM", ...) |
if a2 then |
a:OutgoingMessage(a2, a1, true) |
a:OutgoingMessage(a2, a1, a13) |
end |
end |
------------------------------- |
-------------------------------------- |
--- MESSAGE HANDLERS |
GetWindow = function(name, isSpecial, showmore, bnname) -- retrieve window |
GetWindow = function(name, isSpecial, showmore, battleTag) -- retrieve window |
local id = usedtabs[name] |
if (not id or not tabs[id] or not tabs[id]:IsShown()) and not isSpecial then |
local t |
t.msg:Clear() |
t.msg:ScrollToBottom() |
local history = svar[bnname or name] |
local history = svar[battleTag or name] |
if history then -- show recent history if available |
local n = #history |
local numlines = (showmore and 50) or 15 |
end |
do |
local ChatEdit_SetLastTellTarget, GetTime = ChatEdit_SetLastTellTarget, GetTime |
local function HandleHistory(name, dname, text, isbn) -- history tracking |
local battleTag, presenceName, _, toonName |
if isbn then |
_, presenceName, battleTag, _, toonName = BNGetFriendInfoByID(isbn) |
end |
local function HandleHistory(name, dname, text, battleTag) -- history tracking |
recentw[name] = true |
if not db.history then return end |
local t = svar[name] |
local t = svar[battleTag or name] |
if not t then |
svar[name] = {} |
t = svar[name] |
svar[battleTag or name] = {} |
t = svar[battleTag or name] |
end |
t[#t + 1] = format("<%s>[%s] %s", date("%m-%d-%y %H:%M"), dname, text) |
if eb and eb:IsShown() and eb.name == name then |
eb.max = #t |
end |
end |
local function HandleWindow(name, special, text, bnname) -- window check |
if not name and not bnname then return end |
local id = GetWindow(name, special, bnname) |
local function HandleWindow(name, special, text, battleTag) -- window check |
if not name then return end |
local id = GetWindow(name, special, nil, battleTag) |
if not id then |
if not special then |
print(format("|cff88ff88Cellular|r: Max windows reached - [%s] %s", name, text)) |
f.text:SetFormattedText("%s (%d)", f.name, f.mininew) |
end |
f.text:SetTextColor(r or 1, g or 1, b or 1, 1) |
f.bn = isbn |
ChatEdit_SetLastTellTarget(name, isbn and "BN_WHISPER" or "WHISPER") |
HandleHistory(name, tname, text, isbn) -- add entry to history |
HandleHistory(name, tname, text, battleTag) -- add entry to history |
if ctime > lastTell + 2 then -- support for whisper sound alerts |
if a.pratloaded and Prat.Addon:GetModule("Sounds", true) then |
a.PLAYERLINK = name |
else |
addmsg(f.msg, true, "[<] %s", text) |
end |
f.bn = isbn |
HandleHistory(name, you, text, isbn) |
HandleHistory(name, you, text, battleTag) |
if a.pratloaded and Prat.Addon:GetModule("Sounds", true) then |
a.PLAYERLINK = you |
Prat.Addon:GetModule("Sounds", true):Prat_PostAddMessage(nil, a, nil, "CHAT_MSG_WHISPER_INFORM") |