本文整理汇总了C#中wmib.config.SaveConfig方法的典型用法代码示例。如果您正苦于以下问题:C# config.SaveConfig方法的具体用法?C# config.SaveConfig怎么用?C# config.SaveConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wmib.config
的用法示例。
在下文中一共展示了config.SaveConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Hook_PRIV
public override void Hook_PRIV(config.channel channel, User invoker, string message)
{
chanLog(message, channel, invoker.Nick, invoker.Host);
if (message == "@logon")
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "admin"))
{
if (Module.GetConfig(channel, "Logging.Enabled", false))
{
core.irc._SlowQueue.DeliverMessage(messages.get("ChannelLogged", channel.Language), channel.Name);
return;
}
else
{
core.irc._SlowQueue.DeliverMessage(messages.get("LoggingOn", channel.Language), channel.Name);
Module.SetConfig(channel, "Logging.Enabled", true);
channel.SaveConfig();
return;
}
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == "@logoff")
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "admin"))
{
if (!Module.GetConfig(channel, "Logging.Enabled", false))
{
core.irc._SlowQueue.DeliverMessage(messages.get("LogsE1", channel.Language), channel.Name);
return;
}
else
{
Module.SetConfig(channel, "Logging.Enabled", false);
channel.SaveConfig();
core.irc._SlowQueue.DeliverMessage(messages.get("NotLogged", channel.Language), channel.Name);
return;
}
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
}
示例2: Hook_PRIV
//.........这里部分代码省略.........
RecentChanges rc = (RecentChanges)channel.RetrieveObject("RC");
if (rc != null)
{
rc.insertString(wiki, Page);
}
return;
}
else
{
core.irc._SlowQueue.DeliverMessage(messages.get("Feed3", channel.Language), channel.Name);
return;
}
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == config.CommandPrefix + "recentchanges-off")
{
if (channel.Users.IsApproved(invoker, "admin"))
{
if (!GetConfig(channel, "RC.Enabled", false))
{
core.irc._SlowQueue.DeliverMessage(messages.get("Feed6", channel.Language), channel.Name);
return;
}
else
{
core.irc._SlowQueue.DeliverMessage(messages.get("Feed7", channel.Language), channel.Name);
SetConfig(channel, "RC.Enabled", false);
channel.SaveConfig();
return;
}
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == config.CommandPrefix + "recentchanges-on")
{
if (channel.Users.IsApproved(invoker, "recentchanges-manage"))
{
if (GetConfig(channel, "RC.Enabled", false))
{
core.irc._SlowQueue.DeliverMessage(messages.get("Feed1", channel.Language), channel.Name);
return;
}
else
{
core.irc._SlowQueue.DeliverMessage(messages.get("Feed2", channel.Language), channel.Name);
SetConfig(channel, "RC.Enabled", true);
channel.SaveConfig();
config.Save();
return;
}
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
示例3: Hook_SetConfig
public override bool Hook_SetConfig(config.channel chan, User invoker, string config, string value)
{
switch (config)
{
case "recent-changes-template":
if (value != "null")
{
Module.SetConfig(chan, "RC.Template", value);
core.irc._SlowQueue.DeliverMessage(messages.get("configuresave", chan.Language, new List<string> { value, config }), chan);
chan.SaveConfig();
return true;
}
else
{
Module.SetConfig(chan, "RC.Template", "");
core.irc._SlowQueue.DeliverMessage(messages.get("configuresave", chan.Language, new List<string> { "null", config }), chan);
chan.SaveConfig();
return true;
}
}
return false;
}
示例4: Hook_PRIV
//.........这里部分代码省略.........
{
core.irc._SlowQueue.DeliverMessage(messages.get("infobot16", channel.Language), channel.Name);
return;
}
if (channel.shared != "local" && channel.shared != "")
{
core.irc._SlowQueue.DeliverMessage(messages.get("infobot15", channel.Language), channel.Name);
return;
}
else
{
if (message.Length <= "@infobot-share-trust+ ".Length)
{
core.irc._SlowQueue.DeliverMessage(messages.get("db6", channel.Language), channel.Name);
return;
}
string name = message.Substring("@infobot-share-trust+ ".Length);
config.channel guest = core.getChannel(name);
if (guest == null)
{
core.irc._SlowQueue.DeliverMessage(messages.get("db8", channel.Language), channel.Name);
return;
}
if (channel.SharedLinkedChan.Contains(guest))
{
core.irc._SlowQueue.DeliverMessage(messages.get("db14", channel.Language), channel.Name);
return;
}
core.irc._SlowQueue.DeliverMessage(messages.get("db1", channel.Language, new List<string> { name }), channel.Name);
lock (channel.SharedLinkedChan)
{
channel.SharedLinkedChan.Add(guest);
}
channel.SaveConfig();
return;
}
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message.StartsWith("@infobot-ignore- "))
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "trust"))
{
string item = message.Substring("@infobot-ignore+ ".Length);
if (item != "")
{
if (!channel.Infobot_IgnoredNames.Contains(item))
{
core.irc._SlowQueue.DeliverMessage(messages.get("infobot-ignore-found", channel.Language, new List<string> { item }), channel.Name);
return;
}
channel.Infobot_IgnoredNames.Remove(item);
core.irc._SlowQueue.DeliverMessage(messages.get("infobot-ignore-rm", channel.Language, new List<string> { item }), channel.Name);
channel.SaveConfig();
return;
}
}
else
{
if (!channel.suppress_warnings)
{
示例5: Hook_SetConfig
public override bool Hook_SetConfig(config.channel chan, User invoker, string config, string value)
{
bool _temp_a;
switch (config)
{
case "infobot-trim-white-space-in-name":
if (bool.TryParse(value, out _temp_a))
{
Module.SetConfig(chan, "Infobot.Trim-white-space-in-name", _temp_a);
core.irc._SlowQueue.DeliverMessage(messages.get("configuresave", chan.Language, new List<string> { value, config }), chan.Name);
chan.SaveConfig();
return true;
}
core.irc._SlowQueue.DeliverMessage(messages.get("configure-va", chan.Language, new List<string> { config, value }), chan.Name);
return true;
case "infobot-auto-complete":
if (bool.TryParse(value, out _temp_a))
{
Module.SetConfig(chan, "Infobot.auto-complete", _temp_a);
core.irc._SlowQueue.DeliverMessage(messages.get("configuresave", chan.Language, new List<string> { value, config }), chan.Name);
chan.SaveConfig();
return true;
}
core.irc._SlowQueue.DeliverMessage(messages.get("configure-va", chan.Language, new List<string> { config, value }), chan.Name);
return true;
case "infobot-sorted":
if (bool.TryParse(value, out _temp_a))
{
Module.SetConfig(chan, "Infobot.Sorted", _temp_a);
core.irc._SlowQueue.DeliverMessage(messages.get("configuresave", chan.Language, new List<string> { value, config }), chan.Name);
chan.SaveConfig();
return true;
}
core.irc._SlowQueue.DeliverMessage(messages.get("configure-va", chan.Language, new List<string> { config, value }), chan.Name);
return true;
case "infobot-help":
if (bool.TryParse(value, out _temp_a))
{
Module.SetConfig(chan, "Infobot.Help", _temp_a);
core.irc._SlowQueue.DeliverMessage(messages.get("configuresave", chan.Language, new List<string> { value, config }), chan.Name);
chan.SaveConfig();
return true;
}
core.irc._SlowQueue.DeliverMessage(messages.get("configure-va", chan.Language, new List<string> { config, value }), chan.Name);
return true;
case "infobot-case":
if (bool.TryParse(value, out _temp_a))
{
Module.SetConfig(chan, "Infobot.Case", _temp_a);
core.irc._SlowQueue.DeliverMessage(messages.get("configuresave", chan.Language, new List<string> { value, config }), chan.Name);
chan.SaveConfig();
infobot_core infobot = (infobot_core)chan.RetrieveObject("Infobot");
if (infobot != null)
{
infobot.Sensitive = _temp_a;
}
return true;
}
core.irc._SlowQueue.DeliverMessage(messages.get("configure-va", chan.Language, new List<string> { config, value }), chan.Name);
return true;
}
return false;
}
示例6: Hook_PRIV
public override void Hook_PRIV(config.channel channel, User invoker, string message)
{
if (channel.Name != RequestLabs.RequestCh)
{
return;
}
if (message == "@requests-off")
{
if (channel.Users.IsApproved(invoker.Nick, invoker.Host, "admin"))
{
if (!GetConfig(channel, "Requests.Enabled", false))
{
core.irc._SlowQueue.DeliverMessage("Requests are already disabled", channel.Name);
return;
}
else
{
core.irc._SlowQueue.DeliverMessage("Requests were disabled", channel.Name, IRC.priority.high);
SetConfig(channel, "Requests.Enabled", false);
channel.SaveConfig();
return;
}
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == "@requests-on")
{
if (channel.Users.IsApproved(invoker.Nick, invoker.Host, "admin"))
{
if (GetConfig(channel, "Requests.Enabled", false))
{
core.irc._SlowQueue.DeliverMessage("Requests system is already enabled", channel.Name);
return;
}
SetConfig(channel, "Requests.Enabled", true);
channel.SaveConfig();
core.irc._SlowQueue.DeliverMessage("Requests were enabled", channel.Name, IRC.priority.high);
return;
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == "@requests")
{
lock (Shell)
{
if (Shell.Count > 0 || Tools.Count > 0)
{
DisplayWaiting();
}
else
{
core.irc._SlowQueue.DeliverMessage("There are no shell requests waiting", RequestLabs.RequestCh);
}
}
return;
}
}
示例7: Hook_PRIV
public override void Hook_PRIV(config.channel channel, User invoker, string message)
{
WriteStatus(invoker.Nick, invoker.Host, channel.Name, item.Action.Talk);
if (message.StartsWith("@seen "))
{
if (GetConfig(channel, "Seen.Enabled", false))
{
string parameter = "";
if (message.Contains(" "))
{
parameter = message.Substring(message.IndexOf(" ") + 1);
}
if (parameter != "")
{
RetrieveStatus(parameter, channel, invoker.Nick);
return;
}
}
}
if (message.StartsWith("@seenrx "))
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "trust"))
{
if (GetConfig(channel, "Seen.Enabled", false))
{
string parameter = "";
if (message.Contains(" "))
{
parameter = message.Substring(message.IndexOf(" ") + 1);
}
if (parameter != "")
{
RegEx(parameter, channel, invoker.Nick);
return;
}
}
return;
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == "@seen-off")
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "admin"))
{
if (!GetConfig(channel, "Seen.Enabled", false))
{
core.irc._SlowQueue.DeliverMessage(messages.get("seen-e2", channel.Language), channel.Name);
return;
}
else
{
core.irc._SlowQueue.DeliverMessage(messages.get("seen-off", channel.Language), channel.Name, IRC.priority.high);
SetConfig(channel, "Seen.Enabled", false);
channel.SaveConfig();
return;
}
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == "@seen-on")
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "admin"))
{
if (GetConfig(channel, "Seen.Enabled", false))
{
core.irc._SlowQueue.DeliverMessage(messages.get("seen-oe", channel.Language), channel.Name);
return;
}
SetConfig(channel, "Seen.Enabled", true);
channel.SaveConfig();
core.irc._SlowQueue.DeliverMessage(messages.get("seen-on", channel.Language), channel.Name, IRC.priority.high);
return;
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
}
示例8: Hook_PRIV
public override void Hook_PRIV(config.channel channel, User invoker, string message)
{
if (message.StartsWith("@labs-off"))
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "admin"))
{
if (!GetConfig(channel, "LABS.Enabled", false))
{
core.irc._SlowQueue.DeliverMessage("Labs utilities are already disabled", channel.Name);
return;
}
SetConfig(channel, "LABS.Enabled", false);
channel.SaveConfig();
core.irc._SlowQueue.DeliverMessage("Labs utilities were disabled", channel.Name);
return;
}
else
{
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
}
return;
}
if (message.StartsWith("@labs-on"))
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "admin"))
{
if (GetConfig(channel, "LABS.Enabled", false))
{
core.irc._SlowQueue.DeliverMessage("Labs utilities are already enabled", channel.Name);
return;
}
SetConfig(channel, "LABS.Enabled", true);
channel.SaveConfig();
core.irc._SlowQueue.DeliverMessage("Labs utilities were enabled", channel.Name);
return;
}
else
{
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
}
return;
}
if (message.StartsWith("@labs-user "))
{
if (GetConfig(channel, "LABS.Enabled", false))
{
string user = message.Substring(11);
string result = getProjects(user);
int list = getNumbers(user);
if (result != "")
{
core.irc._SlowQueue.DeliverMessage(user + " is member of " + list.ToString() + " projects: " + result, channel.Name);
return;
}
core.irc._SlowQueue.DeliverMessage("That user is not a member of any project", channel.Name);
return;
}
}
if (message.StartsWith("@labs-info "))
{
if (GetConfig(channel, "LABS.Enabled", false))
{
string host = message.Substring("@labs-info ".Length);
string results = "";
if (!OK)
{
core.irc._SlowQueue.DeliverMessage("Please wait, I still didn't retrieve the labs datafile containing the list of instances", channel.Name);
return;
}
Instance instance = getInstance(host);
if (instance == null)
{
instance = resolve(host);
if (instance != null)
{
results = "[Name " + host + " doesn't exist but resolves to " + instance.OriginalName + "] ";
}
}
if (instance != null)
{
results += instance.OriginalName + " is Nova Instance with name: " + instance.Name + ", host: " + instance.Host + ", IP: " + instance.IP
+ " of type: " + instance.Type + ", with number of CPUs: " + instance.NumberOfCpu + ", RAM of this size: " + instance.Ram
+ "M, member of project: " + instance.Project + ", size of storage: " + instance.Storage + " and with image ID: " + instance.ImageID;
core.irc._SlowQueue.DeliverMessage(results, channel.Name);
return;
}
core.irc._SlowQueue.DeliverMessage("I don't know this instance, sorry, try browsing the list by hand, but I can guarantee there is no such instance matching this name, host or Nova ID unless it was created less than " + time().Seconds.ToString() + " seconds ago", channel.Name);
}
}
//.........这里部分代码省略.........
示例9: Hook_PRIV
public override void Hook_PRIV(config.channel channel, User invoker, string message)
{
if (Module.GetConfig(channel, "Statistics.Enabled", false))
{
Statistics st = (Statistics)channel.RetrieveObject("Statistics");
if (st != null)
{
st.Stat(invoker.Nick, message, invoker.Host);
}
}
if (message == "@statistics-off")
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "admin"))
{
if (!Module.GetConfig(channel, "Statistics.Enabled", false))
{
core.irc._SlowQueue.DeliverMessage(messages.get("StatE2", channel.Language), channel.Name);
return;
}
else
{
Module.SetConfig(channel, "Statistics.Enabled", false);
channel.SaveConfig();
core.irc._SlowQueue.DeliverMessage(messages.get("Stat-off", channel.Language), channel.Name);
return;
}
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == "@statistics-reset")
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "admin"))
{
Statistics st = (Statistics)channel.RetrieveObject("Statistics");
if (st != null)
{
st.Delete();
}
core.irc._SlowQueue.DeliverMessage(messages.get("Statdt", channel.Language), channel.Name);
return;
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == "@statistics-on")
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "admin"))
{
if (Module.GetConfig(channel, "Statistics.Enabled", false))
{
core.irc._SlowQueue.DeliverMessage(messages.get("StatE1", channel.Language), channel.Name);
return;
}
else
{
Module.SetConfig(channel, "Statistics.Enabled", true);
channel.SaveConfig();
core.irc._SlowQueue.DeliverMessage(messages.get("Stat-on", channel.Language), channel.Name);
return;
}
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
}
示例10: Hook_PRIV
//.........这里部分代码省略.........
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("Rss5", channel.Language), channel.Name, IRC.priority.low);
}
}
else
{
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
}
}
if (message.StartsWith("@rss+ "))
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "trust"))
{
string item = message.Substring("@rss+ ".Length);
if (item.Contains(" "))
{
string id = item.Substring(0, item.IndexOf(" "));
string ur = item.Substring(item.IndexOf(" ") + 1);
Feed feed = (Feed)channel.RetrieveObject("rss");
if (feed != null)
{
feed.InsertItem(id, ur);
}
return;
}
if (item != "")
{
Feed feed = (Feed)channel.RetrieveObject("rss");
if (feed != null)
{
feed.InsertItem(item, "");
}
return;
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("Rss5", channel.Language), channel.Name, IRC.priority.low);
}
}
else
{
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
}
}
if (message == "@rss-off")
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "admin"))
{
if (!GetConfig(channel, "Rss.Enable", false))
{
core.irc._SlowQueue.DeliverMessage(messages.get("Rss1", channel.Language), channel.Name);
return;
}
else
{
SetConfig(channel, "Rss.Enable", false);
core.irc._SlowQueue.DeliverMessage(messages.get("Rss2", channel.Language), channel.Name);
channel.SaveConfig();
return;
}
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == "@rss-on")
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "admin"))
{
if (GetConfig(channel, "Rss.Enable", false))
{
core.irc._SlowQueue.DeliverMessage(messages.get("Rss3", channel.Language), channel.Name);
return;
}
else
{
core.irc._SlowQueue.DeliverMessage(messages.get("Rss4", channel.Language), channel.Name);
SetConfig(channel, "Rss.Enable", true);
channel.SaveConfig();
return;
}
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
}
示例11: ParseAdmin
//.........这里部分代码省略.........
if (message.StartsWith(config.CommandPrefix + "drop "))
{
string channel = message.Substring(6);
if (channel != "")
{
config.channel Channel = core.getChannel(channel);
if (Channel == null)
{
irc._SlowQueue.DeliverMessage(messages.get("UnknownChan", chan.Language), chan.Name, IRC.priority.low);
return;
}
core.partChannel(Channel, invoker.Nick, invoker.Host, config.CommandPrefix + "drop", chan.Name);
return;
}
irc._SlowQueue.DeliverMessage("It would be cool to give me a name of channel you want to drop", chan.Name, IRC.priority.low);
return;
}
if (message.StartsWith(config.CommandPrefix + "language"))
{
if (chan.Users.IsApproved(invoker, "admin"))
{
string parameter = "";
if (message.Contains(" "))
{
parameter = message.Substring(message.IndexOf(" ") + 1).ToLower();
}
if (parameter != "")
{
if (messages.exist(parameter))
{
chan.Language = parameter;
irc._SlowQueue.DeliverMessage(messages.get("Language", chan.Language), chan.Name);
chan.SaveConfig();
return;
}
if (!chan.suppress_warnings)
{
irc._SlowQueue.DeliverMessage(messages.get("InvalidCode", chan.Language), chan.Name);
}
return;
}
irc._SlowQueue.DeliverMessage(messages.get("LanguageInfo", chan.Language), chan.Name);
return;
}
if (!chan.suppress_warnings)
{
irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", chan.Language), chan.Name, IRC.priority.low);
}
return;
}
if (message.StartsWith(config.CommandPrefix + "help"))
{
string parameter = "";
if (message.Contains(" "))
{
parameter = message.Substring(message.IndexOf(" ") + 1);
}
if (parameter != "")
{
ShowHelp(parameter, chan);
return;
}
irc._SlowQueue.DeliverMessage("I am running http://meta.wikimedia.org/wiki/WM-Bot version " + config.version + " my source code is licensed under GPL and located at https://github.com/benapetr/wikimedia-bot I will be very happy if you fix my bugs or implement new features", chan.Name);
return;
示例12: Hook_SetConfig
public override bool Hook_SetConfig(config.channel chan, User invoker, string config, string value)
{
if (config == "style-rss")
{
if (value != "")
{
SetConfig(chan, "Rss.Style", value);
chan.SaveConfig();
core.irc._SlowQueue.DeliverMessage(messages.get("configuresave", chan.Language, new List<string> { value, config }), chan.Name);
return true;
}
core.irc._SlowQueue.DeliverMessage(messages.get("configure-va", chan.Language, new List<string> { config, value }), chan.Name);
return true;
}
return false;
}
示例13: Hook_PRIV
public override void Hook_PRIV(config.channel channel, User invoker, string message)
{
if (message.StartsWith(config.CommandPrefix + "optools-on"))
{
if (channel.Users.IsApproved(invoker, "admin"))
{
if (GetConfig(channel, "OP.Enabled", false))
{
core.irc._SlowQueue.DeliverMessage("Operator tools were already enabled on this channel", channel);
return;
}
else
{
core.irc._SlowQueue.DeliverMessage("Operator tools have been enabled on this channel", channel.Name);
SetConfig(channel, "OP.Enabled", true);
channel.SaveConfig();
return;
}
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == config.CommandPrefix + "optools-permanent-off")
{
if (channel.Users.IsApproved(invoker, "admin"))
{
if (!GetConfig(channel, "OP.Permanent", false))
{
core.irc._SlowQueue.DeliverMessage("Operator tools were already not in permanent mode on this channel", channel);
return;
}
else
{
core.irc._SlowQueue.DeliverMessage("Operator tools are now not in permanent mode on this channel", channel);
SetConfig(channel, "OP.Permanent", false);
channel.SaveConfig();
return;
}
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel, IRC.priority.low);
}
return;
}
if (message == config.CommandPrefix + "optools-permanent-on")
{
if (channel.Users.IsApproved(invoker, "admin"))
{
if (GetConfig(channel, "OP.Permanent", false))
{
core.irc._SlowQueue.DeliverMessage("Operator tools were already in permanent mode on this channel", channel);
return;
}
else
{
core.irc._SlowQueue.DeliverMessage("Operator tools are now in permanent mode on this channel", channel);
SetConfig(channel, "OP.Permanent", true);
channel.SaveConfig();
return;
}
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel, IRC.priority.low);
}
return;
}
if (message == config.CommandPrefix + "optools-off")
{
if (channel.Users.IsApproved(invoker, "admin"))
{
if (!GetConfig(channel, "OP.Enabled", false))
{
core.irc._SlowQueue.DeliverMessage("Operator tools were already disabled on this channel", channel);
return;
}
else
{
core.irc._SlowQueue.DeliverMessage("Operator tools have been disabled on this channel", channel);
SetConfig(channel, "OP.Enabled", false);
channel.SaveConfig();
return;
}
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel, IRC.priority.low);
}
return;
}
if (message.StartsWith(config.CommandPrefix + "kick "))
{
//.........这里部分代码省略.........
示例14: Hook_PRIV
//.........这里部分代码省略.........
string ur = item.Substring(item.IndexOf(" ") + 1);
Feed feed = (Feed)channel.RetrieveObject("rss");
if (feed != null)
{
feed.InsertItem(id, ur, true);
}
return;
}
if (item != "")
{
Feed feed = (Feed)channel.RetrieveObject("rss");
if (feed != null)
{
feed.InsertItem(item, "", true);
}
return;
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("Rss5", channel.Language), channel.Name, IRC.priority.low);
}
}
else
{
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
}
}
if (message.StartsWith("@rss-scanner- "))
{
if (channel.Users.IsApproved(invoker, "trust"))
{
string item = message.Substring("@rss-scannerx ".Length);
Feed feed = (Feed)channel.RetrieveObject("rss");
if (feed != null)
{
feed.RemoveItem(item);
}
return;
}
else
{
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
}
}
if (message == "@rss-off")
{
if (channel.Users.IsApproved(invoker, "admin"))
{
if (!GetConfig(channel, "Rss.Enable", false))
{
core.irc._SlowQueue.DeliverMessage(messages.get("Rss1", channel.Language), channel.Name);
return;
}
else
{
SetConfig(channel, "Rss.Enable", false);
core.irc._SlowQueue.DeliverMessage(messages.get("Rss2", channel.Language), channel.Name);
channel.SaveConfig();
return;
}
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == "@rss-on")
{
if (channel.Users.IsApproved(invoker, "admin"))
{
if (GetConfig(channel, "Rss.Enable", false))
{
core.irc._SlowQueue.DeliverMessage(messages.get("Rss3", channel.Language), channel.Name);
return;
}
else
{
core.irc._SlowQueue.DeliverMessage(messages.get("Rss4", channel.Language), channel.Name);
SetConfig(channel, "Rss.Enable", true);
channel.SaveConfig();
return;
}
}
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
}
示例15: Hook_PRIV
public override void Hook_PRIV(config.channel channel, User invoker, string message)
{
if (message == config.CommandPrefix + "relay-off")
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "admin"))
{
if (!GetConfig(channel, "NetCat.Enabled", false))
{
core.irc._SlowQueue.DeliverMessage("Relay is already disabled", channel.Name);
return;
}
SetConfig(channel, "NetCat.Enabled", false);
channel.SaveConfig();
core.irc._SlowQueue.DeliverMessage("Relay was disabled", channel.Name);
return;
}
else
{
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
}
return;
}
if (message == config.CommandPrefix + "token-on")
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "admin"))
{
string token = GenerateToken();
SetConfig(channel, "NetCat.Token", true);
SetConfig(channel, "NetCat.TokenData", token);
channel.SaveConfig();
core.irc._SlowQueue.DeliverMessage("New token was generated for this channel, and it was sent to you in a private message", channel.Name);
core.irc._SlowQueue.DeliverMessage("Token for " + channel.Name + " is: " + token, invoker.Nick, IRC.priority.normal);
return;
}
else
{
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
}
return;
}
if (message == config.CommandPrefix + "token-off")
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "admin"))
{
SetConfig(channel, "NetCat.Token", false);
channel.SaveConfig();
core.irc._SlowQueue.DeliverMessage("This channel will no longer require a token in order to relay messages into it", channel.Name);
return;
}
else
{
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
}
return;
}
if (message == config.CommandPrefix + "token-remind")
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "admin"))
{
if (!GetConfig(channel, "NetCat.Token", false))
{
core.irc._SlowQueue.DeliverMessage("This channel doesn't require a token", channel.Name);
return;
}
string token = GetConfig(channel, "NetCat.TokenData", "<invalid>");
core.irc._SlowQueue.DeliverMessage("Token for " + channel.Name + " is: " + token, invoker.Nick, IRC.priority.normal);
return;
}
else
{
if (!channel.suppress_warnings)
{
core.irc._SlowQueue.DeliverMessage(messages.get("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
}
return;
}
if (message == config.CommandPrefix + "relay-on")
{
if (channel.Users.isApproved(invoker.Nick, invoker.Host, "admin"))
{
if (GetConfig(channel, "NetCat.Enabled", false))
{
core.irc._SlowQueue.DeliverMessage("Relay is already enabled", channel.Name);
return;
}
SetConfig(channel, "NetCat.Enabled", true);
//.........这里部分代码省略.........