1
1
<?xml version =" 1.0" encoding =" iso-8859-1" ?>
2
2
<!DOCTYPE muclient >
3
- <!-- Saved on Monday, August 09, 2010, 10:29 AM -->
4
- <!-- MuClient version 4.56 -->
5
-
6
- <!-- Plugin "Config_Option_Changer" generated by Plugin Wizard -->
7
3
8
4
<muclient >
9
5
<plugin
13
9
language =" Lua"
14
10
purpose =" Changes options not available in GUI configuration"
15
11
date_written =" 2010-08-09 10:28:14"
12
+ date_modified =" 2010-08-10 09:50"
16
13
requires =" 4.50"
17
- version =" 1 .0"
14
+ version =" 2 .0"
18
15
>
19
16
<description trim =" y" >
20
17
<![CDATA[
@@ -63,9 +60,9 @@ boolean_options = {
63
60
default_trigger_expand_variables = { desc = 'New triggers: default to expand variables?' },
64
61
default_trigger_keep_evaluating = { desc = 'New triggers: default to keep evaluating?' },
65
62
default_trigger_ignore_case = { desc = 'New triggers: default to ignore case?' },
66
- do_not_add_macros_to_command_history = { desc = 'Do not add macros to command history?' },
67
- do_not_show_outstanding_lines = { desc = 'Do not show outstanding lines count?' },
68
- do_not_translate_iac_to_iac_iac = { desc = 'Do not translate IAC to IAC IAC?' },
63
+ do_not_add_macros_to_command_history = { desc = 'Add macros to command history?' , invert = true },
64
+ do_not_show_outstanding_lines = { desc = 'Show outstanding lines count?' , invert = true },
65
+ do_not_translate_iac_to_iac_iac = { desc = 'Translate IAC to IAC IAC?' , invert = true },
69
66
play_sounds_in_background = { desc = 'Play sounds in background?' },
70
67
send_keep_alives = { desc = 'Send keep-alives?' },
71
68
} -- end boolean_options
@@ -85,24 +82,41 @@ numeric_options = {
85
82
function edit_boolean_option (name)
86
83
local val = GetOption (name)
87
84
local info = boolean_options [name]
85
+
88
86
local default = 1 -- default to "Yes" button
89
87
90
88
-- if option not set, default to "No" button
91
- if val == 0 then
92
- default = 2
89
+ if (val == 0 and not info.invert) or
90
+ (val == 1 and info.invert) then
91
+ default = 2 -- default is "No" button
93
92
end -- if
94
93
95
94
-- what do they *really* want?
96
95
local response = utils.msgbox (info.desc, "Change option", "yesnocancel", "?", default )
97
96
97
+ -- if cancelled dialog, just return
98
+ if response == "cancel" then
99
+ return
100
+ end -- if cancelled
101
+
102
+ -- if inverted question, we invert the response meaning
103
+ local newval = 0
104
+
105
+ if info.invert then
106
+ if response == "no" then
107
+ newval = 1
108
+ end -- if
109
+ else
110
+ if response == "yes" then
111
+ newval = 1
112
+ end -- if
113
+ end -- if
114
+
98
115
-- notify if switched
99
- if response == "yes" and val == 0 then
100
- SetOption (name, 1)
101
- ColourNote ("cyan", "", "Option " .. name .. " changed to: Yes")
102
- elseif response == "no" and val == 1 then
103
- SetOption (name, 0)
104
- ColourNote ("cyan", "", "Option " .. name .. " changed to: No")
105
- end -- if
116
+ if val ~= newval then
117
+ SetOption (name, newval)
118
+ ColourNote ("cyan", "", "Option '" .. info.desc .. "' changed to: " .. response)
119
+ end -- if
106
120
107
121
end -- edit_boolean_option
108
122
@@ -112,10 +126,15 @@ function edit_alpha_option (name)
112
126
113
127
local response = utils.inputbox (info.desc, "Change option", val, "Courier", 9)
114
128
115
- -- if not cancelled, and value change, notify them
116
- if response and response ~= val then
129
+ -- if cancelled dialog, just return
130
+ if not response then
131
+ return
132
+ end -- cancelled
133
+
134
+ -- if value changed, notify them
135
+ if response ~= val then
117
136
SetAlphaOption (name, response)
118
- ColourNote ("cyan", "", string.format ("Option %s changed from '%s' to '%s'", name , val, response))
137
+ ColourNote ("cyan", "", string.format ("Option '%s' changed from '%s' to '%s'", info.desc , val, response))
119
138
end -- if
120
139
121
140
end -- edit_alpha_option
@@ -127,11 +146,12 @@ function edit_numeric_option (name)
127
146
local response = utils.inputbox (
128
147
string.format ("%s\r\n\r\nRange: %i to %i", info.desc, info.min, info.max),
129
148
"Change option", val, "Courier", 9)
130
-
149
+
150
+ -- if cancelled dialog, just return
131
151
if not response then
132
152
return
133
153
end -- cancelled
134
-
154
+
135
155
-- check numeric
136
156
n = tonumber (response)
137
157
@@ -152,7 +172,7 @@ function edit_numeric_option (name)
152
172
-- notify them if value changed
153
173
if n ~= val then
154
174
SetOption (name, n)
155
- ColourNote ("cyan", "", string.format ("Option %s changed from %i to %i", name , val, n))
175
+ ColourNote ("cyan", "", string.format ("Option '%s' changed from %i to %i", info.desc , val, n))
156
176
end -- if
157
177
158
178
end -- edit_numeric_option
@@ -176,7 +196,8 @@ function config_options (name, line, wildcards)
176
196
for k, v in pairs (boolean_options) do
177
197
local val = GetOption (k)
178
198
local yes_no = "Yes"
179
- if val == 0 then
199
+ if (val == 0 and not v.invert) or
200
+ (val == 1 and v.invert) then
180
201
yes_no = "No"
181
202
end -- if
182
203
if val then
0 commit comments