Fixed the body splitter so that it works for all accounts now.

Jayden Platell [08-14-14 - 21:20]
Fixed the body splitter so that it works for all accounts now.
Filename
Librarian.lua
LibrarianSettings.lua
diff --git a/Librarian.lua b/Librarian.lua
index 0b8fca6..4d4766b 100644
--- a/Librarian.lua
+++ b/Librarian.lua
@@ -10,7 +10,7 @@ ZO_CreateStringId("SI_LIBRARIAN_SORT_TYPE_TITLE", "Title")
 ZO_CreateStringId("SI_LIBRARIAN_SORT_TYPE_WORD_COUNT", "Words")
 ZO_CreateStringId("SI_LIBRARIAN_MARK_UNREAD", "Mark as Unread")
 ZO_CreateStringId("SI_LIBRARIAN_MARK_READ", "Mark as Read")
-ZO_CreateStringId("SI_LIBRARIAN_CREDIT", "Librarian 1.2.3 by Flamage")
+ZO_CreateStringId("SI_LIBRARIAN_CREDIT", "Librarian 1.2.4 by Flamage")
 ZO_CreateStringId("SI_LIBRARIAN_BOOK_COUNT", "%d Books")
 ZO_CreateStringId("SI_LIBRARIAN_UNREAD_COUNT", "%s (%d Unread)")
 ZO_CreateStringId("SI_LIBRARIAN_SHOW_ALL_BOOKS", "Show books for all characters")
@@ -171,15 +171,17 @@ function Librarian:UpdateSavedVariables()
 	end

 	-- Version 1.1.3 - SavedVariable hell!
-	for _,book in ipairs(self.globalSavedVars.books) do
-		if type(book.body) == "string" then
-			local newBody = book.body
-			book.body = {}
-			while string.len(newBody) > 1024 do
-				table.insert(book.body, string.sub(newBody, 0, 1024))
-				newBody = string.sub(newBody, 1025)
+	for _,account in pairs(Librarian_SavedVariables["Default"]) do
+		for _,book in pairs(account["$AccountWide"].books) do
+			if type(book.body) == "string" then
+				local newBody = book.body
+				book.body = {}
+				while string.len(newBody) > 1024 do
+					table.insert(book.body, string.sub(newBody, 0, 1024))
+					newBody = string.sub(newBody, 1025)
+				end
+				table.insert(book.body, newBody)
 			end
-			table.insert(book.body, newBody)
 		end
 	end
 end
diff --git a/LibrarianSettings.lua b/LibrarianSettings.lua
index 72fd79a..d809fe1 100644
--- a/LibrarianSettings.lua
+++ b/LibrarianSettings.lua
@@ -75,7 +75,7 @@ function LibrarianSettings:Initialise(settings)
     name = "Librarian",
     displayName = "Librarian Book Manager",
     author = "Flamage",
-    version = "1.2.3",
+    version = "1.2.4",
     slashCommand = "/lo"
   }