• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IrcMessage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IrcMessage的典型用法代码示例。如果您正苦于以下问题:C# IrcMessage类的具体用法?C# IrcMessage怎么用?C# IrcMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IrcMessage类属于命名空间,在下文中一共展示了IrcMessage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ProcessMessageEndOfStats

        protected internal void ProcessMessageEndOfStats(IrcMessage message)
        {
            Debug.Assert(message.Parameters[0] == localUser.NickName);

            OnServerStatsReceived(new IrcServerStatsReceivedEventArgs(listedStatsEntries));
            listedStatsEntries = new List<IrcServerStatisticalEntry>();
        }
开发者ID:IrcDotNet,项目名称:IrcDotNet,代码行数:7,代码来源:IrcClientMessageProcessing.cs


示例2: 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


示例3: Run

 public override void Run(IIrcUser client, IrcMessage message)
 {
     IrcChannel[] channels;
     if (message.Params.Length == 0)
     {
         channels = client.IrcServer.Channels.ToArray();
     }
     else
     {
         string[] channelList = message.Params[0].ToLower().Split(',');
         channels = client.IrcServer.Channels.Where(channel =>
             channelList.Contains(channel.Name.Replace(",", "").ToLower())
             ).ToArray();
     }
     channels.ForEach(channel =>
     {
         client.Write(new IrcNumericResponce
         {
             NumericId = IrcNumericResponceId.RPL_NAMEREPLY,
             Extra = "= " + channel.Name,
             Message = string.Join(" ",
                 channel.Users
                 .Where(user => !user.Mode.IsInvisible || channel.Users.Contains(client) || client.Mode.IsOperator)
                 .Select(user => string.Format("{0}{1}", user.ChannelModes[channel].NickPrefix, user.Nick)))
         });
     });
     client.Write(new IrcNumericResponce
     {
         NumericId = IrcNumericResponceId.RPL_ENDOFNAMES,
         Extra = client.Nick,
         Message = "End of names"
     });
 }
开发者ID:seaboy1234,项目名称:IRCSharp,代码行数:33,代码来源:NamesCommand.cs


示例4: IrcMsg_ToStringNoPrefixNoArgs

        public void IrcMsg_ToStringNoPrefixNoArgs()
        {
            var expected = "PING";

            var actual = new IrcMessage("PING", "");
            Assert.AreEqual(expected, actual.ToString());
        }
开发者ID:jakubgarfield,项目名称:Bonobo-Irc-Library,代码行数:7,代码来源:IrcMessage.cs


示例5: Run

 public override void Run(IIrcUser client, IrcMessage message)
 {
     if (message.Params.Length != 1)
     {
         SendMessage(IrcNumericResponceId.ERR_NONICKNAMEGIVEN, client, "No nickname given");
         return;
     }
     if (!IRC.CheckString(message.Params[0], IRC.NICKNAME))
     {
         SendMessage(IrcNumericResponceId.ERR_ERRONEUSNICKNAME, client, "Erroneous nickname");
         return;
     }
     if (!client.IrcServer.CheckNick(message.Params[0]))
     {
         SendMessage(IrcNumericResponceId.ERR_NICKNAMEINUSE, client, "Nickname is already in use");
         return;
     }
     string oldNick = client.Nick;
     client.Channels.ForEach(channel => channel.Nick(client, message.Params[0]));
     if (!string.IsNullOrEmpty(client.User))
     {
         Say(client, "NICK", message.Params[0]);
     }
     client.Nick = message.Params[0];
 }
开发者ID:seaboy1234,项目名称:IRCSharp,代码行数:25,代码来源:NickCommand.cs


示例6: Run

 public override void Run(IIrcUser client, IrcMessage message)
 {
     if (message.Params.Length != 1)
     {
         SendMessage(IrcNumericResponceId.ERR_NEEDMOREPARAMS, client, "Not enough parameters");
         return;
     }
     if (IRC.IsChannel(message.Params[0]))
     {
         IrcChannel channel = client.IrcServer.Channels.Where(ch => ch.Name == message.Params[0]).FirstOrDefault();
         if (channel == null)
         {
             return;
         }
         channel.Users.ForEach(cli => cli.Write(new IrcNumericResponce()
         {
             NumericId = IrcNumericResponceId.RPL_WHOREPLY,
             Message = cli.UserString
         }));
         client.Write(new IrcNumericResponce()
         {
             NumericId = IrcNumericResponceId.RPL_ENDOFWHO,
             Message = "End of who"
         });
     }
 }
