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

C# IceChatPlugin.PluginArgs类代码示例

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

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



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

示例1: Plugin_OnCommand

 private void Plugin_OnCommand(PluginArgs e)
 {
     if (e.Command != null)
     {
         if (e.Connection != null)
             ParseOutGoingCommand(e.Connection, e.Command);
         else
         {
             if (e.Extra == "current")
                 ParseOutGoingCommand(inputPanel.CurrentConnection, e.Command);
             else
                 ParseOutGoingCommand(null, e.Command);
         }
     }
 }
开发者ID:origins,项目名称:ICEChat,代码行数:15,代码来源:FormMain.cs


示例2: OnChannelKickSelf

        /// <summary>
        /// You where Kicked from a Channel
        /// </summary>
        /// <param name="connection">Which Connection it came from</param>
        /// <param name="channel">Which Channel you were kicked from</param>
        /// <param name="reason">Kick Reason</param>
        /// <param name="kickUser">Full User Host of who kicked you</param>
        private void OnChannelKickSelf(IRCConnection connection, string channel, string reason, string kickUser)
        {
            try
            {
                IceTabPage t = GetWindow(connection, channel, IceTabPage.WindowType.Channel);
                if (iceChatOptions.ChannelOpenKick)
                {
                    if (t != null)
                    {
                        t.ClearNicks();
                        t.IsFullyJoined = false;
                        t.GotNamesList = false;
                        t.GotWhoList = false;

                        if (CurrentWindow == t)
                            nickList.Header = t.TabCaption + ":0";

                        FormMain.Instance.NickList.Invalidate();
                    }
                }
                else
                {
                    RemoveWindow(connection, channel, IceTabPage.WindowType.Channel);
                }

                string nick = NickFromFullHost(kickUser);
                string host = HostFromFullHost(kickUser);

                string msg = GetMessageFormat("Self Channel Kick");
                msg = msg.Replace("$nick", connection.ServerSetting.NickName);
                msg = msg.Replace("$kicker", nick);
                msg = msg.Replace("$host", host);
                msg = msg.Replace("$channel", channel);
                msg = msg.Replace("$reason", reason);

                PluginArgs args = new PluginArgs(mainTabControl.GetTabPage("Console").TextWindow, channel, nick, connection.ServerSetting.NickName, msg);
                args.Extra = reason;
                args.Connection = connection;

                foreach (IPluginIceChat ipc in loadedPlugins)
                {
                    if (ipc.Enabled == true)
                    {
                        System.Diagnostics.Debug.WriteLine(ipc.Name);
                        args = ipc.ChannelKick(args);
                    }
                }
                if (iceChatOptions.ChannelOpenKick)
                {
                    if (t != null)
                        t.TextWindow.AppendText(args.Message, 1);
                    else
                        mainTabControl.GetTabPage("Console").AddText(connection, args.Message, 1, false);
                }
                else
                    mainTabControl.GetTabPage("Console").AddText(connection, args.Message, 1, false);

            }
            catch (Exception e)
            {
                WriteErrorFile(connection, "OnKickSelf", e);
            }
        }
开发者ID:origins,项目名称:ICEChat,代码行数:70,代码来源:FormMainEvents.cs


