Array of all IRCPlugins.
Array of custom settings to apply to plugins' own setting, in the string forms of "plugin.setting=value".
A copy of the program-wide CoreSettings.
true if no setting name mismatches occurred, false if it did.
1 @Settings static struct MyPluginSettings 2 { 3 @Enabler bool enabled; 4 5 string s; 6 int i; 7 float f; 8 bool b; 9 double d; 10 } 11 12 static final class MyPlugin : IRCPlugin 13 { 14 MyPluginSettings myPluginSettings; 15 16 override string name() @property const 17 { 18 return "myplugin"; 19 } 20 21 mixin IRCPluginImpl; 22 } 23 24 IRCPluginState state; 25 IRCPlugin plugin = new MyPlugin(state); 26 27 auto newSettings = 28 [ 29 `myplugin.s="abc def ghi"`, 30 "myplugin.i=42", 31 "myplugin.f=3.14", 32 "myplugin.b=true", 33 "myplugin.d=99.99", 34 ]; 35 36 cast(void)applyCustomSettings([ plugin ], newSettings, state.settings); 37 38 const ps = (cast(MyPlugin)plugin).myPluginSettings; 39 40 static if (__VERSION__ >= 2091) 41 { 42 import std.math : isClose; 43 } 44 else 45 { 46 import std.math : isClose = approxEqual; 47 } 48 49 import std.conv : to; 50 51 assert((ps.s == "abc def ghi"), ps.s); 52 assert((ps.i == 42), ps.i.to!string); 53 assert(isClose(ps.f, 3.14f), ps.f.to!string); 54 assert(ps.b); 55 assert(isClose(ps.d, 99.99), ps.d.to!string);
Changes a setting of a plugin, given both the names of the plugin and the setting, in string form.
This merely iterates the passed plugins and calls their IRCPlugin.setMemberByName
methods.