fixed a french quest, removed a debug output

git [06-23-18 - 11:47]
fixed a french quest, removed a debug output
Filename
00_startup.lua
DASHelper.lua
DASUserSettingsAdapter.lua
DAS_xml.xml
DailyAutoShare.txt
DasChatMessage.lua
DasGui.lua
DasGuiStringBuilder.lua
DasTooltip.lua
locale/en.lua
locale/fr.lua
diff --git a/00_startup.lua b/00_startup.lua
index ad1b31d..64cea4b 100644
--- a/00_startup.lua
+++ b/00_startup.lua
@@ -2,7 +2,7 @@ DailyAutoShare              = DailyAutoShare or {}
 DAS                         = DailyAutoShare

 DAS.name                    = "DailyAutoShare"
-DAS.version                 = "3.4.1"
+DAS.version                 = "3.4.2"
 DAS.author                  = "manavortex"
 DAS.settings                = {}
 DAS.globalSettings          = {}
@@ -22,7 +22,7 @@ DAS.channelTypes 	        = {
     [CHAT_CHANNEL_SAY ]     = false,
     [CHAT_CHANNEL_YELL]     = false,
     [CHAT_CHANNEL_ZONE]     = false,
-    [CHAT_CHANNEL_WHISPER]  = false,
+    [CHAT_CHANNEL_WHISPER]  = true,
 }

 DAS.locale 			    = GetCVar("language.2")
@@ -264,24 +264,50 @@ local function OnQuestAdded(eventCode, journalIndex, questName, objectiveName)
 	local zoneId = DAS.GetZoneId()
 	if not DAS.GetActiveIn(zoneId) 			then return end
 	if not GetIsQuestSharable(journalIndex) then return end
-	local shareables = DAS.shareables[zoneId] or {}
+
+    local shareables = DAS.shareables[zoneId] or {}
     local bingoIndex = DAS.GetBingoIndexFromQuestName(questName) or 0
     DAS.activeBingoIndices[bingoIndex] = true
-	if nil ~= shareables[questName] then
+
+    if nil ~= shareables[questName] then
 		DAS.LogQuest(questName, false)
 		zo_callLater(forceRefreshControl, 700)
-	end
+	end
+end
+
+local questSharePending = false
+local questLoopInterval = 500
+local function stopAcceptQuestLoop(eventCode, journalIndex)
+    if not questSharePending then
+        ShareQuest(journalIndex)
+        return
+    end
+    questSharePending = nil ~= GetOfferedQuestShareIds()
+    questLoopInterval = 500
+end
+
+local function acceptQuestLoop()
+    if not questSharePending then return end
+    for id, _ in pairs(GetOfferedQuestShareIds()) do
+        AcceptSharedQuest(id)
+    end
+    questLoopInterval = questLoopInterval + questLoopInterval*0.5
+    zo_callLater(acceptQuestLoop, questLoopInterval)
 end

 local function OnQuestShared(eventCode, questId)
+
+    if not DAS.settings.autoAcceptShared then return end
     local questName =  GetOfferedQuestShareInfo(questId)
     p(zo_strformat("<<1>> \t <<2>>", questId, questName))
 	local zoneQuestIds = DAS.questIds[DAS.GetZoneId()] or {}
 	if not (zoneQuestIds[questName] or DAS_QUEST_IDS[questId]) and DAS.GetActiveIn(zoneId) then return end

-	if zoneQuestIds[questId] then
-            AcceptSharedQuest(questId)
-            zo_callLater(forceRefreshControl, 500)
+	if zoneQuestIds[questId] then
+        pendingQuestIds[questId] = true
+        AcceptSharedQuest(questId)
+        em:RegisterForEvent(DAS.name, EVENT_QUEST_ADDED, stopAcceptQuestLoop)
+        zo_callLater(forceRefreshControl, 500)
     end
 end

@@ -450,7 +476,7 @@ local function handleLog(forceNoAfterEight)
     if (not afterEight) and isEmpty(DAS.todaysLog) and lastDate ~= currentDate then
         local lastLog = DAS.globalSettings.completionLog[lastDate]
         DAS.globalSettings.completionLog[currentDate] = ZO_DeepTableCopy(lastLog, {})