示例3: OnChannelMode

        /// <summary>
        /// Channel Mode Changed
        /// </summary>
        /// <param name="connection">Which Connection it came from</param>
        /// <param name="modeSetter">Who set the mode(s)</param>
        /// <param name="channel">Channel which mode change is for</param>
        /// <param name="fullmode">All the modes and parameters</param>
        private void OnChannelMode(IRCConnection connection, string modeSetter, string modeSetterHost, string channel, string fullmode)
        {
            try
            {
                string mode = "";
                string parameter = "";

                if (fullmode.IndexOf(' ') == -1)
                {
                    mode = fullmode;
                }
                else
                {
                    mode = fullmode.Substring(0, fullmode.IndexOf(' '));
                    parameter = fullmode.Substring(fullmode.IndexOf(' ') + 1);
                }

                string msg = GetMessageFormat("Channel Mode");
                msg = msg.Replace("$modeparam", parameter);
                msg = msg.Replace("$mode", mode);
                msg = msg.Replace("$nick", modeSetter);
                msg = msg.Replace("$host", modeSetterHost);
                msg = msg.Replace("$channel", channel);

                IceTabPage chan = GetWindow(connection, channel, IceTabPage.WindowType.Channel);
                if (chan != null)
                {
                    PluginArgs args = new PluginArgs(chan, channel, modeSetter, modeSetterHost, msg);
                    args.Extra = fullmode;
                    args.Connection = connection;

                    foreach (IPluginIceChat ipc in loadedPlugins)
                    {
                        if (ipc.Enabled == true)
                            ipc.ChannelMode(args);
                    }

                    if (modeSetter != channel)
                    {
                        if (iceChatOptions.ModeEventLocation == 0)
                        {
                            chan.TextWindow.AppendText(msg, 1);
                            chan.LastMessageType = ServerMessageType.Other;
                        }
                        else if (iceChatOptions.ModeEventLocation == 1)
                        {
                            //send it to the console
                            mainTabControl.GetTabPage("Console").AddText(connection, msg, 1, false);
                        }
                    }
                    else
                    {
                        chan.ChannelModes = fullmode.Trim();
                    }

                    string[] parameters = parameter.Split(new char[] { ' ' });

                    bool addMode = false;
                    int modelength = mode.Length;
                    string temp;

                    IEnumerator parametersEnumerator = parameters.GetEnumerator();
                    parametersEnumerator.MoveNext();
                    for (int i = 0; i < modelength; i++)
                    {
                        switch (mode[i])
                        {
                            case '-':
                                addMode = false;
                                break;
                            case '+':
                                addMode = true;
                                break;
                            case 'b':
                                //handle bans seperately
                                temp = (string)parametersEnumerator.Current;
                                parametersEnumerator.MoveNext();
                                break;
                            default:
                                //check if it's a status mode which can vary by server
                                //temp = (string)parametersEnumerator.Current;
                                bool isChecked = false;

                                for (int j = 0; j < connection.ServerSetting.StatusModes[0].Length; j++)
                                {
                                    if (mode[i] == connection.ServerSetting.StatusModes[0][j])
                                    {
                                        temp = (string)parametersEnumerator.Current;
                                        //make sure its not an address
                                        if (temp.IndexOf("@") == -1)
                                        {
                                            chan.UpdateNick(temp, connection.ServerSetting.StatusModes[1][j].ToString(), addMode);
                                            parametersEnumerator.MoveNext();
//.........这里部分代码省略.........
开发者ID:origins,项目名称:ICEChat,代码行数:101,代码来源:FormMainEvents.cs


示例4: OnChannelInvite

        /// <summary>
        /// When a User Invites you to a Channel
        /// </summary>
        /// <param name="connection">Which connection it came from</param>
        /// <param name="channel">The channel you are being invited to</param>
        /// <param name="nick">The nick who invited you</param>
        /// <param name="host">The host of the nick who invited you</param>
        private void OnChannelInvite(IRCConnection connection, string channel, string nick, string host)
        {
            string msg = GetMessageFormat("Channel Invite");
            msg = msg.Replace("$channel", channel).Replace("$nick", nick).Replace("$host", host);

            mainTabControl.GetTabPage("Console").AddText(connection, msg, 1, false);

            if (!connection.ServerSetting.DisableSounds)
                PlaySoundFile("conmsg");

            PluginArgs args = new PluginArgs(mainTabControl.GetTabPage("Console").TextWindow, channel, nick, host, msg);
            args.Connection = connection;

            foreach (IPluginIceChat ipc in loadedPlugins)
            {
                if (ipc.Enabled == true)
                    ipc.ChannelInvite(args);
            }
        }
开发者ID:origins,项目名称:ICEChat,代码行数:26,代码来源:FormMainEvents.cs


示例5: OnChannelJoinSelf

        /// <summary>
        /// You have Joined a Channel
        /// </summary>
        /// <param name="connection">Which Connection it came from</param>
        /// <param name="channel">Which Channel you joined</param>
        private void OnChannelJoinSelf(IRCConnection connection, string channel)
        {
            //check if channel window already exists
            IceTabPage t = GetWindow(connection, channel, IceTabPage.WindowType.Channel);
            if (t == null)
            {
                t = AddWindow(connection, channel, IceTabPage.WindowType.Channel);

                PluginArgs args = new PluginArgs(t.TextWindow, channel, connection.ServerSetting.NickName, "", "");
                args.Connection = connection;

                foreach (IPluginIceChat ipc in loadedPlugins)
                {
                    if (ipc.Enabled == true)
                        ipc.ChannelJoin(args);
                }

                serverTree.Invalidate();
            }
            else
            {
                PluginArgs args = new PluginArgs(t.TextWindow, channel, connection.ServerSetting.NickName, "", "");
                args.Connection = connection;

                foreach (IPluginIceChat ipc in loadedPlugins)
                {
                    if (ipc.Enabled == true)
                        ipc.ChannelJoin(args);
                }

                serverTree.Invalidate();
            }
        }
开发者ID:origins,项目名称:ICEChat,代码行数:38,代码来源:FormMainEvents.cs


示例6: OnServerQuit

        /// <summary>
        /// A User Quit the Server
        /// </summary>
        /// <param name="connection">Which Connection it came from</param>
        /// <param name="user">Which Nick quit the Server</param>
        /// <param name="reason">Quit Reason</param>
        private void OnServerQuit(IRCConnection connection, string nick, string host, string reason)
        {
            PluginArgs args = null;

            string msg = GetMessageFormat("Server Quit");
            msg = msg.Replace("$nick", nick);
            msg = msg.Replace("$host", host);
            msg = msg.Replace("$reason", reason);

            args = new PluginArgs(mainTabControl.GetTabPage("Console").TextWindow, "", nick, host, msg);
            args.Extra = reason;
            args.Connection = connection;

            foreach (IPluginIceChat ipc in loadedPlugins)
            {
                if (ipc.Enabled == true)
                    args = ipc.ServerQuit(args);
            }

            foreach (IceTabPage t in mainTabControl.TabPages)
            {
                if (t.Connection == connection)
                {
                    if (t.WindowStyle == IceTabPage.WindowType.Channel)
                    {
                        if (t.NickExists(nick) == true)
                        {
                            if (iceChatOptions.QuitEventLocation == 0)
                            {
                                //send it to the channel
                                t.TextWindow.AppendText(args.Message, 1);
                                t.LastMessageType = ServerMessageType.QuitServer;
                            }
                            t.RemoveNick(nick);
                        }
                    }
                    if (t.WindowStyle == IceTabPage.WindowType.Query)
                    {
                        if (t.TabCaption == nick)
                        {
                            t.TextWindow.AppendText(args.Message, 1);
                            t.LastMessageType = ServerMessageType.QuitServer;
                        }
                    }
                }
            }
            if (iceChatOptions.QuitEventLocation == 1)
            {
                //send the message to the Console
                if (args != null)
                    mainTabControl.GetTabPage("Console").AddText(connection, args.Message, 1, false);
            }
        }
开发者ID:origins,项目名称:ICEChat,代码行数:59,代码来源:FormMainEvents.cs


示例7: OnWhoisData

        /// <summary>
        /// Received Whois Data on a Nick
        /// </summary>
        /// <param name="connection">Which Connection it came from</param>
        /// <param name="nick">The nick whois data is from</param>
        /// <param name="data">The Whois data</param>
        private void OnWhoisData(IRCConnection connection, string nick, string data)
        {
            string msg = GetMessageFormat("User Whois");
            msg = msg.Replace("$nick", nick);
            msg = msg.Replace("$data", data);

            PluginArgs args = new PluginArgs(mainTabControl.GetTabPage("Console").TextWindow, "", nick, "", msg);
            args.Connection = connection;

            foreach (IPluginIceChat ipc in loadedPlugins)
            {
                if (ipc.Enabled == true)
                    ipc.WhoisUser(args);
            }

            if (iceChatOptions.WhoisEventLocation == 2) //hide the event
                return;

            //check if there is a query window open
            IceTabPage t = GetWindow(connection, nick, IceTabPage.WindowType.Query);
            if (t != null)
            {
                if (iceChatOptions.WhoisEventLocation == 0)
                {
                    t.TextWindow.AppendText(msg, 1);
                    t.LastMessageType = ServerMessageType.Message;
                }
                else
                {
                    mainTabControl.GetTabPage("Console").AddText(connection, msg, 1, false);
                }
            }
            else
            {
                if (iceChatOptions.WhoisEventLocation == 0)
                    //send whois data to the current window
                    CurrentWindowMessage(connection, msg, 1, false);
                else
                    mainTabControl.GetTabPage("Console").AddText(connection, msg, 1, false);

            }
        }
开发者ID:origins,项目名称:ICEChat,代码行数:48,代码来源:FormMainEvents.cs


示例8: OnCtcpReply

        /// <summary>
        /// Show a reply to a CTCP Message we have sent out
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="nick"></param>
        /// <param name="ctcp"></param>
        /// <param name="message"></param>
        private void OnCtcpReply(IRCConnection connection, string nick, string ctcp, string message)
        {
            //we got a ctcp reply
            string msg = GetMessageFormat("Ctcp Reply");
            msg = msg.Replace("$nick", nick);
            msg = msg.Replace("$ctcp", ctcp);
            msg = msg.Replace("$reply", message);

            PluginArgs args = new PluginArgs(mainTabControl.GetTabPage("Console").TextWindow, "", nick, "", msg);
            args.Extra = ctcp;
            args.Connection = connection;

            foreach (IPluginIceChat ipc in loadedPlugins)
            {
                if (ipc.Enabled == true)
                    args = ipc.CtcpReply(args); ;
            }

            CurrentWindowMessage(connection, args.Message, 7, false);
        }
开发者ID:origins,项目名称:ICEChat,代码行数:27,代码来源:FormMainEvents.cs


示例9: OnDCCChat

        private void OnDCCChat(IRCConnection connection, string nick, string host, string port, string ip)
        {
            //check if we have disabled DCC Chats, do we auto-accept or ask to allow
            if (iceChatOptions.DCCChatIgnore)
                return;

            if (!iceChatOptions.DCCChatAutoAccept)
            {
                //check if on System Tray
                if (notifyIcon.Visible)
                    return;

                //ask for the dcc chat
                DialogResult askDCC = MessageBox.Show(nick + "@" + host + " wants a DCC Chat, will you accept?", "DCC Chat Request", MessageBoxButtons.YesNo);
                if (askDCC == DialogResult.No)
                    return;

            }

            if (!mainTabControl.WindowExists(connection, nick, IceTabPage.WindowType.DCCChat))
                AddWindow(connection, nick, IceTabPage.WindowType.DCCChat);

            IceTabPage t = GetWindow(connection, nick, IceTabPage.WindowType.DCCChat);
            if (t != null)
            {
                string msg = GetMessageFormat("DCC Chat Request");
                msg = msg.Replace("$nick", nick).Replace("$host", host);
                msg = msg.Replace("$port", port).Replace("$ip", ip);

                PluginArgs args = new PluginArgs(t.TextWindow, "", nick, host, msg);
                args.Connection = connection;

                foreach (IPluginIceChat ipc in loadedPlugins)
                {
                    //new dcc chat started
                    if (ipc.Enabled == true)
                        args = ipc.DCCChatOpen(args);
                }

                t.TextWindow.AppendText(args.Message, 1);
                t.StartDCCChat(nick, ip, port);
                t.LastMessageType = ServerMessageType.Other;
            }
        }
开发者ID:origins,项目名称:ICEChat,代码行数:44,代码来源:FormMainEvents.cs


示例10: OnChannelTopic

        /// <summary>
        /// Channel Topic Changed
        /// </summary>
        /// <param name="connection">Which Connection it came from</param>
        /// <param name="channel">Which Channel the Topic changed for</param>
        /// <param name="nick">Nick who changed the Topic</param>
        /// <param name="topic">New Channel Topic</param>
        private void OnChannelTopic(IRCConnection connection, string channel, string nick, string host, string topic)
        {
            IceTabPage t = GetWindow(connection, channel, IceTabPage.WindowType.Channel);
            if (t != null)
            {
                t.ChannelTopic = topic;

                if (nick.Length > 0)
                {
                    string msg = GetMessageFormat("Channel Topic Change");
                    msg = msg.Replace("$nick", nick);
                    msg = msg.Replace("$host", host);
                    msg = msg.Replace("$channel", channel);
                    msg = msg.Replace("$topic", topic);

                    if (iceChatOptions.TopicEventLocation == 0)
                    {
                        //send it to the channel
                        t.TextWindow.AppendText(msg, 1);
                        t.LastMessageType = ServerMessageType.Other;
                    }
                    else if (iceChatOptions.TopicEventLocation == 1)
                    {
                        //send it to the console
                        mainTabControl.GetTabPage("Console").AddText(connection, msg, 1, false);
                    }

                    PluginArgs args = new PluginArgs(t, channel, nick, host, msg);
                    args.Connection = connection;

                    foreach (IPluginIceChat ipc in loadedPlugins)
                    {
                        if (ipc.Enabled == true)
                            ipc.ChannelTopic(args);
                    }

                }
                else
                {
                    string msgt = GetMessageFormat("Channel Topic Text");
                    msgt = msgt.Replace("$channel", channel);
                    msgt = msgt.Replace("$topic", topic);

                    t.TextWindow.AppendText(msgt, 1);
                    t.LastMessageType = ServerMessageType.Other;

                    PluginArgs args = new PluginArgs(t, channel, nick, host, msgt);
                    args.Connection = connection;

                    foreach (IPluginIceChat ipc in loadedPlugins)
                    {
                        if (ipc.Enabled == true)
                            ipc.ChannelTopic(args);
                    }

                }

            }
        }
开发者ID:origins,项目名称:ICEChat,代码行数:66,代码来源:FormMainEvents.cs


示例11: OnCtcpMessage

        /// <summary>
        /// Received a CTCP Message
        /// </summary>
        /// <param name="connection">Which Connection it came from</param>
        /// <param name="nick">The Nick who sent the CTCP Message</param>
        /// <param name="ctcp">The CTCP Message</param>
        private void OnCtcpMessage(IRCConnection connection, string nick, string ctcp, string message)
        {
            //we need to send a ctcp reply
            string msg = GetMessageFormat("Ctcp Request");
            msg = msg.Replace("$nick", nick);
            msg = msg.Replace("$ctcp", ctcp);

            PluginArgs args = new PluginArgs(mainTabControl.GetTabPage("Console").TextWindow, "", nick,"", msg);
            args.Extra = ctcp;
            args.Connection = connection;

            foreach (IPluginIceChat ipc in loadedPlugins)
            {
                if (ipc.Enabled == true)
                    args = ipc.CtcpMessage(args);
            }

            //check if CTCP's are enabled
            if (connection.ServerSetting.DisableCTCP)
                return;

            CurrentWindowMessage(connection, args.Message, 7, false);

            switch (ctcp)
            {
                case "VERSION":
                    SendData(connection, "NOTICE " + nick + " :" + ((char)1).ToString() + "VERSION " + ProgramID + " " + VersionID + " : " + GetOperatingSystemName() + ((char)1).ToString());
                    break;
                case "PING":
                    SendData(connection, "NOTICE " + nick + " :" + ((char)1).ToString() + "PING " + System.Environment.TickCount.ToString() + ((char)1).ToString());
                    break;
                case "TIME":
                    SendData(connection, "NOTICE " + nick + " :" + ((char)1).ToString() + "TIME " + System.DateTime.Now.ToString() + ((char)1).ToString());
                    break;
                case "USERINFO":
                    SendData(connection, "NOTICE " + nick + " :" + ((char)1).ToString() + "USERINFO IceChat IRC Client : Download at http://www.icechat.net" + ((char)1).ToString());
                    break;
                case "CLIENTINFO":
                    SendData(connection, "NOTICE " + nick + " :" + ((char)1).ToString() + "CLIENTINFO This client supports: UserInfo, Finger, Version, Source, Ping, Time and ClientInfo" + ((char)1).ToString());
                    break;
                case "SOURCE":
                    SendData(connection, "NOTICE " + nick + " :" + ((char)1).ToString() + "SOURCE " + FormMain.ProgramID + " " + FormMain.VersionID + " http://www.icechat.net" + ((char)1).ToString());
                    break;
                case "FINGER":
                    SendData(connection, "NOTICE " + nick + " :" + ((char)1).ToString() + "FINGER Stop fingering me" + ((char)1).ToString());
                    break;

            }
        }
开发者ID:origins,项目名称:ICEChat,代码行数:55,代码来源:FormMainEvents.cs


示例12: OnChannelPartSelf

        /// <summary>
        /// You have Parted/Left a Channel
        /// </summary>
        /// <param name="connection">Which Connection it came from</param>
        /// <param name="channel">Which Channel you parted</param>
        private void OnChannelPartSelf(IRCConnection connection, string channel)
        {
            string reason = "";
            string msg = GetMessageFormat("Self Channel Part");
            msg = msg.Replace("$nick", connection.ServerSetting.NickName).Replace("$channel", channel);
            msg = msg.Replace("$reason", reason);

            IceTabPage t = GetWindow(connection, channel, IceTabPage.WindowType.Channel);
            if (t != null)
            {
                t.IsFullyJoined = false;
                t.GotNamesList = false;
                t.GotWhoList = false;
                t.ClearNicks();
            }

            PluginArgs args = new PluginArgs(mainTabControl.GetTabPage("Console").TextWindow, channel, connection.ServerSetting.NickName , "", msg);
            args.Connection = connection;

            foreach (IPluginIceChat ipc in loadedPlugins)
            {
                if (ipc.Enabled == true)
                    args = ipc.ChannelPart(args);
            }

            mainTabControl.GetTabPage("Console").AddText(connection, args.Message, 1, false);

            if (t != null)
                RemoveWindow(connection, channel, IceTabPage.WindowType.Channel);
        }
开发者ID:origins,项目名称:ICEChat,代码行数:35,代码来源:FormMainEvents.cs


示例13: OnBuddyList

        private void OnBuddyList(IRCConnection connection, string[] buddies)
        {
            PluginArgs args = new PluginArgs(connection);

            foreach (BuddyListItem b in connection.ServerSetting.BuddyList)
            {
                if (b.IsOnSent && !b.IsOnReceived)
                {
                    bool isFound = false;
                    foreach (string buddy in buddies)
                    {
                        //this nick is connected
                        if (b.Nick.ToLower() == buddy.ToLower())
                        {
                            b.Connected = true;
                            b.IsOnReceived = true;
                            isFound = true;

                            args.Nick = b.Nick;
                            args.Extra = "online";
                            foreach (IPluginIceChat ipc in loadedPlugins)
                            {
                                if (ipc.Enabled == true)
                                    ipc.BuddyList(args);
                            }
                        }
                    }
                    if (!isFound)
                    {
                        b.Connected = false;
                        b.IsOnReceived = true;

                        args.Nick = b.Nick;
                        args.Extra = "offline";
                        foreach (IPluginIceChat ipc in loadedPlugins)
                        {
                            if (ipc.Enabled == true)
                                ipc.BuddyList(args);
                        }
                    }
                }
            }

            if (connection.buddiesIsOnSent == connection.ServerSetting.BuddyList.Length)
            {
                //reset all the isonsent values
                foreach (BuddyListItem buddy in connection.ServerSetting.BuddyList)
                {
                    buddy.IsOnSent = false;
                    buddy.IsOnReceived = false;
                }
                connection.buddiesIsOnSent = 0;

                //send a user event to refresh the buddy list for this server
                this.buddyList.ClearBuddyList(connection);

                foreach (BuddyListItem buddy in connection.ServerSetting.BuddyList)
                {
                    this.buddyList.UpdateBuddy(connection, buddy);
                }

            }
        }
开发者ID:origins,项目名称:ICEChat,代码行数:63,代码来源:FormMainEvents.cs


示例14: ParseOutGoingCommand

        /// <summary>
        /// Parse out command written in Input Box or sent from Plugin
        /// </summary>
        /// <param name="connection">Which Connection it is for</param>
        /// <param name="data">The Message to Parse</param>
        public void ParseOutGoingCommand(IRCConnection connection, string data)
        {
            try
            {
                data = data.Replace("&#x3;", ((char)3).ToString());

                PluginArgs args = new PluginArgs(connection);
                args.Command = data;

                foreach (IPluginIceChat ipc in loadedPlugins)
                {
                    if (ipc.Enabled == true)
                        args = ipc.InputText(args);
                }

                data = args.Command;

                if (data.Length == 0)
                    return;

                if (data.StartsWith("//"))
                {
                    //parse out identifiers
                    ParseOutGoingCommand(connection, ParseIdentifiers(connection, data, data));
                    return;
                }

                if (data.StartsWith("/"))
                {
                    int indexOfSpace = data.IndexOf(" ");
                    string command = "";
                    string temp = "";

                    if (indexOfSpace > 0)
                    {
                        command = data.Substring(0, indexOfSpace);
                        data = data.Substring(command.Length + 1);
                    }
                    else
                    {
                        command = data;
                        data = "";
                    }

                    //check for aliases
                    foreach (AliasItem a in iceChatAliases.listAliases)
                    {
                        if (a.AliasName == command)
                        {
                            if (a.Command.Length == 1)
                            {
                                data = ParseIdentifierValue(a.Command[0], data);
                                ParseOutGoingCommand(connection, ParseIdentifiers(connection, data, data));
                            }
                            else
                            {
                                //it is a multulined alias, run multiple commands
                                foreach (string c in a.Command)
                                {
                                    data = ParseIdentifierValue(c, data);
                                    ParseOutGoingCommand(connection, ParseIdentifiers(connection, data, data));
                                }
                            }
                            return;
                        }
                    }

                    switch (command.ToLower())
                    {
                        case "/makeexception":
                            throw new Exception("IceChat 9 Test Exception Error");

                        case "/addlines":
                            for (int i = 0; i < 250; i++)
                            {
                                string msg = i.ToString() + ". The quick brown fox jumps over the lazy dog and gets away with it";
                                CurrentWindowMessage(connection, msg, 4, true);
                            }
                            break;

                        case "/background":
                        case "/bg": //change background image for a window(s)
                            if (data.Length > 0)
                            {
                                //bg windowtype imagefile
                                //bg windowtype windowname imagefile
                                //if imagefile is blank, erase background image
                                string window = data.Split(' ')[0];
                                string file = "";
                                if (data.IndexOf(' ') > -1)
                                    file = data.Substring(window.Length + 1);

                                switch (window.ToLower())
                                {
                                    case "nicklist":
//.........这里部分代码省略.........
开发者ID:origins,项目名称:ICEChat,代码行数:101,代码来源:FormMain.cs


示例15: OnServerNotice

        /// <summary>
        /// Received a Server Notice 
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="message"></param>
        private void OnServerNotice(IRCConnection connection, string message)
        {
            string msg = GetMessageFormat("Server Notice");
            if (connection.ServerSetting.RealServerName.Length > 0)
                msg = msg.Replace("$server", connection.ServerSetting.RealServerName);
            else
                msg = msg.Replace("$server", connection.ServerSetting.ServerName);
            msg = msg.Replace("$message", message);

            PluginArgs args = new PluginArgs(mainTabControl.GetTabPage("Console").TextWindow, "", "", connection.ServerSetting.RealServerName, msg);
            args.Extra = message;
            args.Connection = connection;

            foreach (IPluginIceChat ipc in loadedPlugins)
            {
                if (ipc.Enabled == true)
                    args = ipc.ServerNotice(args);
            }

            mainTabControl.GetTabPage("Console").AddText(connection, args.Message, 1, false);
            if (!connection.ServerSetting.DisableSounds)
                PlaySoundFile("conmsg");
        }
开发者ID:origins,项目名称:ICEChat,代码行数:28,代码来源:FormMainEvents.cs


示例16: OnQueryAction

        /// <summary>
        /// Received a Query/Private Message action
        /// </summary>
        /// <param name="connection">Which Connection it came from</param>
        /// <param name="nick">Nick who sent the action</param>
        /// <param name="message">Query Action Message</param>
        private void OnQueryAction(IRCConnection connection, string nick, string host, string message)
        {
            if (!mainTabControl.WindowExists(connection, nick, IceTabPage.WindowType.Query) && iceChatOptions.DisableQueries)
                return;

            if (!mainTabControl.WindowExists(connection, nick, IceTabPage.WindowType.Query))
                AddWindow(connection, nick, IceTabPage.WindowType.Query);

            IceTabPage t = GetWindow(connection, nick, IceTabPage.WindowType.Query);
            if (t != null)
            {
                string msg = GetMessageFormat("Private Action");
                msg = msg.Replace("$nick", nick).Replace("$host", host);
                msg = msg.Replace("$message", message);

                PluginArgs args = new PluginArgs(t.TextWindow, "", nick, host, msg);
                args.Extra = message;
                args.Connection = connection;

                foreach (IPluginIceChat ipc in loadedPlugins)
                {
                    if (ipc.Enabled == true)
                        args = ipc.QueryAction(args);
                }

                t.TextWindow.AppendText(args.Message, 1);

                //make the tabcaption proper case
                if (t.TabCaption != nick)
                    t.TabCaption = nick;

                t.LastMessageType = ServerMessageType.Action;
            }
        }
开发者ID:origins,项目名称:ICEChat,代码行数:40,代码来源:FormMainEvents.cs


示例17: OnServerPreConnect

        private void OnServerPreConnect(IRCConnection connection)
        {
            PluginArgs args = new PluginArgs(connection);

            foreach (IPluginIceChat ipc in loadedPlugins)
            {
                if (ipc.Enabled == true)
                    ipc.ServerPreConnect(args);
            }
        }
开发者ID:origins,项目名称:ICEChat,代码行数:10,代码来源:FormMainEvents.cs


示例18: OnQueryMessage

        /// <summary>
        /// Received a Query/Private Message 
        /// </summary>
        /// <param name="connection">Which Connection it came from</param>
        /// <param name="nick">Nick who sent the message</param>
        /// <param name="message">Query Message</param>
        private void OnQueryMessage(IRCConnection connection, string nick, string host, string message)
        {
            if (!mainTabControl.WindowExists(connection, nick, IceTabPage.WindowType.Query) && iceChatOptions.DisableQueries)
                return;

            if (!mainTabControl.WindowExists(connection, nick, IceTabPage.WindowType.Query))
                AddWindow(connection, nick, IceTabPage.WindowType.Query);

            IceTabPage t = GetWindow(connection, nick, IceTabPage.WindowType.Query);
            if (t != null)
            {
                string msg = GetMessageFormat("Private Message");
                msg = msg.Replace("$nick", nick).Replace("$host", host);
                msg = msg.Replace("$message", message);

                PluginArgs args = new PluginArgs(t.TextWindow, "", nick, host, msg);
                args.Extra = message;
                args.Connection = connection;

                foreach (IPluginIceChat ipc in loadedPlugins)
                {
                    if (ipc.Enabled == true)
                        args = ipc.QueryMessage(args);
                }

                if (args.Message.Contains(connection.ServerSetting.NickName))
                {
                    //check if sounds are disabled for this window
                    if (!t.DisableSounds)
                        PlaySoundFile("nickchan");
                }

                t.TextWindow.AppendText(msg, 1);

                //make the tabcaption proper case
                if (t.TabCaption != nick)
                    t.TabCaption = nick;

                t.LastMessageType = ServerMessageType.Message;

                if (!t.DisableSounds)
                    PlaySoundFile("privmsg");

            }
        }
开发者ID:origins,

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IceInternal.BasicStream类代码示例发布时间:2022-05-26
下一篇:
C# Ice.InitializationData类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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