Smuxi.Engine.XmppProtocolManager.ProcessIdentityNameChanged C# (CSharp) Метод

ProcessIdentityNameChanged() приватный Метод

private ProcessIdentityNameChanged ( Smuxi.Engine.XmppPersonModel contact, Smuxi.Engine.TextMessagePartModel oldIdentityNameColored, string oldIdentityName ) : void
contact Smuxi.Engine.XmppPersonModel
oldIdentityNameColored Smuxi.Engine.TextMessagePartModel
oldIdentityName string
Результат void
        void ProcessIdentityNameChanged(XmppPersonModel contact, TextMessagePartModel oldIdentityNameColored, string oldIdentityName)
        {
            var builder = CreateMessageBuilder();
            builder.AppendEventPrefix();
            string idstring = (oldIdentityName == contact.Jid.Bare)?"":GenerateIdString(contact);
            oldIdentityNameColored.BackgroundColor = TextColor.None;
            builder.AppendFormat("{2}{1} is now known as {0}", contact, idstring, oldIdentityNameColored);

            if (ContactChat != null) {
                PersonModel oldp = ContactChat.GetPerson(contact.ID);
                if (oldp != null) {
                    Session.UpdatePersonInGroupChat(ContactChat, oldp, contact.ToPersonModel());
                    Session.AddMessageToChat(ContactChat, new MessageModel(builder.ToMessage()));
                }
            }

            var chat = Session.GetChat(contact.ID, ChatType.Person, this) as PersonChatModel;
            if (chat != null) {
                chat.Name = contact.IdentityName;
                builder.MessageType = MessageType.ChatNameChanged;
                var msg = builder.ToMessage();
                Session.AddMessageToChat(chat, msg);

                chat.Person = contact.ToPersonModel();
                var msg2 = new MessageModel(msg);
                msg2.MessageType = MessageType.PersonChatPersonChanged;
                Session.AddMessageToChat(chat, msg2);
            }
        }