本文整理汇总了C#中wmib.Channel.SaveConfig方法的典型用法代码示例。如果您正苦于以下问题:C# Channel.SaveConfig方法的具体用法?C# Channel.SaveConfig怎么用?C# Channel.SaveConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wmib.Channel
的用法示例。
在下文中一共展示了Channel.SaveConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Hook_PRIV
public override void Hook_PRIV(Channel channel, User invoker, string message)
{
if (message.StartsWith(Configuration.System.CommandPrefix + "optools-on"))
{
if (channel.SystemUsers.IsApproved(invoker, "admin"))
{
if (GetConfig(channel, "OP.Enabled", false))
{
Core.irc.Queue.DeliverMessage(messages.Localize("OpE1", channel.Language), channel);
return;
}
else
{
Core.irc.Queue.DeliverMessage(messages.Localize("OpM1", channel.Language), channel.Name);
SetConfig(channel, "OP.Enabled", true);
channel.SaveConfig();
return;
}
}
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == Configuration.System.CommandPrefix + "optools-permanent-off")
{
if (channel.SystemUsers.IsApproved(invoker, "admin"))
{
if (!GetConfig(channel, "OP.Permanent", false))
{
Core.irc.Queue.DeliverMessage(messages.Localize("OpE2", channel.Language), channel);
return;
}
else
{
Core.irc.Queue.DeliverMessage(messages.Localize("OpM2", channel.Language), channel);
SetConfig(channel, "OP.Permanent", false);
channel.SaveConfig();
return;
}
}
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, IRC.priority.low);
}
return;
}
if (message == Configuration.System.CommandPrefix + "optools-permanent-on")
{
if (channel.SystemUsers.IsApproved(invoker, "admin"))
{
if (GetConfig(channel, "OP.Permanent", false))
{
Core.irc.Queue.DeliverMessage(messages.Localize("OpE3", channel.Language), channel);
return;
}
else
{
Core.irc.Queue.DeliverMessage(messages.Localize("OpM3", channel.Language), channel);
SetConfig(channel, "OP.Permanent", true);
channel.SaveConfig();
return;
}
}
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, IRC.priority.low);
}
return;
}
if (message == Configuration.System.CommandPrefix + "optools-off")
{
if (channel.SystemUsers.IsApproved(invoker, "admin"))
{
if (!GetConfig(channel, "OP.Enabled", false))
{
Core.irc.Queue.DeliverMessage(messages.Localize("OpE4", channel.Language), channel);
return;
}
else
{
Core.irc.Queue.DeliverMessage(messages.Localize("OpM4", channel.Language), channel);
SetConfig(channel, "OP.Enabled", false);
channel.SaveConfig();
return;
}
}
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, IRC.priority.low);
}
return;
}
if (message.StartsWith(Configuration.System.CommandPrefix + "kick "))
{
//.........这里部分代码省略.........
示例2: Hook_PRIV
public override void Hook_PRIV(Channel channel, User invoker, string message)
{
if (channel.Name != RequestChannel)
{
return;
}
if (message == "@requests-off")
{
if (channel.SystemUsers.IsApproved(invoker.Nick, invoker.Host, "admin"))
{
if (!GetConfig(channel, "Requests.Enabled", false))
{
Core.irc.Queue.DeliverMessage("Requests are already disabled", channel.Name);
return;
}
else
{
Core.irc.Queue.DeliverMessage("Requests were disabled", channel.Name, IRC.priority.high);
SetConfig(channel, "Requests.Enabled", false);
channel.SaveConfig();
return;
}
}
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == "@requests-on")
{
if (channel.SystemUsers.IsApproved(invoker.Nick, invoker.Host, "admin"))
{
if (GetConfig(channel, "Requests.Enabled", false))
{
Core.irc.Queue.DeliverMessage("Requests system is already enabled", channel.Name);
return;
}
SetConfig(channel, "Requests.Enabled", true);
channel.SaveConfig();
Core.irc.Queue.DeliverMessage("Requests were enabled", channel.Name, IRC.priority.high);
return;
}
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == "@requests")
{
if (!GetConfig(channel, "Requests.Enabled", false))
{
Core.irc.Queue.DeliverMessage("You need to enable requests in this channel for this command to work", channel.Name);
return;
}
lock (this.WaitingRequests)
{
if (this.WaitingRequests.Contains(channel.Name))
{
Core.irc.Queue.DeliverMessage("I am already fetching the list of waiting users for this channel", channel.Name);
return;
} else
{
Core.irc.Queue.DeliverMessage("I am fetching the list of waiting users...", channel.Name);
}
this.WaitingRequests.Add(channel.Name);
}
return;
}
}
示例3: Hook_PRIV
public override void Hook_PRIV(Channel channel, User invoker, string message)
{
WriteStatus(invoker.Nick, invoker.Host, channel.Name, item.Action.Talk);
if (message.StartsWith(Configuration.System.CommandPrefix + "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(Configuration.System.CommandPrefix + "seenrx "))
{
if (channel.SystemUsers.IsApproved(invoker, "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.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == Configuration.System.CommandPrefix + "seen-off")
{
if (channel.SystemUsers.IsApproved(invoker, "admin"))
{
if (!GetConfig(channel, "Seen.Enabled", false))
{
Core.irc.Queue.DeliverMessage(messages.Localize("seen-e2", channel.Language), channel.Name);
return;
}
else
{
Core.irc.Queue.DeliverMessage(messages.Localize("seen-off", channel.Language), channel.Name, IRC.priority.high);
SetConfig(channel, "Seen.Enabled", false);
channel.SaveConfig();
return;
}
}
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == Configuration.System.CommandPrefix + "seen-on")
{
if (channel.SystemUsers.IsApproved(invoker, "admin"))
{
if (GetConfig(channel, "Seen.Enabled", false))
{
Core.irc.Queue.DeliverMessage(messages.Localize("seen-oe", channel.Language), channel.Name);
return;
}
SetConfig(channel, "Seen.Enabled", true);
channel.SaveConfig();
Core.irc.Queue.DeliverMessage(messages.Localize("seen-on", channel.Language), channel.Name, IRC.priority.high);
return;
}
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
}
示例4: Hook_PRIV
//.........这里部分代码省略.........
RecentChanges rc = (RecentChanges)channel.RetrieveObject("RC");
if (rc != null)
{
rc.insertString(wiki, Page);
}
return;
}
else
{
Core.irc.Queue.DeliverMessage(messages.Localize("Feed3", channel.Language), channel.Name);
return;
}
}
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == Configuration.System.CommandPrefix + "recentchanges-off")
{
if (channel.SystemUsers.IsApproved(invoker, "admin"))
{
if (!GetConfig(channel, "RC.Enabled", false))
{
Core.irc.Queue.DeliverMessage(messages.Localize("Feed6", channel.Language), channel.Name);
return;
}
else
{
Core.irc.Queue.DeliverMessage(messages.Localize("Feed7", channel.Language), channel.Name);
SetConfig(channel, "RC.Enabled", false);
channel.SaveConfig();
return;
}
}
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message == Configuration.System.CommandPrefix + "recentchanges-on")
{
if (channel.SystemUsers.IsApproved(invoker, "recentchanges-manage"))
{
if (GetConfig(channel, "RC.Enabled", false))
{
Core.irc.Queue.DeliverMessage(messages.Localize("Feed1", channel.Language), channel.Name);
return;
}
else
{
Core.irc.Queue.DeliverMessage(messages.Localize("Feed2", channel.Language), channel.Name);
SetConfig(channel, "RC.Enabled", true);
channel.SaveConfig();
return;
}
}
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
示例5: Hook_SetConfig
public override bool Hook_SetConfig(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.Queue.DeliverMessage(messages.Localize("configuresave", chan.Language, new List<string> { value, config }), chan);
chan.SaveConfig();
return true;
}
else
{
Module.SetConfig(chan, "RC.Template", "");
Core.irc.Queue.DeliverMessage(messages.Localize("configuresave", chan.Language, new List<string> { "null", config }), chan);
chan.SaveConfig();
return true;
}
}
return false;
}
示例6: Hook_PRIV
public override void Hook_PRIV(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 == Configuration.System.CommandPrefix + "statistics-off")
{
if (channel.SystemUsers.IsApproved(invoker, "admin"))
{
if (!Module.GetConfig(channel, "Statistics.Enabled", false))
{
Core.irc.Queue.DeliverMessage(messages.Localize("StatE2", channel.Language), channel);
return;
}
else
{
Module.SetConfig(channel, "Statistics.Enabled", false);
channel.SaveConfig();
Core.irc.Queue.DeliverMessage(messages.Localize("Stat-off", channel.Language), channel);
return;
}
}
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, IRC.priority.low);
}
return;
}
if (message == Configuration.System.CommandPrefix + "statistics-reset")
{
if (channel.SystemUsers.IsApproved(invoker, "admin"))
{
Statistics st = (Statistics)channel.RetrieveObject("Statistics");
if (st != null)
{
st.Delete();
}
Core.irc.Queue.DeliverMessage(messages.Localize("Statdt", channel.Language), channel);
return;
}
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel, IRC.priority.low);
}
return;
}
if (message == Configuration.System.CommandPrefix + "statistics-on")
{
if (channel.SystemUsers.IsApproved(invoker, "admin"))
{
if (Module.GetConfig(channel, "Statistics.Enabled", false))
{
Core.irc.Queue.DeliverMessage(messages.Localize("StatE1", channel.Language), channel);
return;
}
else
{
Module.SetConfig(channel, "Statistics.Enabled", true);
channel.SaveConfig();
Core.irc.Queue.DeliverMessage(messages.Localize("Stat-on", channel.Language), channel);
return;
}
}
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
}
示例7: Hook_PRIV
public override void Hook_PRIV(Channel channel, User invoker, string message)
{
if (!message.StartsWith(Configuration.System.CommandPrefix) && GetConfig(channel, "Slap.Enabled", false))
{
string ms = message.Trim();
ms = ms.Replace("!", "");
ms = ms.Replace("?", "");
ms = ms.ToLower();
if (ms.StartsWith("hi "))
{
ms = ms.Substring(3);
}
if (ms.StartsWith("hi, "))
{
ms = ms.Substring(4);
}
if (ms.StartsWith("hello "))
{
ms = ms.Substring(5);
}
if (ms.StartsWith("hello, "))
{
ms = ms.Substring(6);
}
if (ms.EndsWith(":ping") || ms.EndsWith(": ping"))
{
string target = message.Trim();
target = message.Substring(0, message.IndexOf(":"));
if (GetConfig(channel, "Slap.Ping." + target, false))
{
channel.PrimaryInstance.irc.Queue.DeliverMessage("Hi " + invoker.Nick + ", you just managed to say pointless nick: ping. Now please try again with some proper meaning of your request, something like nick: I need this and that. Or don't do that at all, it's very annoying. Thank you", channel);
return;
}
}
if (ms == "i have a question" || ms == "can i ask a question" || ms == "can i ask" || ms == "i got a question" || ms == "can i have a question" || ms == "can someone help me" || ms == "i need help")
{
channel.PrimaryInstance.irc.Queue.DeliverMessage("Hi " + invoker.Nick + ", just ask! There is no need to ask if you can ask", channel);
return;
}
if (ms == "is anyone here" || ms == "is anybody here" || ms == "is anybody there" || ms == "is some one there" || ms == "is someone there" || ms == "is someone here")
{
channel.PrimaryInstance.irc.Queue.DeliverMessage("Hi " + invoker.Nick + ", I am here, if you need anything, please ask, otherwise no one is going to help you... Thank you", channel);
return;
}
}
if (message == Configuration.System.CommandPrefix + "slap")
{
if (channel.SystemUsers.IsApproved(invoker, "admin"))
{
SetConfig(channel, "Slap.Enabled", true);
Core.irc.Queue.DeliverMessage("I will be slapping stupid people since now", channel);
channel.SaveConfig();
return;
}
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage("Permission denied", channel);
}
}
if (message == Configuration.System.CommandPrefix + "noslap")
{
if (channel.SystemUsers.IsApproved(invoker, "admin"))
{
SetConfig(channel, "Slap.Enabled", false);
Core.irc.Queue.DeliverMessage("I will not be slapping stupid people since now", channel);
channel.SaveConfig();
return;
}
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage("Permission denied", channel);
}
}
if (message == Configuration.System.CommandPrefix + "nopingslap")
{
if (channel.SystemUsers.IsApproved(invoker, "trust"))
{
SetConfig(channel, "Slap.Ping." + invoker.Nick.ToLower(), false);
Core.irc.Queue.DeliverMessage("I will not be slapping people who slap you now", channel);
channel.SaveConfig();
return;
}
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage("Permission denied", channel);
}
}
if (message == Configuration.System.CommandPrefix + "pingslap")
{
if (channel.SystemUsers.IsApproved(invoker, "trust"))
{
SetConfig(channel, "Slap.Ping." + invoker.Nick.ToLower(), true);
Core.irc.Queue.DeliverMessage("I will be slapping people who ping you now", channel);
channel.SaveConfig();
//.........这里部分代码省略.........
示例8: Hook_PRIV
public override void Hook_PRIV(Channel channel, libirc.UserInfo invoker, string message)
{
if (message == Configuration.System.CommandPrefix + "linkie-off")
{
if (channel.SystemUsers.IsApproved(invoker, "admin"))
{
if (GetConfig(channel, "Link.Enable", false))
{
SetConfig(channel, "Link.Enable", false);
channel.SaveConfig();
IRC.DeliverMessage(messages.Localize("Linkie-Off", channel.Language), channel);
}
else
{
IRC.DeliverMessage(messages.Localize("Linkie-Off2", channel.Language), channel);
}
return;
}
if (!channel.SuppressWarnings)
{
IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name);
}
return;
}
if (message == Configuration.System.CommandPrefix + "linkie-on")
{
if (channel.SystemUsers.IsApproved(invoker, "admin"))
{
if (!GetConfig(channel, "Link.Enable", false))
{
SetConfig(channel, "Link.Enable", true);
channel.SaveConfig();
IRC.DeliverMessage(messages.Localize("Linkie-On", channel.Language), channel);
}
else
{
IRC.DeliverMessage(messages.Localize("Linkie-On2", channel.Language), channel);
}
return;
}
if (!channel.SuppressWarnings)
{
IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name);
}
return;
}
if (message == Configuration.System.CommandPrefix + "link")
{
if (GetConfig(channel, "Link.Last", "") == "")
{
IRC.DeliverMessage(messages.Localize("Linkie-E1", channel.Language), channel);
return;
}
string xx = MakeTemplate(GetConfig(channel, "Link.Last", ""), GetConfig(channel, "Link.Default", "en"), false) + MakeLink(GetConfig(channel, "Link.Last", ""), GetConfig(channel, "Link.Default", "en"), true);
if (xx != "")
{
IRC.DeliverMessage(xx, channel);
return;
}
IRC.DeliverMessage(messages.Localize("Linkie-E2", channel.Language), channel);
return;
}
if (message.StartsWith(Configuration.System.CommandPrefix + "link "))
{
string link = message.Substring(6);
string xx = MakeTemplate(link, GetConfig(channel, "Link.Default", "en"), false) + MakeLink(link, GetConfig(channel, "Link.Default", "en"), true);
if (xx.Length > 0)
{
IRC.DeliverMessage(xx, channel);
return;
}
IRC.DeliverMessage(messages.Localize("Linkie-E3", channel.Language), channel);
return;
}
if (GetConfig(channel, "Link.Enable", false))
{
string result = MakeTemplate(message, GetConfig(channel, "Link.Default", "en"), false) + MakeLink(message, GetConfig(channel, "Link.Default", "en"), true);
if (result.Length > 0)
{
IRC.DeliverMessage(result, channel);
return;
}
}
if (ContainsLink(message))
{
SetConfig(channel, "Link.Last", message);
}
}
示例9: Hook_SetConfig
public override bool Hook_SetConfig(Channel chan, libirc.UserInfo invoker, string config, string value)
{
if (config == "default-link-wiki")
{
if (value != "")
{
SetConfig(chan, "Link.Default", value);
chan.SaveConfig();
IRC.DeliverMessage(messages.Localize("configuresave", chan.Language, new List<string> { value, config }), chan.Name);
return true;
}
IRC.DeliverMessage(messages.Localize("configure-va", chan.Language, new List<string> { config, value }), chan.Name);
return true;
}
return false;
}
示例10: Hook_PRIV
public override void Hook_PRIV(Channel channel, User invoker, string message)
{
if (message == Configuration.System.CommandPrefix + "relay-off")
{
if (channel.SystemUsers.IsApproved(invoker.Nick, invoker.Host, "admin"))
{
if (!GetConfig(channel, "NetCat.Enabled", false))
{
Core.irc.Queue.DeliverMessage("Relay is already disabled", channel.Name);
return;
}
SetConfig(channel, "NetCat.Enabled", false);
channel.SaveConfig();
Core.irc.Queue.DeliverMessage("Relay was disabled", channel.Name);
return;
}
else
{
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
}
return;
}
if (message == Configuration.System.CommandPrefix + "token-on")
{
if (channel.SystemUsers.IsApproved(invoker.Nick, invoker.Host, "admin"))
{
string token = GenerateToken();
SetConfig(channel, "NetCat.Token", true);
SetConfig(channel, "NetCat.TokenData", token);
channel.SaveConfig();
Core.irc.Queue.DeliverMessage("New token was generated for this channel, and it was sent to you in a private message", channel.Name);
Core.irc.Queue.DeliverMessage("Token for " + channel.Name + " is: " + token, invoker.Nick, IRC.priority.normal);
return;
}
else
{
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
}
return;
}
if (message == Configuration.System.CommandPrefix + "token-off")
{
if (channel.SystemUsers.IsApproved(invoker.Nick, invoker.Host, "admin"))
{
SetConfig(channel, "NetCat.Token", false);
channel.SaveConfig();
Core.irc.Queue.DeliverMessage("This channel will no longer require a token in order to relay messages into it", channel.Name);
return;
}
else
{
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
}
return;
}
if (message == Configuration.System.CommandPrefix + "token-remind")
{
if (channel.SystemUsers.IsApproved(invoker.Nick, invoker.Host, "admin"))
{
if (!GetConfig(channel, "NetCat.Token", false))
{
Core.irc.Queue.DeliverMessage("This channel doesn't require a token", channel.Name);
return;
}
string token = GetConfig(channel, "NetCat.TokenData", "<invalid>");
Core.irc.Queue.DeliverMessage("Token for " + channel.Name + " is: " + token, invoker.Nick, IRC.priority.normal);
return;
}
else
{
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
}
return;
}
if (message == Configuration.System.CommandPrefix + "relay-on")
{
if (channel.SystemUsers.IsApproved(invoker.Nick, invoker.Host, "admin"))
{
if (GetConfig(channel, "NetCat.Enabled", false))
{
Core.irc.Queue.DeliverMessage("Relay is already enabled", channel.Name);
return;
}
SetConfig(channel, "NetCat.Enabled", true);
//.........这里部分代码省略.........
示例11: PartChannel
/// <summary>
/// Part a channel
/// </summary>
/// <param name="channel">Channel object</param>
/// <param name="user">User</param>
/// <param name="host">Host</param>
/// <param name="message">Message</param>
/// <param name="origin">The channel from which this request was sent</param>
public static void PartChannel(Channel channel, string user, string host, string message, string origin = "NULL")
{
try
{
if (origin == "NULL")
origin = channel.Name;
if (channel.Name == Configuration.System.DebugChan && (message == Configuration.System.CommandPrefix + "part"
|| message == Configuration.System.CommandPrefix + "drop"))
{
IRC.DeliverMessage("Cowardly refusing to part this channel, because I love it :3", channel);
return;
}
if (message == Configuration.System.CommandPrefix + "drop")
{
if (channel.SystemUsers.IsApproved(user, host, "drop"))
{
while (!IRC.FinishedJoining)
{
Syslog.Log("Postponing request to part " + channel.Name + " because bot is still loading", true);
Thread.Sleep(2000);
}
channel.PrimaryInstance.Network.Transfer("PART " + channel.Name + " :" + "dropped by " + user + " from " + origin);
Syslog.Log("Dropped " + channel.Name + " dropped by " + user + " from " + origin);
Thread.Sleep(100);
try
{
File.Delete(Variables.ConfigurationDirectory + Path.DirectorySeparatorChar + channel.Name + ".xml");
}
catch (Exception fail)
{
Syslog.ErrorLog("Failed to delete configuration file of " + channel.Name);
Core.HandleException(fail);
}
foreach (Module module in ExtensionHandler.ExtensionList)
{
try
{
if (module.IsWorking)
module.Hook_ChannelDrop(channel);
}
catch (Exception fail)
{
Syslog.Log("MODULE: exception at Hook_ChannelDrop in " + module.Name, true);
Core.HandleException(fail, module.Name);
}
}
lock (Configuration.Channels)
{
channel.Remove();
}
Configuration.Save();
return;
}
IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), origin);
return;
}
if (message == Configuration.System.CommandPrefix + "part")
{
if (channel.SystemUsers.IsApproved(user, host, "part"))
{
while (!IRC.FinishedJoining)
{
Syslog.Log("Postponing request to part " + channel.Name + " because bot is still loading", true);
Thread.Sleep(2000);
}
channel.PrimaryInstance.Network.Transfer("PART " + channel.Name + " :" + "removed by " + user + " from " + origin);
Syslog.Log("Removed " + channel.Name + " removed by " + user + " from " + origin);
Thread.Sleep(100);
lock (Configuration.Channels)
{
channel.Remove();
}
channel.SaveConfig();
Configuration.Save();
return;
}
IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), origin);
}
}
catch (Exception fail)
{
Core.HandleException(fail);
}
}
示例12: ParseAdmin
/// <summary>
/// Display admin command
/// </summary>
/// <param name="chan">Channel</param>
/// <param name="user">User name</param>
/// <param name="host">Host</param>
/// <param name="message">Message</param>
public static void ParseAdmin(Channel chan, string user, string host, string message)
{
libirc.UserInfo invoker = new libirc.UserInfo(user, "", host);
if (message == Configuration.System.CommandPrefix + "reload")
{
if (chan.SystemUsers.IsApproved(invoker, "admin"))
{
chan.LoadConfig();
SystemHooks.IrcReloadChannelConf(chan);
IRC.DeliverMessage(messages.Localize("Config", chan.Language), chan);
return;
}
if (!chan.SuppressWarnings)
{
IRC.DeliverMessage(messages.Localize("PermissionDenied", chan.Language), chan);
}
return;
}
if (message == Configuration.System.CommandPrefix + "info")
{
IRC.DeliverMessage(Configuration.WebPages.WebpageURL + Configuration.Paths.DumpDir
+ "/" + HttpUtility.UrlEncode(chan.Name) + ".htm", chan);
return;
}
if (message.StartsWith(Configuration.System.CommandPrefix + "part "))
{
string channel = message.Substring(6);
if (channel != "")
{
Channel _Channel = Core.GetChannel(channel);
if (_Channel == null)
{
IRC.DeliverMessage(messages.Localize("UnknownChan", chan.Language), chan,
libirc.Defs.Priority.Low);
return;
}
PartChannel(_Channel, invoker.Nick, invoker.Host, Configuration.System.CommandPrefix
+ "part", chan.Name);
return;
}
IRC.DeliverMessage(messages.Localize("Responses-PartFail", chan.Language), chan,
libirc.Defs.Priority.Low);
return;
}
if (message.StartsWith(Configuration.System.CommandPrefix + "drop "))
{
string channel = message.Substring(6);
if (channel != "")
{
Channel _Channel = Core.GetChannel(channel);
if (_Channel == null)
{
IRC.DeliverMessage(messages.Localize("UnknownChan", chan.Language), chan,
libirc.Defs.Priority.Low);
return;
}
PartChannel(_Channel, invoker.Nick, invoker.Host, Configuration.System.CommandPrefix
+ "drop", chan.Name);
return;
}
IRC.DeliverMessage(messages.Localize("Responses-PartFail", chan.Language), chan,
libirc.Defs.Priority.Low);
return;
}
if (message.StartsWith(Configuration.System.CommandPrefix + "language"))
{
if (chan.SystemUsers.IsApproved(invoker, "admin"))
{
string parameter = "";
if (message.Contains(" "))
{
parameter = message.Substring(message.IndexOf(" ") + 1).ToLower();
}
if (parameter != "")
{
if (messages.Exists(parameter))
{
chan.Language = parameter;
IRC.DeliverMessage(messages.Localize("Language", chan.Language), chan);
chan.SaveConfig();
return;
}
if (!chan.SuppressWarnings)
{
IRC.DeliverMessage(messages.Localize("InvalidCode", chan.Language), chan);
}
return;
}
IRC.DeliverMessage(messages.Localize("LanguageInfo", chan.Language), chan);
//.........这里部分代码省略.........
示例13: Hook_SetConfig
public override bool Hook_SetConfig(Channel chan, User invoker, string config, string value)
{
if (config == "style-rss")
{
if (value != "")
{
SetConfig(chan, "Rss.Style", value);
chan.SaveConfig();
Core.irc.Queue.DeliverMessage(messages.Localize("configuresave", chan.Language, new List<string> { value, config }), chan.Name);
return true;
}
Core.irc.Queue.DeliverMessage(messages.Localize("configure-va", chan.Language, new List<string> { config, value }), chan.Name);
return true;
}
return false;
}
示例14: Hook_PRIV
//.........这里部分代码省略.........
{
Core.irc.Queue.DeliverMessage(messages.Localize("infobot16", channel.Language), channel);
return;
}
if (channel.SharedDB != "local" && channel.SharedDB != "")
{
Core.irc.Queue.DeliverMessage(messages.Localize("infobot15", channel.Language), channel);
return;
}
else
{
if (message.Length <= "@infobot-share-trust+ ".Length)
{
Core.irc.Queue.DeliverMessage(messages.Localize("db6", channel.Language), channel.Name);
return;
}
string name = message.Substring("@infobot-share-trust+ ".Length);
Channel guest = Core.GetChannel(name);
if (guest == null)
{
Core.irc.Queue.DeliverMessage(messages.Localize("db8", channel.Language), channel.Name);
return;
}
if (channel.SharedLinkedChan.Contains(guest))
{
Core.irc.Queue.DeliverMessage(messages.Localize("db14", channel.Language), channel.Name);
return;
}
Core.irc.Queue.DeliverMessage(messages.Localize("db1", channel.Language, new List<string> { name }), channel.Name);
lock (channel.SharedLinkedChan)
{
channel.SharedLinkedChan.Add(guest);
}
channel.SaveConfig();
return;
}
}
if (!channel.SuppressWarnings)
{
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name, IRC.priority.low);
}
return;
}
if (message.StartsWith(Configuration.System.CommandPrefix + "infobot-ignore- "))
{
if (channel.SystemUsers.IsApproved(invoker, "trust"))
{
string item = message.Substring("@infobot-ignore+ ".Length);
if (item != "")
{
if (!channel.Infobot_IgnoredNames.Contains(item))
{
Core.irc.Queue.DeliverMessage(messages.Localize("infobot-ignore-found", channel.Language, new List<string> { item }), channel);
return;
}
channel.Infobot_IgnoredNames.Remove(item);
Core.irc.Queue.DeliverMessage(messages.Localize("infobot-ignore-rm", channel.Language, new List<string> { item }), channel);
channel.SaveConfig();
return;
}
}
else
{
if (!channel.SuppressWarnings)
{
示例15: Hook_PRIV
public override void Hook_PRIV(Channel channel, libirc.UserInfo invoker, string message)
{
if (message.StartsWith("@labs-off"))
{
if (channel.SystemUsers.IsApproved(invoker, "admin"))
{
if (!GetConfig(channel, "LABS.Enabled", false))
{
IRC.DeliverMessage("Labs utilities are already disabled", channel.Name);
return;
}
SetConfig(channel, "LABS.Enabled", false);
channel.SaveConfig();
IRC.DeliverMessage("Labs utilities were disabled", channel.Name);
return;
}
else
{
if (!channel.SuppressWarnings)
{
IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name);
}
}
return;
}
if (message.StartsWith("@labs-on"))
{
if (channel.SystemUsers.IsApproved(invoker, "admin"))
{
if (GetConfig(channel, "LABS.Enabled", false))
{
IRC.DeliverMessage("Labs utilities are already enabled", channel.Name);
return;
}
SetConfig(channel, "LABS.Enabled", true);
channel.SaveConfig();
IRC.DeliverMessage("Labs utilities were enabled", channel.Name);
return;
}
else
{
if (!channel.SuppressWarnings)
{
IRC.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel.Name);
}
}
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 != "")
{
IRC.DeliverMessage(user + " is member of " + list.ToString() + " projects: " + result, channel.Name);
return;
}
IRC.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)
{
IRC.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;
IRC.DeliverMessage(results, channel.Name);
return;
}
IRC.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);
}
}
//.........这里部分代码省略.........