-        d(DAS.globalSettings.completionLog[currentDate])
+        -- d(DAS.globalSettings.completionLog[currentDate])
         for charName, charLog in pairs(DAS.globalSettings.completionLog[currentDate]) do
             for questName, questData in pairs(charLog) do
                 questData.afterEight = false
diff --git a/DASHelper.lua b/DASHelper.lua
index 962da96..b41ec10 100644
--- a/DASHelper.lua
+++ b/DASHelper.lua
@@ -11,7 +11,6 @@ function DAS.SetChatListenerStatus(status)
     DAS.channelTypes[CHAT_CHANNEL_SAY ]     = status
     DAS.channelTypes[CHAT_CHANNEL_YELL]     = status
     DAS.channelTypes[CHAT_CHANNEL_ZONE]     = status and not DAS.GetWhisperOnly()
-    DAS.channelTypes[CHAT_CHANNEL_WHISPER]  = status
 end

 -- DAS_STATUS_COMPLETE 	= 0,
diff --git a/DASUserSettingsAdapter.lua b/DASUserSettingsAdapter.lua
index 5c1d948..3a04716 100644
--- a/DASUserSettingsAdapter.lua
+++ b/DASUserSettingsAdapter.lua
@@ -80,10 +80,10 @@ end
 function DAS.SetGroupInviteDelay(value)
 	GetSettings().groupInviteDelay = value
 end
+
 function DAS.GetAutoAcceptInvite()
 	return DAS.settings.autoAcceptInvite
 end
-
 function DAS.SetAutoAcceptInvite(value)
 	DAS.settings.autoAcceptInvite = value
     if value then
@@ -105,10 +105,10 @@ function DAS.SetMinimized(value)
 end

 function DAS.GetAutoAcceptShared()
-	return GetSettings().autoAcceptShared
+	return DAS.settings.autoAcceptShared
 end
 function DAS.SetAutoAcceptShared(value)
-	GetSettings().autoAcceptShared = value
+	DAS.settings.autoAcceptShared = value
 	DAS.SetButtonStates()
 end

@@ -343,7 +343,6 @@ local function getSettingsArray(forceRefresh)

 	return DAS.todaysCharacterLog
 end
-
 DAS.GetSettingsArray = getSettingsArray

 local typeString = "string"
@@ -352,8 +351,8 @@ function DAS.GetCompleted(questName)
 	if nil == questName or "" == questName or typeString ~= type(questName) then return false end

 	local settings 	 =  getSettingsArray()
-	local logEntry   =  settings[zo_strformat(questName)]
-	return nil ~= logEntry and logEntry.completed
+	local logEntry   =  settings[zo_strformat(questName)] or {}
+	return logEntry.completed

 end

diff --git a/DAS_xml.xml b/DAS_xml.xml
index 1c9258d..05e745d 100644
--- a/DAS_xml.xml
+++ b/DAS_xml.xml
@@ -155,7 +155,7 @@

 									<OnMouseEnter>		DailyAutoShare.CreateControlTooltip(self)	</OnMouseEnter>
 									<OnMouseExit> 		DailyAutoShare.HideTooltip(self)			</OnMouseExit>
-									<OnMouseUp> DailyAutoShare.Donate(self, button) </OnMouseUp>
+									<OnMouseUp>         DailyAutoShare.Donate(self, button)         </OnMouseUp>
 								</Button>


diff --git a/DailyAutoShare.txt b/DailyAutoShare.txt
index b655323..dfe286e 100644
--- a/DailyAutoShare.txt
+++ b/DailyAutoShare.txt
@@ -1,6 +1,6 @@
 ## Title: DailyAutoShare
 ## Author: manavortex
-## Version: 3.4.1
+## Version: 3.4.2
 ## APIVersion: 100023
 ## SavedVariables: DAS_Settings DAS_Globals
 ## OptionalDependsOn: LibStub LibCustomMenu LibAddonMenu-2.0 LibMediaProvider-1.0 pchat
