Fix naughty notifications

Commit d14d6959ea caused every notify() call to fail with 'attempt to
compare number with nil' because the default_preset table no longer exists.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2012-06-05 16:20:30 +02:00
parent 2ec6635adc
commit ab7788e2f5
1 changed files with 6 additions and 8 deletions

View File

@ -33,8 +33,6 @@ module("naughty")
-- Default: { "/usr/share/pixmaps/", }
-- @field icon_formats List of formats that will be checked by getIcon()
-- Default: { "png", "gif" }
-- @field default_preset Preset to be used by default.
-- Default: config.presets.normal
-- @field notify_callback Callback used to modify or reject notifications.
-- Default: nil
-- Example:
@ -75,10 +73,10 @@ config.presets = {
}
}
-- @name config.defaults
-- holds the default values for the parameters to @see notify(). These
-- can optionally be overridden by specifying a preset (@see config.presets)
-- @class table
--- Default values for the params to notify().
-- These can optionally be overridden by specifying a preset
-- @see config.presets
-- @see notify
config.defaults = {
timeout = 5,
text = "",
@ -292,7 +290,7 @@ function notify(args)
end
-- gather variables together
local preset = util.table.join(config.default_preset or {},
local preset = util.table.join(config.defaults or {},
args.preset or config.presets.normal or {})
local timeout = args.timeout or preset.timeout
local icon = args.icon or preset.icon
@ -505,7 +503,7 @@ end
-- Notify
if capi.dbus then
capi.dbus.connect_signal("org.freedesktop.Notifications", function (data, appname, replaces_id, icon, title, text, actions, hints, expire)
args = { preset = config.default_preset }
args = { }
if data.member == "Notify" then
if text ~= "" then
args.text = text