annotate Modules/Config.lua @ 24:7370286862ba

Removed tag MailOpener v1.0
author Zerotorescue
date Thu, 09 Sep 2010 19:06:40 +0200
parents 2dd6005d41f3
children 90d58723ac0a
rev   line source
Zerotorescue@0 1 local MailOpener = LibStub("AceAddon-3.0"):GetAddon("MailOpener");
Zerotorescue@0 2 local Config = MailOpener:NewModule("Config", "AceEvent-3.0", "AceTimer-3.0");
Zerotorescue@0 3
Zerotorescue@4 4 --[[
Zerotorescue@4 5 Module name: Config
Zerotorescue@4 6 Description: Builds and loads the config frame(s) and handles the slash commands.
Zerotorescue@4 7 Required: No (default off).
Zerotorescue@4 8 ]]
Zerotorescue@4 9
Zerotorescue@0 10 local Media = LibStub("LibSharedMedia-3.0");
Zerotorescue@0 11 Media:Register("sound", "Cartoon FX", [[Sound\Doodad\Goblin_Lottery_Open03.wav]]);
Zerotorescue@0 12 Media:Register("sound", "Cheer", [[Sound\Event Sounds\OgreEventCheerUnique.wav]]);
Zerotorescue@0 13 Media:Register("sound", "Explosion", [[Sound\Doodad\Hellfire_Raid_FX_Explosion05.wav]]);
Zerotorescue@0 14 Media:Register("sound", "Fel Nova", [[Sound\Spells\SeepingGaseous_Fel_Nova.wav]]);
Zerotorescue@0 15 Media:Register("sound", "Fel Portal", [[Sound\Spells\Sunwell_Fel_PortalStand.wav]]);
Zerotorescue@0 16 Media:Register("sound", "Magic Click", [[Sound\interface\MagicClick.wav]]);
Zerotorescue@0 17 Media:Register("sound", "Rubber Ducky", [[Sound\Doodad\Goblin_Lottery_Open01.wav]]);
Zerotorescue@0 18 Media:Register("sound", "Shing!", [[Sound\Doodad\PortcullisActive_Closed.wav]]);
Zerotorescue@0 19 Media:Register("sound", "Simon Chime", [[Sound\Doodad\SimonGame_LargeBlueTree.wav]]);
Zerotorescue@0 20 Media:Register("sound", "Simon Error", [[Sound\Spells\SimonGame_Visual_BadPress.wav]]);
Zerotorescue@0 21 Media:Register("sound", "Simon Start", [[Sound\Spells\SimonGame_Visual_GameStart.wav]]);
Zerotorescue@0 22 Media:Register("sound", "War Drums", [[Sound\Event Sounds\Event_wardrum_ogre.wav]]);
Zerotorescue@0 23 Media:Register("sound", "Wham!", [[Sound\Doodad\PVP_Lordaeron_Door_Open.wav]]);
Zerotorescue@0 24 Media:Register("sound", "Whisper Ping", [[Sound\interface\iTellMessage.wav]]);
Zerotorescue@0 25 Media:Register("sound", "You Will Die!", [[Sound\Creature\CThun\CThunYouWillDIe.wav]]);
Zerotorescue@0 26
Zerotorescue@0 27 local AceConfigDialog;
Zerotorescue@0 28
Zerotorescue@0 29 function Config:OnEnable()
Zerotorescue@0 30 MailOpener:Debug("Enabling |cff00ffffConfig|r module.");
Zerotorescue@0 31 end
Zerotorescue@0 32
Zerotorescue@0 33 function Config:CommandHandler(message)
Zerotorescue@0 34 local cmd, arg = string.split(" ", (message or ""), 2);
Zerotorescue@0 35 cmd = string.lower(cmd);
Zerotorescue@0 36
Zerotorescue@0 37 if cmd == "c" or cmd == "config" or cmd == "conf" or cmd == "option" or cmd == "options" or cmd == "opt" or cmd == "setting" or cmd == "settings" then
Zerotorescue@0 38 self:Show();
Zerotorescue@0 39 elseif cmd == "d" or cmd == "debug" then
Zerotorescue@0 40 MailOpener.debugChannel = false;
Zerotorescue@0 41 for i = 1, NUM_CHAT_WINDOWS do
Zerotorescue@0 42 local name = GetChatWindowInfo(i);
Zerotorescue@0 43
Zerotorescue@0 44 if name:upper() == "DEBUG" then
Zerotorescue@0 45 MailOpener.debugChannel = _G["ChatFrame" .. i];
Zerotorescue@0 46
Zerotorescue@0 47 print("A debug channel already exists, used the old one.");
Zerotorescue@0 48 return;
Zerotorescue@0 49 end
Zerotorescue@0 50 end
Zerotorescue@0 51
Zerotorescue@0 52 if not MailOpener.debugChannel then
Zerotorescue@0 53 -- Create a new debug channel
Zerotorescue@0 54 local chatFrame = FCF_OpenNewWindow('Debug');
Zerotorescue@0 55 ChatFrame_RemoveAllMessageGroups(chatFrame);
Zerotorescue@0 56 MailOpener.debugChannel = chatFrame;
Zerotorescue@0 57
Zerotorescue@0 58 print("New debug channel created.");
Zerotorescue@0 59 end
Zerotorescue@0 60 else
Zerotorescue@0 61 print("Wrong command, available: /mo config (or /mo c)");
Zerotorescue@0 62 end
Zerotorescue@0 63 end
Zerotorescue@0 64
Zerotorescue@0 65 function Config:Load()
Zerotorescue@0 66 if not AceConfigDialog then
Zerotorescue@0 67 local options = self:GetOptions();
Zerotorescue@0 68
Zerotorescue@0 69 -- Build options dialog
Zerotorescue@0 70 AceConfigDialog = LibStub("AceConfigDialog-3.0");
Zerotorescue@0 71 -- Register options table
Zerotorescue@0 72 LibStub("AceConfig-3.0"):RegisterOptionsTable("Mail Opener", options);
Zerotorescue@0 73 -- Set a nice default size
Zerotorescue@0 74 AceConfigDialog:SetDefaultSize("Mail Opener", 950, 600);
Zerotorescue@0 75
Zerotorescue@0 76 -- In case the addon is loaded from another condition, always call the remove interface options
Zerotorescue@0 77 if AddonLoader and AddonLoader.RemoveInterfaceOptions then
Zerotorescue@0 78 AddonLoader:RemoveInterfaceOptions("Mail Opener");
Zerotorescue@0 79 end
Zerotorescue@0 80
Zerotorescue@0 81 -- Add to the blizzard addons options thing
Zerotorescue@0 82 AceConfigDialog:AddToBlizOptions("Mail Opener");
Zerotorescue@0 83 end
Zerotorescue@0 84 end
Zerotorescue@0 85
Zerotorescue@0 86 function Config:Show()
Zerotorescue@0 87 self:Load();
Zerotorescue@0 88
Zerotorescue@0 89 AceConfigDialog:Open("Mail Opener");
Zerotorescue@0 90 end
Zerotorescue@0 91
Zerotorescue@0 92 function Config:GetOptions()
Zerotorescue@0 93 local options = {
Zerotorescue@0 94 type = "group",
Zerotorescue@0 95 name = "Mail Opener",
Zerotorescue@0 96 childGroups = "tree",
Zerotorescue@0 97 args = {
Zerotorescue@0 98 },
Zerotorescue@0 99 };
Zerotorescue@0 100
Zerotorescue@0 101 options.args.general = self:GetGeneralOptions();
Zerotorescue@0 102
Zerotorescue@0 103 options.args.notifications = self:GetNotificationsOptions();
Zerotorescue@0 104
Zerotorescue@0 105 options = self:GetModuleOptions(options);
Zerotorescue@0 106
Zerotorescue@0 107 options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(MailOpener.db, true);
Zerotorescue@0 108 options.args.profiles.order = 1000; -- we want this as last group
Zerotorescue@0 109
Zerotorescue@0 110 return options;
Zerotorescue@0 111 end
Zerotorescue@0 112
Zerotorescue@0 113 function Config:GetModuleOptions(options)
Zerotorescue@0 114 for name, module in MailOpener:IterateModules() do
Zerotorescue@0 115 if module.GetOptionsGroup then
Zerotorescue@0 116 options.args[name] = module:GetOptionsGroup();
Zerotorescue@0 117 end
Zerotorescue@0 118 end
Zerotorescue@0 119
Zerotorescue@0 120 return options;
Zerotorescue@0 121 end
Zerotorescue@0 122
Zerotorescue@0 123 function Config:GetGeneralOptions()
Zerotorescue@0 124 local generalConfigGroup = {
Zerotorescue@0 125 order = 100,
Zerotorescue@0 126 type = "group",
Zerotorescue@0 127 name = "General",
Zerotorescue@0 128 desc = "Change general Mail Opener settings.",
Zerotorescue@0 129 args = {
Zerotorescue@0 130 -- General config inline group
Zerotorescue@0 131 generalConfig = {
Zerotorescue@0 132 order = 10,
Zerotorescue@0 133 type = "group",
Zerotorescue@0 134 inline = true,
Zerotorescue@0 135 name = "General",
Zerotorescue@0 136 args = {
Zerotorescue@0 137 defaultStatus = {
Zerotorescue@0 138 order = 0,
Zerotorescue@0 139 type = "select",
Zerotorescue@0 140 name = "Default mail opener status",
Zerotorescue@0 141 desc = "Select the default Mail Opener status when you open a mailbox for the first time since your log on.",
Zerotorescue@0 142 values = {
Zerotorescue@4 143 _enabled = "Completely enabled",
Zerotorescue@4 144 disabled = "Auto opening disabled",
Zerotorescue@4 145 xdisabled = "Addon Disabled",
Zerotorescue@0 146 },
Zerotorescue@0 147 get = function() return MailOpener.db.profile.general.defaultStatus; end,
Zerotorescue@0 148 set = function(i, v) MailOpener.db.profile.general.defaultStatus = v; end,
Zerotorescue@0 149 },
Zerotorescue@0 150 defaultQAStatus = {
Zerotorescue@0 151 order = 10,
Zerotorescue@0 152 type = "select",
Zerotorescue@0 153 name = "Default QA Auto Mail status",
Zerotorescue@0 154 desc = "Select the default Quick Auctions auto mail status whenever you open a mailbox.",
Zerotorescue@0 155 values = {
Zerotorescue@0 156 __remember = "Remember",
Zerotorescue@0 157 _enabled = "Enabled",
Zerotorescue@0 158 disabled = "Disabled",
Zerotorescue@0 159 },
Zerotorescue@0 160 get = function() return MailOpener.db.profile.general.defaultQAStatus; end,
Zerotorescue@0 161 set = function(i, v) MailOpener.db.profile.general.defaultQAStatus = v; end,
Zerotorescue@0 162 hidden = (not MailOpener.QuickAuctionsEnabled),
Zerotorescue@0 163 },
Zerotorescue@0 164 continueOpeningStackableItems = {
Zerotorescue@0 165 order = 15,
Zerotorescue@0 166 type = "toggle",
Zerotorescue@0 167 name = "Continue trying to open mail after your bags are full",
Zerotorescue@0 168 desc = "If there are a lot of stackable items in your mailbox (e.g. glyphs) you may want to toggle this option on.\n\nThis will cause your Blizzard error frame to get extremely spammy if there are many mails remaining. With this disabled, Mail Opener will completely stop opening mail while your inventory is full.",
Zerotorescue@0 169 width = "full",
Zerotorescue@0 170 get = function() return MailOpener.db.profile.general.continueOpeningStackableItems; end,
Zerotorescue@0 171 set = function(i, v) MailOpener.db.profile.general.continueOpeningStackableItems = v; end,
Zerotorescue@0 172 },
Zerotorescue@0 173 autoDisableQAAutoMail = {
Zerotorescue@0 174 order = 20,
Zerotorescue@0 175 type = "toggle",
Zerotorescue@0 176 name = "Turn Quick Auction's auto mailing |cffff0000off|r when opening mail",
Zerotorescue@0 177 desc = "Quick Auction's auto mailing is buggy when using other mail opening addons. If you are collecting mail while auto mailer is enabled wrong items may be send to the wrong character.\n\nTo solve this you must disable Quick Auction's auto mail while opening mail and you can re-enable it when mail opening is finished.",
Zerotorescue@0 178 width = "full",
Zerotorescue@0 179 get = function() return MailOpener.db.profile.general.autoDisableQAAutoMail; end,
Zerotorescue@0 180 set = function(i, v) MailOpener.db.profile.general.autoDisableQAAutoMail = v; end,
Zerotorescue@0 181 hidden = (not MailOpener.QuickAuctionsEnabled),
Zerotorescue@0 182 },
Zerotorescue@0 183 autoReenableQAAutoMail = {
Zerotorescue@0 184 order = 30,
Zerotorescue@0 185 type = "toggle",
Zerotorescue@0 186 name = "Turn Quick Auction's auto mailing |cff00ff00on|r after opening mail has finished",
Zerotorescue@0 187 desc = "Quick Auction's auto mailing is buggy when using other mail opening addons. If you are collecting mail while auto mailer is enabled wrong items may be send to the wrong character.\n\nTo solve this you must disable Quick Auction's auto mail while opening mail and you can re-enable it when mail opening is finished.",
Zerotorescue@0 188 width = "full",
Zerotorescue@0 189 get = function() return MailOpener.db.profile.general.autoReenableQAAutoMail; end,
Zerotorescue@0 190 set = function(i, v) MailOpener.db.profile.general.autoReenableQAAutoMail = v; end,
Zerotorescue@0 191 hidden = (not MailOpener.QuickAuctionsEnabled),
Zerotorescue@0 192 disabled = function() return (MailOpener.db.profile.general.autoSetBackQAAutoMail and not MailOpener.db.profile.general.autoReenableQAAutoMail); end,
Zerotorescue@0 193 },
Zerotorescue@0 194 autoSetBackQAAutoMail = {
Zerotorescue@0 195 order = 40,
Zerotorescue@0 196 type = "toggle",
Zerotorescue@0 197 name = "Set Quick Auction's auto mailing |cff00ffffback|r after opening mail has finished (remember it)",
Zerotorescue@0 198 desc = "Instead of always turning Quick Auction's auto mail on after mail opening you can choose to set it back to the value it was prior to opening mail.",
Zerotorescue@0 199 width = "full",
Zerotorescue@0 200 get = function() return MailOpener.db.profile.general.autoSetBackQAAutoMail; end,
Zerotorescue@0 201 set = function(i, v) MailOpener.db.profile.general.autoSetBackQAAutoMail = v; end,
Zerotorescue@0 202 hidden = (not MailOpener.QuickAuctionsEnabled),
Zerotorescue@0 203 disabled = function() return (MailOpener.db.profile.general.autoReenableQAAutoMail and not MailOpener.db.profile.general.autoSetBackQAAutoMail); end,
Zerotorescue@0 204 },
Zerotorescue@0 205 },
Zerotorescue@0 206 }, -- end General config inline group
Zerotorescue@0 207 -- Profile config inline group
Zerotorescue@0 208 profileConfig = {
Zerotorescue@0 209 order = 15,
Zerotorescue@0 210 type = "group",
Zerotorescue@0 211 inline = true,
Zerotorescue@0 212 name = "New Character Specfic Profile",
Zerotorescue@0 213 args = {
Zerotorescue@0 214 description = {
Zerotorescue@0 215 order = 10,
Zerotorescue@0 216 type = "description",
Zerotorescue@0 217 name = "You can create a new profile to allow different behaviour for different characters. Imagine setting up a profile for your AH banker which will retrieve all sorts of mail containing items while other characters don't automatically open mail with items sent by other players.",
Zerotorescue@0 218 },
Zerotorescue@0 219 header = {
Zerotorescue@0 220 order = 15,
Zerotorescue@0 221 type = "header",
Zerotorescue@0 222 name = "",
Zerotorescue@0 223 },
Zerotorescue@0 224 createNewProfile = {
Zerotorescue@0 225 order = 20,
Zerotorescue@0 226 type = "execute",
Zerotorescue@0 227 name = "Create a new character specific profile",
Zerotorescue@0 228 desc = "Create a new profile for this user. You can also make profile groups at the profiles tab to the left.",
Zerotorescue@0 229 width = "double",
Zerotorescue@0 230 func = function()
Zerotorescue@0 231 MailOpener.db:SetProfile(UnitName("player") .. " - " .. GetRealmName());
Zerotorescue@0 232 end,
Zerotorescue@0 233 },
Zerotorescue@0 234 },
Zerotorescue@0 235 }, -- end Profile config inline group
Zerotorescue@0 236 },
Zerotorescue@0 237 };
Zerotorescue@0 238
Zerotorescue@0 239 return generalConfigGroup;
Zerotorescue@0 240 end
Zerotorescue@0 241
Zerotorescue@0 242 function Config:GetNotificationsOptions()
Zerotorescue@0 243 local notificationsConfigGroup = {
Zerotorescue@0 244 order = 200,
Zerotorescue@0 245 type = "group",
Zerotorescue@0 246 name = "Notifications",
Zerotorescue@0 247 desc = "Toggle notifications.",
Zerotorescue@0 248 args = {
Zerotorescue@0 249 -- Notifications config inline group
Zerotorescue@0 250 nofitications = {
Zerotorescue@0 251 order = 10,
Zerotorescue@0 252 type = "group",
Zerotorescue@0 253 inline = true,
Zerotorescue@0 254 name = "Notifications",
Zerotorescue@0 255 args = {
Zerotorescue@0 256 description = {
Zerotorescue@0 257 order = 10,
Zerotorescue@0 258 type = "description",
Zerotorescue@0 259 name = "Toggle which notification you wish to see.",
Zerotorescue@0 260 },
Zerotorescue@0 261 },
Zerotorescue@0 262 }, -- end Notifications config inline group
Zerotorescue@0 263
Zerotorescue@0 264 -- General Notifications config inline group
Zerotorescue@0 265 general = {
Zerotorescue@0 266 order = 20,
Zerotorescue@0 267 type = "group",
Zerotorescue@0 268 inline = true,
Zerotorescue@0 269 name = "General Notifications",
Zerotorescue@0 270 args = {
Zerotorescue@0 271 welcome = {
Zerotorescue@0 272 order = 20,
Zerotorescue@0 273 type = "toggle",
Zerotorescue@0 274 name = "Show message when |cfffed000opening the mailbox|r",
Zerotorescue@0 275 desc = "Print the welcome message whenever you open the mailbox.",
Zerotorescue@0 276 set = function(i, v) MailOpener.db.profile.notifications.welcome = v; end,
Zerotorescue@0 277 get = function() return MailOpener.db.profile.notifications.welcome; end,
Zerotorescue@0 278 width = "double",
Zerotorescue@0 279 },
Zerotorescue@0 280 bye = {
Zerotorescue@0 281 order = 21,
Zerotorescue@0 282 type = "toggle",
Zerotorescue@0 283 name = "Show message when |cfffed000closing the mailbox|r",
Zerotorescue@0 284 desc = "Print the bye message whenever you close the mailbox.",
Zerotorescue@0 285 set = function(i, v) MailOpener.db.profile.notifications.bye = v; end,
Zerotorescue@0 286 get = function() return MailOpener.db.profile.notifications.bye; end,
Zerotorescue@0 287 width = "double",
Zerotorescue@0 288 },
Zerotorescue@0 289 fishedOpeningBatch = {
Zerotorescue@0 290 order = 22,
Zerotorescue@0 291 type = "toggle",
Zerotorescue@0 292 name = "Announce when |cfffed000finished opening the current batch|r",
Zerotorescue@0 293 desc = "Announce when opening of the current batch of mails has been completed.",
Zerotorescue@0 294 set = function(i, v) MailOpener.db.profile.notifications.finishedCurrentBatch = v; end,
Zerotorescue@0 295 get = function() return MailOpener.db.profile.notifications.finishedCurrentBatch; end,
Zerotorescue@0 296 width = "double",
Zerotorescue@0 297 },
Zerotorescue@0 298 noMoreMailAvailable = {
Zerotorescue@0 299 order = 23,
Zerotorescue@0 300 type = "toggle",
Zerotorescue@0 301 name = "Announce when |cfffed000the mailbox is completely empty|r",
Zerotorescue@0 302 desc = "Announce when there is nothing left for Mail Opener to open.",
Zerotorescue@0 303 set = function(i, v) MailOpener.db.profile.notifications.mailboxIsEmpty = v; end,
Zerotorescue@0 304 get = function() return MailOpener.db.profile.notifications.mailboxIsEmpty; end,
Zerotorescue@0 305 width = "double",
Zerotorescue@0 306 },
Zerotorescue@0 307 },
Zerotorescue@0 308 }, -- end General Notifications config inline group
Zerotorescue@0 309
Zerotorescue@0 310 -- Mail Skipped Notifications config inline group
Zerotorescue@0 311 mailSkipped = {
Zerotorescue@0 312 order = 30,
Zerotorescue@0 313 type = "group",
Zerotorescue@0 314 inline = true,
Zerotorescue@0 315 name = "Mail Skipped Notifications",
Zerotorescue@0 316 args = {
Zerotorescue@0 317 descriptionMailSkipped = {
Zerotorescue@0 318 order = 31,
Zerotorescue@0 319 type = "description",
Zerotorescue@0 320 name = "Announce when mail is skipped because...",
Zerotorescue@0 321 },
Zerotorescue@0 322
Zerotorescue@0 323 skippedToggleAll = {
Zerotorescue@0 324 order = 35,
Zerotorescue@0 325 type = "toggle",
Zerotorescue@0 326 name = "Toggle everything",
Zerotorescue@0 327 desc = "Announce when mail is skipped for |cfffed000any|r reason.",
Zerotorescue@0 328 set = function(i, v) MailOpener.db.profile.notifications.skipped.all = v; end,
Zerotorescue@0 329 get = function() return MailOpener.db.profile.notifications.skipped.all; end,
Zerotorescue@0 330 },
Zerotorescue@0 331 skippedInventoryFull = {
Zerotorescue@0 332 order = 36,
Zerotorescue@0 333 type = "toggle",
Zerotorescue@0 334 name = "Your inventory is full",
Zerotorescue@0 335 desc = "Announce when mail is skipped because |cfffed000your inventory is full|r.",
Zerotorescue@0 336 set = function(i, v) MailOpener.db.profile.notifications.skipped.inventoryFull = v; end,
Zerotorescue@0 337 get = function() return MailOpener.db.profile.notifications.skipped.inventoryFull; end,
Zerotorescue@0 338 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end,
Zerotorescue@0 339 },
Zerotorescue@0 340 skippedKeepFreeSpaceLimit = {
Zerotorescue@0 341 order = 37,
Zerotorescue@0 342 type = "toggle",
Zerotorescue@0 343 name = "Keep free space limit reached",
Zerotorescue@0 344 desc = "Announce when mail is skipped because |cfffed000the keep free space limit has been reached|r.",
Zerotorescue@0 345 set = function(i, v) MailOpener.db.profile.notifications.skipped.keepFreeSpaceLimit = v; end,
Zerotorescue@0 346 get = function() return MailOpener.db.profile.notifications.skipped.keepFreeSpaceLimit; end,
Zerotorescue@0 347 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end,
Zerotorescue@0 348 },
Zerotorescue@0 349 skippedGMMail = {
Zerotorescue@0 350 order = 38,
Zerotorescue@0 351 type = "toggle",
Zerotorescue@0 352 name = "GM mail",
Zerotorescue@0 353 desc = "Announce when mail is skipped because it's |cfffed000mail sent by a Game Master|r.",
Zerotorescue@0 354 set = function(i, v) MailOpener.db.profile.notifications.skipped.GMMail = v; end,
Zerotorescue@0 355 get = function() return MailOpener.db.profile.notifications.skipped.GMMail; end,
Zerotorescue@0 356 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end,
Zerotorescue@0 357 },
Zerotorescue@0 358 skippedCOD = {
Zerotorescue@0 359 order = 39,
Zerotorescue@0 360 type = "toggle",
Zerotorescue@0 361 name = "C.O.D. mail",
Zerotorescue@0 362 desc = "Announce when mail is skipped because it's |cfffed000a Cost On Delivery mail|r.",
Zerotorescue@0 363 set = function(i, v) MailOpener.db.profile.notifications.skipped.COD = v; end,
Zerotorescue@0 364 get = function() return MailOpener.db.profile.notifications.skipped.COD; end,
Zerotorescue@0 365 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end,
Zerotorescue@0 366 },
Zerotorescue@0 367 skippedNormalGoldMail = {
Zerotorescue@0 368 order = 40,
Zerotorescue@0 369 type = "toggle",
Zerotorescue@0 370 name = "Normal mail with gold",
Zerotorescue@0 371 desc = "Announce when mail is skipped because it's |cfffed000normal mail containing gold|r.",
Zerotorescue@0 372 set = function(i, v) MailOpener.db.profile.notifications.skipped.normalGoldMail = v; end,
Zerotorescue@0 373 get = function() return MailOpener.db.profile.notifications.skipped.normalGoldMail; end,
Zerotorescue@0 374 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end,
Zerotorescue@0 375 },
Zerotorescue@0 376 skippedNormalItemsMail = {
Zerotorescue@0 377 order = 41,
Zerotorescue@0 378 type = "toggle",
Zerotorescue@0 379 name = "Normal mail with attachments",
Zerotorescue@0 380 desc = "Announce when mail is skipped because it's |cfffed000normal mail containing items|r.",
Zerotorescue@0 381 set = function(i, v) MailOpener.db.profile.notifications.skipped.normalItemsMail = v; end,
Zerotorescue@0 382 get = function() return MailOpener.db.profile.notifications.skipped.normalItemsMail; end,
Zerotorescue@0 383 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end,
Zerotorescue@0 384 },
Zerotorescue@0 385 skippedAHExpired = {
Zerotorescue@0 386 order = 42,
Zerotorescue@0 387 type = "toggle",
Zerotorescue@0 388 name = "Auction expired mail",
Zerotorescue@0 389 desc = "Announce when mail is skipped because it's |cfffed000auction expired mail|r.",
Zerotorescue@0 390 set = function(i, v) MailOpener.db.profile.notifications.skipped.AHexpired = v; end,
Zerotorescue@0 391 get = function() return MailOpener.db.profile.notifications.skipped.AHexpired; end,
Zerotorescue@0 392 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end,
Zerotorescue@0 393 },
Zerotorescue@0 394 skippedAHSuccessful = {
Zerotorescue@0 395 order = 43,
Zerotorescue@0 396 type = "toggle",
Zerotorescue@0 397 name = "Auction successful mail",
Zerotorescue@0 398 desc = "Announce when mail is skipped because it's |cfffed000auction successful mail|r.",
Zerotorescue@0 399 set = function(i, v) MailOpener.db.profile.notifications.skipped.AHsuccess = v; end,
Zerotorescue@0 400 get = function() return MailOpener.db.profile.notifications.skipped.AHsuccess; end,
Zerotorescue@0 401 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end,
Zerotorescue@0 402 },
Zerotorescue@0 403 skippedAHWon = {
Zerotorescue@0 404 order = 44,
Zerotorescue@0 405 type = "toggle",
Zerotorescue@0 406 name = "Auction won mail",
Zerotorescue@0 407 desc = "Announce when mail is skipped because it's |cfffed000auction won mail|r.",
Zerotorescue@0 408 set = function(i, v) MailOpener.db.profile.notifications.skipped.AHwon = v; end,
Zerotorescue@0 409 get = function() return MailOpener.db.profile.notifications.skipped.AHwon; end,
Zerotorescue@0 410 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end,
Zerotorescue@0 411 },
Zerotorescue@0 412 skippedAHCanceled = {
Zerotorescue@0 413 order = 45,
Zerotorescue@0 414 type = "toggle",
Zerotorescue@0 415 name = "Auction canceled mail",
Zerotorescue@0 416 desc = "Announce when mail is skipped because it's |cfffed000auction canceled mail|r.",
Zerotorescue@0 417 set = function(i, v) MailOpener.db.profile.notifications.skipped.AHcanceled = v; end,
Zerotorescue@0 418 get = function() return MailOpener.db.profile.notifications.skipped.AHcanceled; end,
Zerotorescue@0 419 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end,
Zerotorescue@0 420 },
Zerotorescue@0 421 skippedAHOutbid = {
Zerotorescue@0 422 order = 46,
Zerotorescue@0 423 type = "toggle",
Zerotorescue@0 424 name = "Auction outbid mail",
Zerotorescue@0 425 desc = "Announce when mail is skipped because it's |cfffed000auction outbid mail|r.",
Zerotorescue@0 426 set = function(i, v) MailOpener.db.profile.notifications.skipped.AHoutbid = v; end,
Zerotorescue@0 427 get = function() return MailOpener.db.profile.notifications.skipped.AHoutbid; end,
Zerotorescue@0 428 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end,
Zerotorescue@0 429 },
Zerotorescue@0 430 skippedOther = {
Zerotorescue@0 431 order = 47,
Zerotorescue@0 432 type = "toggle",
Zerotorescue@0 433 name = "Other mail (e.g. plain text)",
Zerotorescue@0 434 desc = "Announce when mail is skipped because it's |cfffed000any other kind of mail|r (e.g. plain text).",
Zerotorescue@0 435 set = function(i, v) MailOpener.db.profile.notifications.skipped.other = v; end,
Zerotorescue@0 436 get = function() return MailOpener.db.profile.notifications.skipped.other; end,
Zerotorescue@0 437 disabled = function() return (not MailOpener.db.profile.notifications.skipped.all); end,
Zerotorescue@0 438 },
Zerotorescue@0 439 },
Zerotorescue@0 440 }, -- end Mail Skipped Notifications config inline group
Zerotorescue@0 441
Zerotorescue@0 442 -- Mail Processed Notifications config inline group
Zerotorescue@0 443 mailProcessed = {
Zerotorescue@0 444 order = 40,
Zerotorescue@0 445 type = "group",
Zerotorescue@0 446 inline = true,
Zerotorescue@0 447 name = "Mail Processed Notifications",
Zerotorescue@0 448 args = {
Zerotorescue@0 449 descriptionMailProcessed = {
Zerotorescue@0 450 order = 61,
Zerotorescue@0 451 type = "description",
Zerotorescue@0 452 name = "Announce when mail is processed because...",
Zerotorescue@0 453 },
Zerotorescue@0 454
Zerotorescue@0 455 processedToggleAll = {
Zerotorescue@0 456 order = 65,
Zerotorescue@0 457 type = "toggle",
Zerotorescue@0 458 name = "Toggle everything",
Zerotorescue@0 459 desc = "Announce when mail is processed for |cfffed000any|r reason.",
Zerotorescue@0 460 set = function(i, v) MailOpener.db.profile.notifications.processed.all = v; end,
Zerotorescue@0 461 get = function() return MailOpener.db.profile.notifications.processed.all; end,
Zerotorescue@0 462 },
Zerotorescue@0 463 processedNormalGoldMail = {
Zerotorescue@0 464 order = 70,
Zerotorescue@0 465 type = "toggle",
Zerotorescue@0 466 name = "Normal mail with gold",
Zerotorescue@0 467 desc = "Announce when mail is processed because it's |cfffed000normal mail containing gold|r.",
Zerotorescue@0 468 set = function(i, v) MailOpener.db.profile.notifications.processed.normalGoldMail = v; end,
Zerotorescue@0 469 get = function() return MailOpener.db.profile.notifications.processed.normalGoldMail; end,
Zerotorescue@0 470 disabled = function() return (not MailOpener.db.profile.notifications.processed.all); end,
Zerotorescue@0 471 },
Zerotorescue@0 472 processedNormalItemsMail = {
Zerotorescue@0 473 order = 71,
Zerotorescue@0 474 type = "toggle",
Zerotorescue@0 475 name = "Normal mail with attachments",
Zerotorescue@0 476 desc = "Announce when mail is processed because it's |cfffed000normal mail containing items|r.",
Zerotorescue@0 477 set = function(i, v) MailOpener.db.profile.notifications.processed.normalItemsMail = v; end,
Zerotorescue@0 478 get = function() return MailOpener.db.profile.notifications.processed.normalItemsMail; end,
Zerotorescue@0 479 disabled = function() return (not MailOpener.db.profile.notifications.processed.all); end,
Zerotorescue@0 480 },
Zerotorescue@0 481 processedAHExpired = {
Zerotorescue@0 482 order = 72,
Zerotorescue@0 483 type = "toggle",
Zerotorescue@0 484 name = "Auction expired mail",
Zerotorescue@0 485 desc = "Announce when mail is processed because it's |cfffed000auction expired mail|r.",
Zerotorescue@0 486 set = function(i, v) MailOpener.db.profile.notifications.processed.AHexpired = v; end,
Zerotorescue@0 487 get = function() return MailOpener.db.profile.notifications.processed.AHexpired; end,
Zerotorescue@0 488 disabled = function() return (not MailOpener.db.profile.notifications.processed.all); end,
Zerotorescue@0 489 },
Zerotorescue@0 490 processedAHSuccessful = {
Zerotorescue@0 491 order = 73,
Zerotorescue@0 492 type = "toggle",
Zerotorescue@0 493 name = "Auction successful mail",
Zerotorescue@0 494 desc = "Announce when mail is processed because it's |cfffed000auction successful mail|r.",
Zerotorescue@0 495 set = function(i, v) MailOpener.db.profile.notifications.processed.AHsuccess = v; end,
Zerotorescue@0 496 get = function() return MailOpener.db.profile.notifications.processed.AHsuccess; end,
Zerotorescue@0 497 disabled = function() return (not MailOpener.db.profile.notifications.processed.all); end,
Zerotorescue@0 498 },
Zerotorescue@0 499 processedAHWon = {
Zerotorescue@0 500 order = 74,
Zerotorescue@0 501 type = "toggle",
Zerotorescue@0 502 name = "Auction won mail",
Zerotorescue@0 503 desc = "Announce when mail is processed because it's |cfffed000auction won mail|r.",
Zerotorescue@0 504 set = function(i, v) MailOpener.db.profile.notifications.processed.AHwon = v; end,
Zerotorescue@0 505 get = function() return MailOpener.db.profile.notifications.processed.AHwon; end,
Zerotorescue@0 506 disabled = function() return (not MailOpener.db.profile.notifications.processed.all); end,
Zerotorescue@0 507 },
Zerotorescue@0 508 processedAHCanceled = {
Zerotorescue@0 509 order = 75,
Zerotorescue@0 510 type = "toggle",
Zerotorescue@0 511 name = "Auction canceled mail",
Zerotorescue@0 512 desc = "Announce when mail is processed because it's |cfffed000auction canceled mail|r.",
Zerotorescue@0 513 set = function(i, v) MailOpener.db.profile.notifications.processed.AHcanceled = v; end,
Zerotorescue@0 514 get = function() return MailOpener.db.profile.notifications.processed.AHcanceled; end,
Zerotorescue@0 515 disabled = function() return (not MailOpener.db.profile.notifications.processed.all); end,
Zerotorescue@0 516 },
Zerotorescue@0 517 processedAHOutbid = {
Zerotorescue@0 518 order = 76,
Zerotorescue@0 519 type = "toggle",
Zerotorescue@0 520 name = "Auction outbid mail",
Zerotorescue@0 521 desc = "Announce when mail is processed because it's |cfffed000auction outbid mail|r.",
Zerotorescue@0 522 set = function(i, v) MailOpener.db.profile.notifications.processed.AHoutbid = v; end,
Zerotorescue@0 523 get = function() return MailOpener.db.profile.notifications.processed.AHoutbid; end,
Zerotorescue@0 524 disabled = function() return (not MailOpener.db.profile.notifications.processed.all); end,
Zerotorescue@0 525 },
Zerotorescue@0 526 processedOther = {
Zerotorescue@0 527 order = 77,
Zerotorescue@0 528 type = "toggle",
Zerotorescue@0 529 name = "Other mail (e.g. plain text)",
Zerotorescue@0 530 desc = "Announce when mail is processed because it's |cfffed000any other kind of mail|r (e.g. plain text).",
Zerotorescue@0 531 set = function(i, v) MailOpener.db.profile.notifications.processed.other = v; end,
Zerotorescue@0 532 get = function() return MailOpener.db.profile.notifications.processed.other; end,
Zerotorescue@0 533 disabled = function() return (not MailOpener.db.profile.notifications.processed.all); end,
Zerotorescue@0 534 },
Zerotorescue@0 535 },
Zerotorescue@0 536 }, -- end Mail Processed Notifications config inline group
Zerotorescue@0 537
Zerotorescue@0 538 -- Sound Notifications config inline group
Zerotorescue@0 539 sound = {
Zerotorescue@0 540 order = 50,
Zerotorescue@0 541 type = "group",
Zerotorescue@0 542 inline = true,
Zerotorescue@0 543 name = "Sound Notifications",
Zerotorescue@0 544 args = {
Zerotorescue@0 545 bagsFullSound = {
Zerotorescue@0 546 order = 100,
Zerotorescue@0 547 type = "toggle",
Zerotorescue@0 548 name = "Play a sound when your |cfffed000inventory is full|r",
Zerotorescue@0 549 desc = "Play a sound when your inventory is full. You can select what sound in the select box next to this.",
Zerotorescue@0 550 set = function(i, v) MailOpener.db.profile.notifications.bagsFullSound = v; end,
Zerotorescue@0 551 get = function() return MailOpener.db.profile.notifications.bagsFullSound; end,
Zerotorescue@0 552 width = "double",
Zerotorescue@0 553 },
Zerotorescue@0 554 bagsFullSoundFile = {
Zerotorescue@0 555 order = 101,
Zerotorescue@0 556 type = "select",
Zerotorescue@0 557 name = "Sound File",
Zerotorescue@0 558 desc = "Sound file to play when your bags are full.",
Zerotorescue@0 559 dialogControl = "LSM30_Sound",
Zerotorescue@0 560 set = function(i, v)
Zerotorescue@0 561 MailOpener.db.profile.notifications.bagsFullSoundFile = Media:Fetch("sound", v);
Zerotorescue@0 562 MailOpener.db.profile.notifications.bagsFullSoundFileName = v;
Zerotorescue@0 563
Zerotorescue@0 564 PlaySoundFile(MailOpener.db.profile.notifications.bagsFullSoundFile);
Zerotorescue@0 565
Zerotorescue@0 566 print("|cff15ff00Mail Opener|r: You may have to increase the mail opening interval if this sound effect gets spammy. The recommended value is 10 seconds.");
Zerotorescue@0 567 end,
Zerotorescue@0 568 get = function() return MailOpener.db.profile.notifications.bagsFullSoundFileName end,
Zerotorescue@0 569 values = function () return (Media:HashTable("sound") or nil); end,
Zerotorescue@0 570 disabled = function() return (not MailOpener.db.profile.notifications.bagsFullSound); end,
Zerotorescue@0 571 },
Zerotorescue@0 572 bagsFullSoundOnlyOnce = {
Zerotorescue@0 573 order = 102,
Zerotorescue@0 574 type = "toggle",
Zerotorescue@0 575 name = "Only once",
Zerotorescue@0 576 desc = "Only play this sound once each time new mail has been arrived.",
Zerotorescue@0 577 set = function(i, v) MailOpener.db.profile.notifications.bagsFullSoundOnlyOnce = v; end,
Zerotorescue@0 578 get = function() return MailOpener.db.profile.notifications.bagsFullSoundOnlyOnce; end,
Zerotorescue@0 579 disabled = function() return (not MailOpener.db.profile.notifications.bagsFullSound); end,
Zerotorescue@0 580 },
Zerotorescue@0 581 mailboxEmptySound = {
Zerotorescue@0 582 order = 110,
Zerotorescue@0 583 type = "toggle",
Zerotorescue@0 584 name = "Play a sound when |cfffed000no more mail can be opened|r",
Zerotorescue@0 585 desc = "Play a sound when no more mail can be opened. You can select what sound in the select box next to this.",
Zerotorescue@0 586 set = function(i, v) MailOpener.db.profile.notifications.mailboxEmptySound = v; end,
Zerotorescue@0 587 get = function() return MailOpener.db.profile.notifications.mailboxEmptySound; end,
Zerotorescue@0 588 width = "double",
Zerotorescue@0 589 },
Zerotorescue@0 590 mailboxEmptySoundFile = {
Zerotorescue@0 591 order = 111,
Zerotorescue@0 592 type = "select",
Zerotorescue@0 593 name = "Sound File",
Zerotorescue@0 594 desc = "Sound file to play when Mail Opener can't open any more mail.",
Zerotorescue@0 595 dialogControl = "LSM30_Sound",
Zerotorescue@0 596 set = function(i, v)
Zerotorescue@0 597 MailOpener.db.profile.notifications.mailboxEmptySoundFile = Media:Fetch("sound", v);
Zerotorescue@0 598 MailOpener.db.profile.notifications.mailboxEmptySoundFileName = v;
Zerotorescue@0 599
Zerotorescue@0 600 PlaySoundFile(MailOpener.db.profile.notifications.mailboxEmptySoundFile);
Zerotorescue@0 601
Zerotorescue@0 602 print("|cff15ff00Mail Opener|r: You may have to increase the mail opening interval if this sound effect gets spammy. The recommended value is 10 seconds.");
Zerotorescue@0 603 end,
Zerotorescue@0 604 get = function() return MailOpener.db.profile.notifications.mailboxEmptySoundFileName end,
Zerotorescue@0 605 values = function () return (Media:HashTable("sound") or nil); end,
Zerotorescue@0 606 disabled = function() return (not MailOpener.db.profile.notifications.mailboxEmptySound); end,
Zerotorescue@0 607 },
Zerotorescue@0 608 mailboxEmptySoundOnlyOnce = {
Zerotorescue@0 609 order = 112,
Zerotorescue@0 610 type = "toggle",
Zerotorescue@0 611 name = "Only once",
Zerotorescue@0 612 desc = "Only play this sound once each time new mail has been arrived.",
Zerotorescue@0 613 set = function(i, v) MailOpener.db.profile.notifications.mailboxEmptySoundOnlyOnce = v; end,
Zerotorescue@0 614 get = function() return MailOpener.db.profile.notifications.mailboxEmptySoundOnlyOnce; end,
Zerotorescue@0 615 disabled = function() return (not MailOpener.db.profile.notifications.mailboxEmptySound); end,
Zerotorescue@0 616 },
Zerotorescue@0 617 },
Zerotorescue@0 618 }, -- end Sound Notifications config inline group
Zerotorescue@0 619 },
Zerotorescue@0 620 };
Zerotorescue@0 621
Zerotorescue@0 622 return notificationsConfigGroup;
Zerotorescue@0 623 end