Пример #1
0
        /// <summary>
        /// �N���̃j�b�N�l�[�����ύX���ꂽ�Ƃ�
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void ircClient_ChangedNickname(object sender, NickNameChangeEventArgs e)
        {
            List<string> list;

            // priv�p�`�����l���ŁA�g�[�N���Ă�l�̖��O����������ꍇ
            if (m_channel.ContainsKey(IRCClient.GetUserName(e.Before)))
            {
                // �`�����l���ړ�
                Channel talkch = m_channel[IRCClient.GetUserName(e.Before)];
                talkch.Name = IRCClient.GetUserName(e.After);
                m_channel.Add(IRCClient.GetUserName(e.After), talkch);
                m_channel.Remove(IRCClient.GetUserName(e.Before));

                // ���݂̃`�����l����������A�t�H�[���̏�Ԃ�X�V����
                if (m_currentCh == talkch)
                    LoadChannel(m_currentCh);

                // �`�����l���ύX��ʒm
                AddLog(talkch, string.Format(Resources.NicknameChangedMessage, IRCClient.GetUserName(e.Before), IRCClient.GetUserName(e.After)));
            }

            // �S�`�����l���ɂ‚���
            foreach (Channel ch in m_channel.Values)
            {
                list = new List<string>(ch.Members);
                // �����‚������
                if (list.Contains(IRCClient.GetUserName(e.Before)))
                {
                    // �����‚̖��O��ύX����
                    int index = list.IndexOf(IRCClient.GetUserName(e.Before));
                    list[index] = e.After;
                    ch.Members = list.ToArray();
                    // ���݂̃`�����l����������A�t�H�[���̏�Ԃ�X�V����
                    if (m_currentCh == ch)
                        LoadChannel(m_currentCh);
                    // ���O�lj�
                    AddLog(ch, string.Format(Resources.NicknameChangedMessage, IRCClient.GetUserName(e.Before), IRCClient.GetUserName(e.After)));
                }
                else if (list.Contains("@" + IRCClient.GetUserName(e.Before)))
                {
                    // �����‚̖��O��ύX����
                    int index = list.IndexOf("@" + IRCClient.GetUserName(e.Before));
                    list[index] = "@" + e.After;
                    ch.Members = list.ToArray();
                    // ���݂̃`�����l����������A�t�H�[���̏�Ԃ�X�V����
                    if (m_currentCh == ch)
                        LoadChannel(m_currentCh);
                    // ���O�lj�
                    AddLog(ch, string.Format(Resources.NicknameChangedMessage, IRCClient.GetUserName(e.Before), IRCClient.GetUserName(e.After)));
                }
            }
        }
Пример #2
0
 /// <summary>
 /// �����̃j�b�N�l�[�����ύX���ꂽ�Ƃ�
 /// </summary>
 private void ircClient_ChangeMyNickname(object sender, NickNameChangeEventArgs e)
 {
     ircClient_ChangedNickname(sender, e);
 }
Пример #3
0
 /// <summary>
 /// ChangedMyNickname イベントを発生させます。
 /// </summary>
 protected void OnChangedNickname(NickNameChangeEventArgs e)
 {
     NickNameChangeEventHandler handler = (NickNameChangeEventHandler)Events[eventKeyOfChangedNickname];
     if (handler != null)
     {
         Control owner = GetOwner();
         if ((owner != null) && owner.InvokeRequired)
         {
             owner.Invoke(handler, this, e);
         }
         else
         {
             handler(this, e);
         }
     }
 }