本文整理汇总了C#中wmib.Channel类的典型用法代码示例。如果您正苦于以下问题:C# Channel类的具体用法?C# Channel怎么用?C# Channel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Channel类属于wmib命名空间,在下文中一共展示了Channel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Hook_Nick
public override void Hook_Nick(Channel channel, User Target, string OldNick)
{
Notification result = Notification.RetrieveTarget(Target.Nick);
while (result != null)
{
Core.irc.Queue.DeliverMessage(result.Source_Name + "! " + OldNick + " just changed nicknames to " + Target.Nick + " which you wanted to talk with, in " + channel.Name + ". This message was delivered to you because you asked me to notify you about this user's activity. For more information, see http://meta.wikimedia.org/wiki/WM-Bot", result.Source_Name, IRC.priority.low);
lock (Notification.NotificationList)
{
Notification.NotificationList.Remove(result);
}
result = Notification.RetrieveTarget(Target.Nick);
}
result = Notification.RetrieveTarget(OldNick);
while (result != null)
{
Core.irc.Queue.DeliverMessage(result.Source_Name + "! " + OldNick + " just changed a nickname to " + Target.Nick + " which you wanted to talk with, in " + channel.Name + ". This message was delivered to you because you asked me to notify you about this user's activity. For more information, see http://meta.wikimedia.org/wiki/WM-Bot", result.Source_Name, IRC.priority.low);
lock (Notification.NotificationList)
{
Notification.NotificationList.Remove(result);
}
result = Notification.RetrieveTarget(OldNick);
}
if (Target.Nick.ToLower() != OldNick.ToLower())
{
result = Notification.RetrieveSource(OldNick);
while (result != null)
{
result.Source_Name = Target.Nick;
result = Notification.RetrieveSource(OldNick);
}
}
}
开发者ID:johnduhart,项目名称:wikimedia-bot,代码行数:32,代码来源:NotifyUs.cs
示例2: Hook_PRIV
public override void Hook_PRIV(Channel channel, libirc.UserInfo invoker, string message)
{
if (message == "@replag")
{
IRC.DeliverMessage("Replication lag is approximately " + GetReplag(), channel);
}
}
开发者ID:benapetr,项目名称:wikimedia-bot,代码行数:7,代码来源:Rl.cs
示例3: Hook_PRIV
public override void Hook_PRIV(Channel channel, User invoker, string message)
{
if (message.StartsWith("!") && message.Contains("|"))
{
DebugLog("Parsing: " + message, 6);
string user = message.Substring(message.IndexOf("|") + 1);
user = user.Trim();
DebugLog("Parsed user - " + user, 6);
if (user.Contains(" "))
{
user = user.Substring(0, user.IndexOf(" "));
}
if (user != "")
{
DebugLog("Adding user to list " + user, 6);
Ring.Add(new Buffer.Item(invoker.Nick, user));
}
}
else
{
message = message.ToLower();
if (message.Contains(channel.PrimaryInstance.Nick) && !message.Contains("thanks to") && (message.Contains("thanks") || message.Contains("thank you")) && !message.Contains("no thank"))
{
string response = "Hey " + invoker.Nick + ", you are welcome!";
Buffer.Item x = Ring.getUser(invoker.Nick);
DebugLog("Checking if user was recently informed using infobot");
if (x != null)
{
response = "Hey " + invoker.Nick + ", you are welcome, but keep in mind I am just a stupid bot, it was actually " + x.User + " who helped you :-)";
Ring.Delete(x);
}
Core.irc.Queue.DeliverMessage(response, channel);
}
}
}
开发者ID:johnduhart,项目名称:wikimedia-bot,代码行数:35,代码来源:Class1.cs
示例4: Hook_Channel
public override void Hook_Channel(Channel channel)
{
if (channel.RetrieveObject("rss") == null)
{
channel.RegisterObject(new Feed(channel), "rss");
}
}
开发者ID:johnduhart,项目名称:wikimedia-bot,代码行数:7,代码来源:Module.cs
示例5: AddChannel
/// <summary>
/// Join channel
/// </summary>
/// <param name="channel">Channel</param>
/// <param name="user">User</param>
/// <param name="host">Host</param>
/// <param name="message">Message</param>
public static void AddChannel(Channel channel, string user, string host, string message)
{
try
{
if (message.StartsWith(Configuration.System.CommandPrefix + "add ") ||
message.StartsWith(Configuration.System.CommandPrefix + "join "))
{
if (channel.SystemUsers.IsApproved(user, host, "admin"))
{
while (!Core.FinishedJoining)
{
Syslog.Log("Postponing request to join because bot is still loading", true);
Thread.Sleep(2000);
}
if (message.Contains(" "))
{
string _channel = message.Substring(message.IndexOf(" ") + 1).Trim();
if (!Core.ValidFile(_channel) || !_channel.StartsWith("#"))
{
Core.irc.Queue.DeliverMessage(messages.Localize("InvalidName", channel.Language), channel);
return;
}
lock (Configuration.Channels)
{
foreach (Channel cu in Configuration.Channels)
{
if (_channel == cu.Name)
{
Core.irc.Queue.DeliverMessage(messages.Localize("ChannelIn", channel.Language), channel);
return;
}
}
}
bool existing = Channel.ConfigExists(_channel);
Channel xx = new Channel(_channel);
lock (Configuration.Channels)
{
Configuration.Channels.Add(xx);
}
Configuration.Save();
xx.PrimaryInstance.irc.SendData("JOIN " + _channel);
Thread.Sleep(100);
Channel Chan = Core.GetChannel(_channel);
if (!existing)
{
Chan.SystemUsers.AddUser("admin", Security.EscapeUser(user) + "!.*@" + Security.EscapeUser(host));
}
return;
}
channel.PrimaryInstance.irc.Message(messages.Localize("InvalidName", channel.Language), channel);
return;
}
Core.irc.Queue.DeliverMessage(messages.Localize("PermissionDenied", channel.Language), channel);
}
}
catch (Exception b)
{
Core.HandleException(b);
}
}
开发者ID:johnduhart,项目名称:wikimedia-bot,代码行数:67,代码来源:Channel.cs
示例6: Extension_DumpHtml
public override string Extension_DumpHtml(Channel channel)
{
string HTML = "";
if (GetConfig(channel, "Rss.Enable", false))
{
Feed list = (Feed)channel.RetrieveObject("rss");
if (list == null)
{
return "";
}
if (GetConfig(channel, "Rss.Enable", false) != true)
{
return HTML;
}
HTML += "<h4>Rss feed</h4><br>";
HTML += "\n<br>\n<h4>Rss</h4>\n<br>\n\n<table class=\"infobot\" width=100% border=1>";
HTML += "<tr><th>Name</th><th>URL</th><th>Text</th><th>Enabled</th></tr>";
lock (list.Content)
{
foreach (Feed.Item feed in list.Content)
{
HTML += "\n<tr><td>" + feed.name + "</td><td><a href=\"" + feed.URL + "\">" + feed.URL + "</a></td><td>" + feed.template + "</td><td>" + (!feed.disabled).ToString() + "</td></tr>";
}
}
HTML += "</table>\n";
}
return HTML;
}
开发者ID:johnduhart,项目名称:wikimedia-bot,代码行数:28,代码来源:Module.cs
示例7: Hook_Channel
public override void Hook_Channel(Channel channel)
{
if (channel.RetrieveObject("Statistics") == null)
{
channel.RegisterObject(new Statistics(channel), NAME);
}
}
开发者ID:johnduhart,项目名称:wikimedia-bot,代码行数:7,代码来源:Statistics.cs
示例8: DeliverMessage
/// <summary>
/// Send a message to a given target
/// </summary>
/// <param name="text">Text of a message</param>
/// <param name="target">Channel</param>
/// <param name="priority">Priority</param>
public static void DeliverMessage(string text, Channel target, libirc.Defs.Priority priority = libirc.Defs.Priority.Normal)
{
if (!target.Suppress)
{
Self(text, target);
target.PrimaryInstance.Network.Message(text, target.Name, priority);
}
}
开发者ID:benapetr,项目名称:wikimedia-bot,代码行数:14,代码来源:IRC.cs
示例9: ChanLog
/// <summary>
/// Log file
/// </summary>
/// <param name="message">Message</param>
/// <param name="channel">Channel</param>
/// <param name="user">User</param>
/// <param name="host">Host</param>
/// <param name="noac">Action (if true it's logged as message, if false it's action)</param>
public void ChanLog(string message, Channel channel, string user, string host, bool noac = true)
{
try
{
DateTime time = DateTime.Now;
if (Module.GetConfig(channel, "Logging.Enabled", false))
{
string log;
//string URL = Core.Host.Host2Name(host);
//updateBold(ref messagehtml);
if (!noac)
{
log = "[" + TDToString(time.Hour) + ":" +
TDToString(time.Minute) + ":" +
TDToString(time.Second) + "] * " +
user + " " + message + "\n";
}
else
{
log = "[" + TDToString(time.Hour) + ":"
+ TDToString(time.Minute) + ":" +
TDToString(time.Second) + "] " + "<" +
user + ">\t " + message + "\n";
}
Job line = new Job();
line.channel = channel;
line.time = time;
line.message = log;
lock (jobs)
{
jobs.Add(line);
}
if (Core.DatabaseServerIsAvailable)
{
Item item = new Item();
item.channel = channel;
item.time = time;
item.username = user;
item.act = !noac;
item.host = host;
item.type = 0;
item.message = message;
lock (DJ)
{
DJ.Add(item);
}
}
}
}
catch (Exception er)
{
// nothing
HandleException(er);
}
}
开发者ID:johnduhart,项目名称:wikimedia-bot,代码行数:64,代码来源:Plugin.cs
示例10: Infobot
/// <summary>
/// Constructor
/// </summary>
/// <param name="database"></param>
/// <param name="channel"></param>
public Infobot(string database, Channel channel, Module module, bool sensitive = true)
{
Sensitive = sensitive;
datafile_xml = database + ".xml";
datafile_raw = database;
pChannel = channel;
Parent = module;
prefix = Module.GetConfig(pChannel, "Infobot.Prefix", DefaultPrefix);
LoadData();
}
开发者ID:johnduhart,项目名称:wikimedia-bot,代码行数:15,代码来源:Infobot.cs
示例11: HtmlDump
/// <summary>
/// Constructor
/// </summary>
/// <param name="channel"></param>
public HtmlDump(Channel channel)
{
dumpname = Configuration.Paths.DumpDir + "/" + channel.Name + ".htm";
if (!System.IO.Directory.Exists(Configuration.Paths.DumpDir))
{
Syslog.Log("Creating a directory for dump");
System.IO.Directory.CreateDirectory(Configuration.Paths.DumpDir);
}
_Channel = channel;
}
开发者ID:johnduhart,项目名称:wikimedia-bot,代码行数:14,代码来源:HtmlDump.cs
示例12: Hook_PRIV
public override void Hook_PRIV(Channel channel, User invoker, string message)
{
if (message == Configuration.System.CommandPrefix + "ping")
{
Info i = new Info();
i.channel = channel;
Thread thread = new Thread(Ping);
thread.Start(i);
}
}
开发者ID:johnduhart,项目名称:wikimedia-bot,代码行数:10,代码来源:Class.cs
示例13: Extension_DumpHtml
public override string Extension_DumpHtml(Channel channel)
{
string HTML = "";
if (Module.GetConfig(channel, "Statistics.Enabled", false))
{
Statistics list = (Statistics)channel.RetrieveObject(NAME);
if (list != null)
{
HTML += "\n<br>\n<h4>Most active users :)</h4>\n<br>\n\n<table class=\"infobot\" width=100% border=1>";
HTML += "<tr><td>N.</td><th>Nick</th><th>Messages (average / day)</th><th>Number of posted messages</th><th>Active since</th></tr>";
int id = 0;
int totalms = 0;
DateTime startime = DateTime.Now;
lock (list.data)
{
list.data.Sort();
list.data.Reverse();
foreach (Statistics.list user in list.data)
{
id++;
totalms += user.messages;
if (id > 100)
{
continue;
}
if (startime > user.logging_since)
{
startime = user.logging_since;
}
System.TimeSpan uptime = System.DateTime.Now - user.logging_since;
float average = user.messages;
average = ((float)user.messages / (float)(uptime.Days + 1));
if (user.URL != "")
{
HTML += "<tr><td>" + id.ToString() + ".</td><td><a target=\"_blank\" href=\"" + user.URL + "\">" + user.user + "</a></td><td>" + average.ToString() + "</td><td>" + user.messages.ToString() + "</td><td>" + user.logging_since.ToString() + "</td></tr>";
}
else
{
HTML += "<tr><td>" + id.ToString() + ".</td><td>" + user.user + "</td><td>" + average.ToString() + "</td><td>" + user.messages.ToString() + "</td><td>" + user.logging_since.ToString() + "</td></tr>";
}
HTML += " \n";
}
}
System.TimeSpan uptime_total = System.DateTime.Now - startime;
float average2 = totalms;
average2 = (float)totalms / (1 + uptime_total.Days);
HTML += "<tr><td>N/A</td><th>Total:</th><th>" + average2.ToString() + "</th><th>" + totalms.ToString() + "</th><td>N/A</td></tr>";
HTML += " \n";
HTML += "</table>";
}
}
return HTML;
}
开发者ID:johnduhart,项目名称:wikimedia-bot,代码行数:53,代码来源:Statistics.cs
示例14: Hook_Kick
public override void Hook_Kick(Channel channel, User source, User user)
{
Notification result = Notification.RetrieveTarget(user.Nick);
while (result != null)
{
Core.irc.Queue.DeliverMessage(result.Source_Name + "! " + user.Nick + " just got kicked from " + channel.Name + ". This message was delivered to you because you asked me to notify you about this user's activity. For more information, see http://meta.wikimedia.org/wiki/WM-Bot", result.Source_Name, IRC.priority.low);
lock (Notification.NotificationList)
{
Notification.NotificationList.Remove(result);
}
result = Notification.RetrieveTarget(user.Nick);
}
}
开发者ID:johnduhart,项目名称:wikimedia-bot,代码行数:13,代码来源:NotifyUs.cs
示例15: Linkable
public static bool Linkable(Channel host, Channel guest)
{
if (host == null)
{
return false;
}
if (guest == null)
{
return false;
}
if (host.SharedLinkedChan.Contains(guest))
{
return true;
}
return false;
}
开发者ID:johnduhart,项目名称:wikimedia-bot,代码行数:16,代码来源:Infobot.cs
示例16: IrcReloadChannelConf
public static void IrcReloadChannelConf(Channel Channel)
{
foreach (Module module in ExtensionHandler.ExtensionList)
{
try
{
if (module.IsWorking)
{
module.Hook_ReloadConfig(Channel);
}
}
catch (Exception fail)
{
Syslog.Log("MODULE: exception at Hook_Reload in " + module.Name);
Core.HandleException(fail, module.Name);
}
}
}
开发者ID:benapetr,项目名称:wikimedia-bot,代码行数:18,代码来源:SystemHooks.cs
示例17: IrcKick
public static void IrcKick(Channel Channel, libirc.UserInfo Source, string Target)
{
foreach (Module module in ExtensionHandler.ExtensionList)
{
if (!module.IsWorking)
{
continue;
}
try
{
module.Hook_Kick(Channel, Source, Target);
}
catch (Exception fail)
{
Syslog.Log("MODULE: exception at Hook_Kick in " + module.Name, true);
Core.HandleException(fail, module.Name);
}
}
}
开发者ID:benapetr,项目名称:wikimedia-bot,代码行数:19,代码来源:SystemHooks.cs
示例18: GetOp
public void GetOp(Channel chan)
{
if (!GetConfig(chan, "OP.Permanent", false))
{
chan.PrimaryInstance.irc.Queue.Send("CS op " + chan.Name, IRC.priority.high);
return;
}
// get our user
User user = chan.RetrieveUser(chan.PrimaryInstance.Nick);
if (user == null)
{
chan.PrimaryInstance.irc.Queue.Send("CS op " + chan.Name, IRC.priority.high);
return;
}
if (!user.IsOperator)
{
chan.PrimaryInstance.irc.Queue.Send("CS op " + chan.Name, IRC.priority.high);
}
}
开发者ID:johnduhart,项目名称:wikimedia-bot,代码行数:19,代码来源:Tool.cs
示例19: Extension_DumpHtml
public override string Extension_DumpHtml(Channel channel)
{
string HTML = "";
Infobot info = (Infobot)channel.RetrieveObject("Infobot");
if (info != null)
{
HTML += "\n<table border=1 class=\"infobot\" width=100%>\n<tr><th width=10%>Key</th><th>Value</th></tr>\n";
List<Infobot.InfobotKey> list = new List<Infobot.InfobotKey>();
lock (info)
{
if (Module.GetConfig(channel, "Infobot.Sorted", false) != false)
{
list = info.SortedItem();
}
else
{
list.AddRange(info.Keys);
}
}
if (info.Keys.Count > 0)
{
foreach (Infobot.InfobotKey Key in list)
{
HTML += Core.HTML.AddKey(Key.Key, Key.Text);
}
}
HTML += "</table>\n";
HTML += "<h4>Aliases</h4>\n<table class=\"infobot\" border=1 width=100%>\n";
lock (info)
{
foreach (Infobot.InfobotAlias data in info.Alias)
{
HTML += Core.HTML.AddLink(data.Name, data.Key);
}
}
HTML += "</table><br>\n";
}
return HTML;
}
开发者ID:johnduhart,项目名称:wikimedia-bot,代码行数:39,代码来源:Plugin.cs
示例20: Hook_Channel
public override void Hook_Channel(Channel channel)
{
Syslog.Log("Loading " + channel.Name);
if (channel == null)
{
Syslog.Log("NULL");
}
if (Snapshots)
{
try
{
if (Directory.Exists(SnapshotsDirectory + Path.DirectorySeparatorChar + channel.Name) == false)
{
Syslog.Log("Creating directory for infobot for " + channel.Name);
Directory.CreateDirectory(SnapshotsDirectory + Path.DirectorySeparatorChar + channel.Name);
}
}
catch (Exception fail)
{
Core.HandleException(fail, "infobot");
}
}
if (channel.RetrieveObject("Infobot") == null)
{
// sensitivity
bool cs = Module.GetConfig(channel, "Infobot.Case", true);
channel.RegisterObject(new Infobot(getDB(ref channel), channel, this, cs), "Infobot");
}
}
开发者ID:johnduhart,项目名称:wikimedia-bot,代码行数:29,代码来源:Plugin.cs
注:本文中的wmib.Channel类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论