本文整理汇总了C#中IrcClient类的典型用法代码示例。如果您正苦于以下问题:C# IrcClient类的具体用法?C# IrcClient怎么用?C# IrcClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IrcClient类属于命名空间,在下文中一共展示了IrcClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: StartModule
public virtual void StartModule(IrcClient irc, Server server)
{
this.server = server;
this.irc = irc;
AddBindings();
Load();
}
开发者ID:bwall,项目名称:bwall-s-smaller-projects,代码行数:7,代码来源:Module.cs
示例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));
}
开发者ID:randacc,项目名称:ChatSharp,代码行数:7,代码来源:ChannelHandlers.cs
示例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));
}
开发者ID:RockyTV,项目名称:ChatSharp,代码行数:7,代码来源:ChannelHandlers.cs
示例4: HandleMOTDNotFound
public static void HandleMOTDNotFound(IrcClient client, IrcMessage message)
{
client.OnMOTDRecieved(new ServerMOTDEventArgs(MOTD));
client.OnConnectionComplete(new EventArgs());
VerifyOurIdentity(client);
}
开发者ID:RockyTV,项目名称:ChatSharp,代码行数:7,代码来源:MOTDHandlers.cs
示例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);
}
开发者ID:KallDrexx,项目名称:SIS-cs,代码行数:31,代码来源:JoinCommand.cs
示例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 { }
开发者ID:andreujuanc,项目名称:CSharpBot,代码行数:30,代码来源:PluginList.cs
示例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;
}
}
}
开发者ID:RockyTV,项目名称:ChatSharp,代码行数:31,代码来源:ChannelHandlers.cs
示例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));
}
开发者ID:Roytazz,项目名称:TwitchLib,代码行数:7,代码来源:UserHandlers.cs
示例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[] {' '});
}
}
开发者ID:geeekzor,项目名称:GeekyIrc,代码行数:41,代码来源:IrcMessageData.cs
示例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"]);
}
开发者ID:bwall,项目名称:bwall-s-smaller-projects,代码行数:7,代码来源:IrcBot.cs
示例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;
}
开发者ID:jaddie,项目名称:WCell-Utility-Bot,代码行数:7,代码来源:IrcPacket.cs
示例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];
}
开发者ID:angelog,项目名称:ChatSharp,代码行数:8,代码来源:UserHandlers.cs
示例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);
}
开发者ID:bwall,项目名称:bwall-s-smaller-projects,代码行数:8,代码来源:OperatorList.cs
示例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));
}
开发者ID:jornvandebeek,项目名称:HitboxPlaysUnity,代码行数:8,代码来源:MOTDHandlers.cs
示例15: HandleEndOfMOTD
public static void HandleEndOfMOTD(IrcClient client, IrcMessage message)
{
client.OnMOTDRecieved(new ServerMOTDEventArgs(MOTD));
client.OnConnectionComplete(new EventArgs());
// Verify our identity
VerifyOurIdentity(client);
}
开发者ID:RockyTV,项目名称:ChatSharp,代码行数:8,代码来源:MOTDHandlers.cs
示例16: HandleInviteListPart
public static void HandleInviteListPart(IrcClient client, IrcMessage message)
{
var parameterString = message.RawMessage.Substring(message.RawMessage.IndexOf(' ') + 1);
var parameters = parameterString.Substring(parameterString.IndexOf(' ') + 1).Split(' ');
var request = client.RequestManager.PeekOperation("GETMODE I " + parameters[1]);
var list = (MaskCollection)request.State;
list.Add(new Mask(parameters[2], new IrcUser(parameters[3]), IrcClient.DateTimeFromIrcTime(int.Parse(parameters[4]))));
}
开发者ID:Luigifan,项目名称:Luigibot,代码行数:8,代码来源:ListingHandlers.cs
示例17: HandleQuietListPart
public static void HandleQuietListPart(IrcClient client, IrcMessage message)
{
var parameterString = message.RawMessage.Substring(message.RawMessage.IndexOf(' ') + 1);
var parameters = parameterString.Substring(parameterString.IndexOf(' ') + 1).Split(' ');
var request = RequestOperation.PeekOperation("QLIST " + parameters[1]);
var list = (List<Mask>)request.State;
list.Add(new Mask(parameters[2], new IrcUser(parameters[3]), IrcClient.DateTimeFromIrcTime(int.Parse(parameters[4]))));
}
开发者ID:angelog,项目名称:ChatSharp,代码行数:8,代码来源:ListingHandlers.cs
示例18: HandleJoin
public static void HandleJoin(IrcClient client, IrcMessage message)
{
var channel = client.Channels.GetOrAdd(message.Parameters[0]);
var user = client.Users.GetOrAdd(message.Prefix);
user.Channels.Add(channel);
if (channel != null)
client.OnUserJoinedChannel(new ChannelUserEventArgs(channel, new IrcUser(message.Prefix)));
}
开发者ID:RockyTV,项目名称:ChatSharp,代码行数:8,代码来源:ChannelHandlers.cs
示例19: HandlePart
public static void HandlePart(IrcClient client, IrcMessage message)
{
if (client.User.Match(message.Prefix)) // We've parted this channel
client.Channels.Remove(client.Channels[message.Parameters[0]]);
else // Someone has parted a channel we're already in
client.Channels[message.Parameters[0]].Users.Remove(new IrcUser(message.Prefix).Nick);
client.OnUserPartedChannel(new ChannelUserEventArgs(client.Channels[message.Parameters[0]], new IrcUser(message.Prefix)));
}
开发者ID:randacc,项目名称:ChatSharp,代码行数:8,代码来源:ChannelHandlers.cs
示例20: HandleMode
public static void HandleMode(IrcClient client, IrcMessage message)
{
string target, mode = null;
int i = 2;
if (message.Command == "MODE")
{
target = message.Parameters[0];
mode = message.Parameters[1];
}
else
{
target = message.Parameters[1];
mode = message.Parameters[2];
i++;
}
var eventArgs = new ModeChangeEventArgs(target, new IrcUser(message.Prefix), mode);
client.OnModeChanged(eventArgs);
// Handle change
bool add = mode[0] == '+';
mode = mode.Substring(1);
if (target.StartsWith("#"))
{
var channel = client.Channels[target];
foreach (char c in mode)
{
// TODO: Handle other types of MODEs
if (channel.Mode == null)
channel.Mode = string.Empty;
if (add)
{
if (!channel.Mode.Contains(c))
channel.Mode += c.ToString();
}
else
channel.Mode = channel.Mode.Replace(c.ToString(), string.Empty);
}
if (message.Command == "324")
{
var operation = client.RequestManager.DequeueOperation("MODE " + channel.Name);
operation.Callback(operation);
}
}
else
{
// TODO: Handle user modes other than ourselves?
foreach (char c in mode)
{
if (add)
{
if (!client.User.Mode.Contains(c))
client.User.Mode += c;
}
else
client.User.Mode = client.User.Mode.Replace(c.ToString(), string.Empty);
}
}
}
开发者ID:randacc,项目名称:ChatSharp,代码行数:58,代码来源:MessageHandlers.cs
注:本文中的IrcClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论