diff --git a/DasChatMessage.lua b/DasChatMessage.lua
index 5c58f5f..98c68c9 100644
--- a/DasChatMessage.lua
+++ b/DasChatMessage.lua
@@ -77,6 +77,8 @@ function DAS.OnChatMessage(eventCode, channelType, fromName, messageText, _, fro
     -- if it's a group message, react to the group message
     if (channelType == CHAT_CHANNEL_PARTY) and (messageText:find(stringShare) or messageText:find(stringQuest)) then
        return DAS.TryShareActiveDaily()
+    elseif channelType == CHAT_CHANNEL_WHISPER and messageText:find(stringPlusRegex) then
+        return HandleChatMessage("+any", fromDisplayName, false)
     end

     --  d(zo_strformat("[OnChatMessage] <<1>>: <<2>>, isPlayerName: <<3>>", fromDisplayName, messageText, tostring(isPlayerName)))
diff --git a/DasGui.lua b/DasGui.lua
index 54a1e94..2aae79d 100644
--- a/DasGui.lua
+++ b/DasGui.lua
@@ -5,6 +5,8 @@ local stateIsMinimised 		= false
 local visibleButtonIndex	= 0
 DAS.sublabels = {}
 DAS.labels = {}
+local numLabels             = 0
+

 local labelTexts = {}

@@ -104,13 +106,13 @@ function DAS.QuestLabelClicked(control, mouseButton)
 		return DAS.OnRightClick(control)
 	end

-	local journalIndex          = control.dataJournalIndex
-	local isValidJournalIndex   = IsValidQuestIndex(journalIndex)
+	local journalIndex          = control.dataJournalIndex or 99

-	if isValidJournalIndex then
-		ShareQuest(journalIndex)
+	if IsValidQuestIndex(journalIndex) then
         if journalIndex ~= DAS.trackedIndex then
             FOCUSED_QUEST_TRACKER:ForceAssist(journalIndex)
+        else
+            ShareQuest(journalIndex)
         end
 	end
 end
@@ -255,12 +257,12 @@ function DAS.setLabels(zoneQuests)
     labelTexts = {}
     -- p("DAS.setLabels")
     DAS.activeZoneQuests = {}
-    local buttonIndex = 1
+    numLabels = 1
     local questName
 	for index, questNameOrTable in pairs(zoneQuests) do

         if not labelTexts[questNameOrTable] then
-            label = DAS.labels[buttonIndex] -- despite the name these are actually buttons
+            label = DAS.labels[numLabels] -- despite the name these are actually buttons

             if nil ~= label then
                 local status                = DAS_STATUS_OPEN
@@ -297,14 +299,14 @@ function DAS.setLabels(zoneQuests)
                 labelTexts[label.dataQuestName] = true
                 setControlText(label, hideLabel)

-                buttonIndex = buttonIndex + 1
+                numLabels = numLabels + 1


             end -- nil check end
         end
 	end -- for loop end

-    return buttonIndex
+    return numLabels
 end

 function DAS.RefreshLabelsWithDelay()
@@ -317,10 +319,6 @@ function DAS.RefreshLabels(forceQuestRefresh, forceSkipQuestRefresh)
 	cacheVisibilityStatus()
 	setButtonStates()

-
-
-	local buttonIndex = 1
-
 	local hideCompleted = DAS.GetHideCompleted()
 	local hidden 		= DasList:IsHidden()
 	local label, questIndex, tracked
@@ -334,16 +332,15 @@ function DAS.RefreshLabels(forceQuestRefresh, forceSkipQuestRefresh)
 	local questList = DAS.QuestLists[DAS.GetZoneId()]
     local zoneQuests = DAS.GetZoneQuests()

-    buttonIndex = DAS.setLabels(zoneQuests)
+    DAS.setLabels(zoneQuests)

-	for buttonIndex=#DAS.GetZoneQuests()+1, #DAS.labels do
-		if DAS.labels[buttonIndex] then
-			DAS.labels[buttonIndex]:SetHidden(true)
-            DAS.labels[buttonIndex]:SetText("")
+	for bIndex=#DAS.GetZoneQuests()+1, #DAS.labels do
+		if DAS.labels[bIndex] then
+			DAS.labels[bIndex]:SetHidden(true)
+            DAS.labels[bIndex]:SetText("")
 		end
 	end
-
-	DAS.RefreshFullBingoString()
+	DAS.RefreshFullBingoString()
 	DAS.SetLabelFontSize()
 end

@@ -402,12 +399,19 @@ local function setFontSize(labelList)
 end
 DAS.setFontSize = setFontSize

+local function setGuiHeight()
+    local buttonIndex = numLabels or 0
+    local listHeight = DasHeader:GetHeight() + buttonIndex*(DAS.labels[1]:GetHeight() + 2)
+    DasList:SetHeight(listHeight)
+    DasControl:SetHeight(listHeight + DasHandle:GetHeight())
+end
+DAS.SetGuiHeight = setGuiHeight
+
 function DAS.SetLabelFontSize()

     setFontSize(DAS.labels)
-	DasControl:SetHeight(DasList:GetHeight() + DasHandle:GetHeight())
     setFontSize(DAS.sublabels)
-
+	DAS.SetGuiHeight()
 end


@@ -415,8 +419,8 @@ function DAS.CreateGui()

     local function setupGuiLabels()

-        local predecessor 	= DasHeader
-        local offsetY 		= 10
+        local predecessor 	    = DasHeader
+        local offsetX, offsetY  = 10, 10

         for i=1, 28 do
             local button 	= WINDOW_MANAGER:CreateControlFromVirtual("Das_Label_"..tostring(i), DasList, "Das_Label")
@@ -425,12 +429,13 @@ function DAS.CreateGui()
             offsetY 		= 0
             table.insert(DAS.labels, button)
         end
+
         local spacer = WINDOW_MANAGER:CreateControlFromVirtual("Das_Spacer_1", DasList, "DasInvisibleFooterSpacer")
         spacer:SetAnchor(TOPLEFT, predecessor, BOTTOMLEFT, 0, offsetY)

         predecessor 	    = DasSubList
-        local offsetY 		= 10
-        local offsetX 		= 10
+        offsetY 		    = 10
+
         local anchor        = TOPLEFT
         for i=1, 15 do
             local button 	= WINDOW_MANAGER:CreateControlFromVirtual("Das_Sublabel_"..tostring(i), DasSubList, "Das_Label")
diff --git a/DasGuiStringBuilder.lua b/DasGuiStringBuilder.lua
index 9b1d047..9bd9057 100644
--- a/DasGuiStringBuilder.lua
+++ b/DasGuiStringBuilder.lua
@@ -81,7 +81,7 @@ local function whisperify(qsString)
 end


-local function GenerateBingoString(activeQuestNames, verbose)
+local function GenerateBingoString(activeQuestNames)

 	activeQuestNames = DAS.getEnglishQuestNames(activeQuestNames)
 	local qsString = DAS.GetSettings().questShareString
@@ -115,20 +115,20 @@ local function GenerateBingoString(activeQuestNames, verbose)
 end
 DAS.GenerateBingoString = GenerateBingoString

-local function SpamChat(verbose, questName)
+local function SpamChat(questName)
 	if CHAT_SYSTEM.textEntry.editControl:HasFocus() then
 		CHAT_SYSTEM.textEntry.editControl:Clear()
 	end
-	local activeQuestNames = {}
+	local activeQuestNames = (questName and {[1] = questName,}) or DAS.GetActiveQuestNames()
 	if nil == questName then
-		activeQuestNames = DAS.GetActiveQuestNames()
+		activeQuestNames = DAS.GetActiveQuestNames()
 	else
 		table.insert(activeQuestNames, questName)
 	end
 	if #activeQuestNames == 0 then
 		DAS.SetAutoInvite(false)
 	end
-	StartChatInput(DAS.GenerateBingoString(activeQuestNames, verbose), CHAT_CHANNEL_ZONE)
+	StartChatInput(DAS.GenerateBingoString(activeQuestNames), CHAT_CHANNEL_ZONE)

 end
 DAS.SpamChat = SpamChat
@@ -146,16 +146,12 @@ end
 function DAS.SettingsButton(control, mouseButton)

 	local name = control:GetName():gsub("DasButton", "")
-	if name == "Spam" 		then
-    return SpamChat(mouseButton == 2)
-	elseif 	name == "Invite" 	then DAS.SetAutoInvite(not DAS.GetAutoInvite())
-	elseif  name == "Accept"	then DAS.SetAutoAcceptInvite(not DAS.GetAutoAcceptInvite())
-	elseif 	name == "Share" 	then
-		if mouseButton == 2 then
-			DAS.TryShareActiveDaily()
-		else
-			DAS.SetAutoShare(not DAS.GetAutoShare())
-		end
+	if name == "Spam" 		then return SpamChat() end
+	if 	name == "Invite" 	then return DAS.SetAutoInvite(not DAS.GetAutoInvite()) end
+	if  name == "Accept"	then return DAS.SetAutoAcceptShared(not DAS.GetAutoAcceptShared()) end
+	if 	name == "Share" 	then
+		if mouseButton == 2 then return DAS.TryShareActiveDaily() end
+        DAS.SetAutoShare(not DAS.GetAutoShare())
 	end

 	-- DAS.RefreshLabels()
diff --git a/DasTooltip.lua b/DasTooltip.lua
index 495aa7b..8a48a17 100644
--- a/DasTooltip.lua
+++ b/DasTooltip.lua
@@ -58,8 +58,15 @@ local questStateColors = {
 }

 local dotDotDot = "%.%.%."
-function DAS.CreateLabelTooltip(control)
-
+
+local questStates = {
+    [DAS_STATUS_COMPLETE]   = " completed today",
+    [DAS_STATUS_ACTIVE]     = " is acive",
+    [DAS_STATUS_OPEN]       = " still open",
+}
+
+local bingoCodeIs = GetString(DAS_BINGO_CODE_IS)
+function DAS.CreateLabelTooltip(control)

 	setTooltipOffset(control)
 	local tooltipText = ""
@@ -69,19 +76,19 @@ function DAS.CreateLabelTooltip(control)
     if nil == questName then return end
     if nil ~= questName:find(dotDotDot) then
         tooltipText = GetString(DAS_TOGGLE_SUBLIST)
-    else
-        local state = DAS.GetCompleted(questName)
-        if control.dataQuestState == DAS_STATUS_COMPLETE then
-            tooltipText = (questName .. " completed today with " .. GetUnitName(UNITTAG_PLAYER))
+    else
+        local bingoString = control.dataBingoString or ""
+        local questState = control.dataQuestState
+        if questState == DAS_STATUS_COMPLETE then
+            tooltipText = bingoString .. questStates[questState]
+        elseif DAS_STATUS_ACTIVE == questState or DAS_STATUS_OPEN == questState then
+            tooltipText = (questName .. questStates[questState] .. bingoCodeIs .. bingoString)
         else
-            local bingoString = control["dataBingoString"] or ""
-            local bingoTooltip = (bingoString ~= "" and "\n The bingo code is " .. bingoString) or ""
-            local status = (( control.dataQuestState == DAS_STATUS_ACTIVE and " is acive") or " still open")
-            tooltipText = (questName .. status .. bingoTooltip)
+            DailyAutoShare_Tooltip:SetHidden(true)
+            return
         end
     end

-
 	DailyAutoShare_Tooltip:AddLine(tooltipText)
 	DailyAutoShare_Tooltip:SetHidden(false)

diff --git a/locale/en.lua b/locale/en.lua
index 4761afb..30fa1ca 100644
--- a/locale/en.lua
+++ b/locale/en.lua
@@ -28,6 +28,8 @@ local strings  = {
 	DAS_SI_SPAM_SINGLE	 	= "Spam",
 	DAS_SI_SETOPEN_TRUE	 	= "Toggle open",
 	DAS_SI_SETOPEN_FALSE	= "Toggle complete",
+
+    DAS_BINGO_CODE_IS       = "\nThe bingo code is ",


     DAS_ELF_RELIC           = "Relic Runaround",
diff --git a/locale/fr.lua b/locale/fr.lua
index 0a720c5..4235091 100644
--- a/locale/fr.lua
+++ b/locale/fr.lua
@@ -37,7 +37,7 @@ local strings  = {
     DAS_ELF_ALCHE           = "L'Alchimiste abyssal",
     DAS_ELF_GRAVE           = "Inoubliable",
     DAS_ELF_QUEEN           = "La mer maladive",
-    DAS_ELF_GRIFFIN         = "Qui se ressemble...",
+    DAS_ELF_GRIFFIN         = "Qui se ressemble",
     DAS_ELF_SNAKE           = "Naufragé",
     DAS_ELF_WILD            = "Dompter la nature",