本文整理汇总了C#中IrcClient类的典型用法代码示例。如果您正苦于以下问题:C# IrcClient类的具体用法?C# IrcClient怎么用?C# IrcClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IrcClient类属于命名空间,在下文中一共展示了IrcClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: StartModule
public virtual void StartModule(IrcClient irc, Server server)
{
this.server = server;
this.irc = irc;
AddBindings();
Load();
}
示例2: HandleUserListEnd
public static void HandleUserListEnd(IrcClient client, IrcMessage message)
{
var channel = client.Channels[message.Parameters[1]];
client.OnChannelListRecieved(new ChannelEventArgs(channel));
if (client.Settings.ModeOnJoin)
client.GetMode(channel.Name, c => Console.WriteLine(c.Mode));
}
示例3: HandleGetEmptyTopic
public static void HandleGetEmptyTopic(IrcClient client, IrcMessage message)
{
var channel = client.Channels.GetOrAdd(message.Parameters[1]);
var old = channel._Topic;
channel._Topic = message.Parameters[2];
client.OnChannelTopicReceived(new ChannelTopicEventArgs(channel, old, channel._Topic));
}
示例4: HandleMOTDNotFound
public static void HandleMOTDNotFound(IrcClient client, IrcMessage message)
{
client.OnMOTDRecieved(new ServerMOTDEventArgs(MOTD));
client.OnConnectionComplete(new EventArgs());
VerifyOurIdentity(client);
}
示例5: ProcessCommand
public void ProcessCommand(string[] args, IrcClient client, IrcController controller)
{
if (args.Length == 0)
{
new NeedMoreParamsError
{
Command = "JOIN",
SenderAddress = Server.HostName,
SenderNickName = client.NickName
}.SendMessageToClient(client);
return;
}
var name = args[0].Trim();
if (!name.StartsWith("#"))
{
new NoSuchChannelError
{
SenderAddress = Server.HostName,
ChannelName = name,
ClientNick = client.NickName
}.SendMessageToClient(client);
return;
}
if (name.StartsWith("#"))
name = name.Substring(1);
controller.JoinChannel(client, name);
}
示例6: ProcessMenssage
public override void ProcessMenssage(IrcClient.IrcMessage message, string[] args)
{
try
{
switch (args[1])
{
case "list":
this.IrcBot.SendChannelMessage("*** Listing Addons ***");
int i = 0;
foreach (string name in this.IrcBot.AddonsList.Keys)
{
this.IrcBot.SendChannelMessage("*** " + (i + 1) + ".- " + name + ((this.IrcBot.AddonsList[name].IsStarted) ? " ( Running )" : ""));
i++;
}
break;
case "start":
if (this.IrcBot.AddonsList.ContainsKey(args[2]))
this.IrcBot.AddonsList[args[2]].Start();
this.IrcBot.SendChannelMessage(" >> " + args[2] + " started.");
break;
case "stop":
if (this.IrcBot.AddonsList.ContainsKey(args[2]))
this.IrcBot.AddonsList[args[2]].Stop();
this.IrcBot.SendChannelMessage(" >> " + args[2] + " stoped.");
break;
default:
break;
}
}
catch { }
示例7: HandleUserListPart
public static void HandleUserListPart(IrcClient client, IrcMessage message)
{
var channel = client.Channels[message.Parameters[2]];
var users = message.Parameters[3].Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var nick in users)
{
if (string.IsNullOrWhiteSpace(nick))
continue;
var mode = client.ServerInfo.GetModeForPrefix(nick[0]);
if (mode == null)
{
var user = client.Users.GetOrAdd(nick);
if (!user.Channels.Contains(channel))
user.Channels.Add(channel);
if (!user.ChannelModes.ContainsKey(channel))
user.ChannelModes.Add(channel, null);
else
user.ChannelModes[channel] = null;
}
else
{
var user = client.Users.GetOrAdd(nick.Substring(1));
if (!user.Channels.Contains(channel))
user.Channels.Add(channel);
if (!user.ChannelModes.ContainsKey(channel))
user.ChannelModes.Add(channel, mode.Value);
else
user.ChannelModes[channel] = mode.Value;
}
}
}
示例8: HandleWhoIsEnd
public static void HandleWhoIsEnd(IrcClient client, IrcMessage message)
{
var request = client.RequestManager.DequeueOperation("WHOIS " + message.Parameters[1]);
if(request.Callback != null)
request.Callback(request);
client.OnWhoIsReceived(new Events.WhoIsReceivedEventArgs((WhoIs)request.State));
}
示例9: IrcMessageData
/// <summary>
/// Constructor to create an instace of IrcMessageData
/// </summary>
/// <param name="ircclient">IrcClient the message originated from</param>
/// <param name="from">combined nickname, identity and host of the user that sent the message ([email protected])</param>
/// <param name="nick">nickname of the user that sent the message</param>
/// <param name="ident">identity (username) of the userthat sent the message</param>
/// <param name="host">hostname of the user that sent the message</param>
/// <param name="channel">channel the message originated from</param>
/// <param name="message">message</param>
/// <param name="rawmessage">raw message sent by the server</param>
/// <param name="type">message type</param>
/// <param name="replycode">message reply code</param>
public IrcMessageData(IrcClient ircclient,
string from,
string nick,
string ident,
string host,
string channel,
string message,
string rawmessage,
ReceiveType type,
ReplyCode replycode)
{
_Irc = ircclient;
_RawMessage = rawmessage;
_RawMessageArray = rawmessage.Split(new[] {' '});
_Type = type;
_ReplyCode = replycode;
_From = from;
_Nick = nick;
_Ident = ident;
_Host = host;
_Channel = channel;
if (message != null)
{
// message is optional
_Message = message;
_MessageArray = message.Split(new[] {' '});
}
}
示例10: IrcBot
public IrcBot(Server server)
{
this.server = server;
irc = new IrcClient(server.nick, server.user, server.real, server.host);
operatorList = new OperatorList(irc, server);
LoadAllModules(Config.I.vars["ModuleLocation"]);
}
示例11: IrcPacket
public IrcPacket(IrcClient irc, string prefix, string action, StringStream content, string origString)
: base(action, content)
{
this.irc = irc;
this.prefix = prefix;
this.origString = origString;
}
示例12: HandleWhoIsUser
public static void HandleWhoIsUser(IrcClient client, IrcMessage message)
{
var whois = (WhoIs)RequestOperation.PeekOperation("WHOIS " + message.Parameters[1]).State;
whois.User.Nick = message.Parameters[1];
whois.User.User = message.Parameters[2];
whois.User.Hostname = message.Parameters[3];
whois.User.RealName = message.Parameters[5];
}
示例13: OperatorList
public OperatorList(IrcClient irc, Server server)
{
this.server = server;
Load();
this.irc = irc;
irc.OnQuitRecvd += new IrcClient.JoinRecvd(irc_OnQuitRecvd);
irc.OnNickRecvd += new IrcClient.JoinRecvd(irc_OnNickRecvd);
}
示例14: HandleMOTD
public static void HandleMOTD(IrcClient client, IrcMessage message)
{
if (message.Parameters.Length != 2)
throw new IrcProtocolException("372 MOTD message is incorrectly formatted.");
var part = message.Parameters[1].Substring(2);
MOTD += part + Environment.NewLine;
client.OnMOTDPartRecieved(new ServerMOTDEventArgs(part));
}
示例15: HandleEndOfMOTD
public static void HandleEndOfMOTD(IrcClient client, IrcMessage message)
{
client.OnMOTDRecieved(new ServerMOTDEventArgs(MOTD));
client.OnConnectionComplete(new EventArgs());
// Verify our identity
VerifyOurIdentity(client);
}