开发者ID:seaboy1234,项目名称:IRCSharp,代码行数:26,代码来源:WhoCommand.cs


示例7: IrcMsg_ToStringArgWithSpace

        public void IrcMsg_ToStringArgWithSpace()
        {
            var expected = ":prefix PRIVMSG blabla :string with a lot of spaces";
            var actual = new IrcMessage("PRIVMSG", "prefix", "blabla", "string with a lot of spaces");

            Assert.AreEqual(expected, actual.ToString());
        }
开发者ID:jakubgarfield,项目名称:Bonobo-Irc-Library,代码行数:7,代码来源:IrcMessage.cs


示例8: Run

        // Syntax: INVITE <nick> <channel>
        public override void Run(IIrcUser client, IrcMessage message)
        {
            if (message.Params.Length != 2)
            {
                NeedMoreParamsError(client);
                return;
            }
            if (client.IrcServer.CheckNick(message.Params[0]))
            {
                NotFoundError(client, false);
                return;
            }
            if (!IRC.IsChannel(message.Params[1]) || !client.IrcServer.ChannelExists(message.Params[1]))
            {
                NotFoundError(client, true);
                return;
            }

            IrcChannel channel = client.IrcServer.GetChannel(message.Params[1]);
            IIrcUser user = client.IrcServer.Clients.Find(cli => cli.Nick == message.Params[0]);
            if (!user.ChannelModes.ContainsKey(channel))
            {
                user.ChannelModes.Add(channel, new IrcChannelUserMode());
            }
            IrcChannelUserMode mode = user.ChannelModes[channel];
            mode.IsInvited = true;
            channel.Command(client, "INVITE", user.Nick);
            client.Write(new IrcNumericResponce
            {
                NumericId = IrcNumericResponceId.RPL_INVITING,
                To = channel.Name,
                Extra = client.Nick,
                Message = "invited."
            });
        }
开发者ID:seaboy1234,项目名称:IRCSharp,代码行数:36,代码来源:InviteCommand.cs


示例9: 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


示例10: 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


示例11: IrcMessenger

        public IrcMessenger()
        {
            var server = Config.Get("Irc.Server");
            var nick = Config.Get("Irc.Nick", Config.Get("Name", "gambot"));
            var user = Config.Get("Irc.User", nick);
            var password = Config.Get("Irc.Password");
            var ssl = Config.GetBool("Irc.Ssl");
            client = new IrcClient(server, new IrcUser(nick, user, password),
                                   ssl);

            client.SetHandler("372", (c, m) => { }); // Ignore MOTD

            client.PrivateMessageRecieved += (sender, args) =>
            {
                if (MessageReceived != null)
                {
                    var message = new IrcMessage(args.PrivateMessage);
                    MessageReceived(this,
                                    new MessageEventArgs
                                    {
                                        Message = message,
                                        Addressed =
                                            (!args.PrivateMessage
                                                  .IsChannelMessage ||
                                             String.Equals(message.To, nick,
                                                           StringComparison
                                                               .CurrentCultureIgnoreCase))
                                    });
                }
            };

            client.ConnectAsync();
        }
开发者ID:Milk-Enterprises,项目名称:Gambot,代码行数:33,代码来源:IrcMessenger.cs


示例12: 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


示例13: 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


示例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: 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


示例16: Run

 public override void Run(IIrcUser client, IrcMessage message)
 {
     client.Write(new IrcMessage
     {
         Command = "PONG",
         Params = message.Params
     });
 }
开发者ID:seaboy1234,项目名称:IRCSharp,代码行数:8,代码来源:PingCommand.cs


示例17: 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


示例18: 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


示例19: 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


示例20: 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



注:本文中的IrcMessage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IrcMessageEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# IrcClient类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap