Ejemplo n.º 1
0
        public override void Write()
        {
            _worldPacket.WriteUInt8((byte)SlashCmd);
            _worldPacket.WriteUInt32((uint)_Language);
            _worldPacket.WritePackedGuid(SenderGUID);
            _worldPacket.WritePackedGuid(SenderGuildGUID);
            _worldPacket.WritePackedGuid(SenderAccountGUID);
            _worldPacket.WritePackedGuid(TargetGUID);
            _worldPacket.WriteUInt32(TargetVirtualAddress);
            _worldPacket.WriteUInt32(SenderVirtualAddress);
            _worldPacket.WritePackedGuid(PartyGUID);
            _worldPacket.WriteUInt32(AchievementID);
            _worldPacket.WriteFloat(DisplayTime);
            _worldPacket.WriteBits(SenderName.GetByteCount(), 11);
            _worldPacket.WriteBits(TargetName.GetByteCount(), 11);
            _worldPacket.WriteBits(Prefix.GetByteCount(), 5);
            _worldPacket.WriteBits(Channel.GetByteCount(), 7);
            _worldPacket.WriteBits(ChatText.GetByteCount(), 12);
            _worldPacket.WriteBits((byte)_ChatFlags, 14);
            _worldPacket.WriteBit(HideChatLog);
            _worldPacket.WriteBit(FakeSenderName);
            _worldPacket.WriteBit(Unused_801.HasValue);
            _worldPacket.FlushBits();

            _worldPacket.WriteString(SenderName);
            _worldPacket.WriteString(TargetName);
            _worldPacket.WriteString(Prefix);
            _worldPacket.WriteString(Channel);
            _worldPacket.WriteString(ChatText);

            if (Unused_801.HasValue)
            {
                _worldPacket.WriteUInt32(Unused_801.Value);
            }
        }
Ejemplo n.º 2
0
        public int CompareTo(object obj)
        {
            ViewSettings otherViewSettings = obj as ViewSettings;

            if (Name.CompareTo(otherViewSettings.Name) == 0 &&
                EnableSSL.CompareTo(otherViewSettings.EnableSSL) == 0 &&
                Host.CompareTo(otherViewSettings.Host) == 0 &&
                Port.CompareTo(otherViewSettings.Port) == 0 &&
                UserEmail.CompareTo(otherViewSettings.UserEmail) == 0 &&
                UserPassword.CompareTo(otherViewSettings.UserPassword) == 0 &&
                SenderName.CompareTo(otherViewSettings.SenderName) == 0 &&
                SenderEmail.CompareTo(otherViewSettings.SenderEmail) == 0 &&
                RecieverEmail.CompareTo(otherViewSettings.RecieverEmail) == 0 &&
                MessageSubject.CompareTo(otherViewSettings.MessageSubject) == 0 &&
                MessageBody.CompareTo(otherViewSettings.MessageBody) == 0 &&
                SiteUrl.CompareTo(otherViewSettings.SiteUrl) == 0 &&
                TableClassID.CompareTo(otherViewSettings.TableClassID) == 0 &&
                CompareValue.CompareTo(otherViewSettings.CompareValue) == 0 &&
                TimeStartSettings.CompareTo(otherViewSettings.TimeStartSettings) == 0 &&
                NotNullColumn.CompareTo(otherViewSettings.NotNullColumn) == 0 &&
                ColumnToCompare.CompareTo(otherViewSettings.ColumnToCompare) == 0)
            {
                return(0);
            }
            return(1);
        }
 /// <summary>Serves as the default hash function.</summary>
 /// <returns>A hash code for the current object.</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = ConvoId.GetHashCode();
         hashCode = (hashCode * 397) ^ ConvoPasswordSHA512.GetHashCode();
         hashCode = (hashCode * 397) ^ SenderName.GetHashCode();
         hashCode = (hashCode * 397) ^ EncryptedBody.GetHashCode();
         return(hashCode);
     }
 }
Ejemplo n.º 4
0
        public ns2KanzleiTyp ToElbaData()
        {
            ns2KanzleiTyp kanzlei = new ns2KanzleiTyp
            {
                Identifikationen = new ns2IdentifikationSteuerberaterTypIdentifikation[SenderIdentities.Count]
            };

            kanzlei.Identifikationen = new ns2IdentifikationSteuerberaterTypIdentifikation[SenderIdentities.Count];

            for (int i = 0; i < SenderIdentities.Count; i++)
            {
                kanzlei.Identifikationen[i] = SenderIdentities[i].ToElbaData();
            }

            kanzlei.Adresse      = Address.ToElbaData();
            kanzlei.NameAbsender = SenderName.ToElbaData();
            kanzlei.Kontaktdaten = ContactData.ToAbsenderElbaData();
            return(kanzlei);
        }
Ejemplo n.º 5
0
        public override void DoTask(MainWindow mw)
        {
            Channel ch = null;

            if (!Sender.ChannelList.TryGetValue(ChannelHash, out ch))
            {
                return;
            }

            Client c = null;

            if (!Sender.Clients.TryGetValue(ClientName.ToLower(), out c))
            {
                return;
            }

            Client c2 = null;

            if (!Sender.Clients.TryGetValue(SenderName.ToLower(), out c2) || !ch.IsInConversation(c2))
            {
                return;
            }

            if (Type == ClientAddOrRemoveTask.TaskType.Add)
            {
                ch.AddClientToConversation(c, false);
                ch.AddMessage(GlobalManager.SystemClient, SenderName + " has added " + ClientName + " to the conversation.", MessageSettings.OfflineMessage);
            }
            else
            {
                if (ClientName.ToLower() == Sender.User.LowerName)
                {
                    ch.AddMessage(GlobalManager.SystemClient, "You have been removed from this conversation.", MessageSettings.OfflineMessage);
                    ch.Disabled = true;
                }
                else
                {
                    ch.RemoveClientFromConversation(c, false);
                    ch.AddMessage(GlobalManager.SystemClient, SenderName + " has removed " + ClientName + " from the conversation.", MessageSettings.OfflineMessage);
                }
            }
        }
Ejemplo n.º 6
0
        public override void Normalize()
        {
            if (!String.IsNullOrEmpty(SenderName))
            {
                SenderName = SenderName.Substring(0, Math.Min(SenderName.Length, 10));
            }

            if (!String.IsNullOrEmpty(DestinationList))
            {
                DestinationList = DestinationList.Substring(0, Math.Min(DestinationList.Length, 109));
            }

            if (!String.IsNullOrEmpty(Subject))
            {
                Subject = Subject.Substring(0, Math.Min(Subject.Length, 78));
            }

            if (!String.IsNullOrEmpty(Body))
            {
                Body = Body.Substring(0, Math.Min(Body.Length, 512));
            }
        }
Ejemplo n.º 7
0
        /// <inheritdoc />
        public override int GetHashCode()
        {
            unchecked
            {
                int hashCode = ChatId != null?ChatId.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (Id != null ? Id.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Body != null ? Body.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (Type != null ? Type.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (SenderName != null ? SenderName.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ FromMe.GetHashCode();
                hashCode = (hashCode * 397) ^ (Author != null ? Author.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ Time.GetHashCode();
                hashCode = (hashCode * 397) ^ MessageNumber.GetHashCode();
                hashCode = (hashCode * 397) ^ Self.GetHashCode();
                hashCode = (hashCode * 397) ^ IsForwarded.GetHashCode();
                hashCode = (hashCode * 397) ^ (QuotedMessageBody != null ? QuotedMessageBody.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (QuotedMessageId != null ? QuotedMessageId.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (QuotedMessageType != null ? QuotedMessageType.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (ChatName != null ? ChatName.GetHashCode() : 0);
                return(hashCode);
            }
        }
Ejemplo n.º 8
0
    //IChatClientListener
    public void OnPrivateMessage(string sender, object message, string channelName)
    {
        string[] MSG = (string[])message;

        if (MSG.Length > 0)
        {
            string MSGType = MSG[0];
            string SenderName;
            if (MSGType.Equals("Request"))
            {
                SenderName = MSG[2];

                SENDER_ID   = MSG[1];
                RECIEVER_ID = MSG[3];
                ROOM_NAME   = MSG[4];

                if (RECIEVER_ID.Equals(PlayerVariables.Inistance.getUserPlayFabID()))
                {
                    PanelRequests.SetActive(true);
                    PanelDialog.SetActive(true);
                    PlayerNameUIText.text = SenderName.Equals("") ? SENDER_ID : SenderName;
                }
            }
            else if (MSGType.Equals("Response"))
            {
                SenderName  = MSG[2];
                SENDER_ID   = MSG[1];
                RECIEVER_ID = MSG[3];
                string ResponseType = MSG[4];

                if (RECIEVER_ID.Equals(PlayerVariables.Inistance.getUserPlayFabID()))
                {
                    if (ResponseType.Equals("NO"))
                    {
                        ShowLoading = false;
                        LoadingImage.SetActive(false);
                        PanelRequests.SetActive(false);

                        if (SenderName.Equals(""))
                        {
                            if (PlayerPrefs.GetString("Language", "EN").Equals("EN"))
                            {
                                StartCoroutine(GeneralController.Inistance.ToastDisplayer("Player " + SENDER_ID + " Refused Your Request"));
                            }
                            else
                            {
                                StartCoroutine(GeneralController.Inistance.ToastDisplayer("ﺐﻋﻼﻟﺍ " + SENDER_ID + " ﻚﺒﻠﻃ ﺾﻓﺭ"));
                            }
                        }
                        else
                        {
                            if (PlayerPrefs.GetString("Language", "EN").Equals("EN"))
                            {
                                StartCoroutine(GeneralController.Inistance.ToastDisplayer("Player " + SenderName + " Refused Your Request"));
                            }
                            else
                            {
                                StartCoroutine(GeneralController.Inistance.ToastDisplayer("ﺐﻋﻼﻟﺍ " + SenderName + " ﻚﺒﻠﻃ ﺾﻓﺭ"));
                            }
                        }
                    }
                    else if (ResponseType.Equals("YES"))
                    {
                        CreateOrJoinRoom(true);
                    }
                }
            }
        }
    }
Ejemplo n.º 9
0
 public override string ToString() => $"Sender = {SenderName?.ToString()}{SenderCId?.ToString()} , Source EP = {SourceEP?.ToString()} , " +
 $"White Source EP = {WhiteSourceEP?.ToString()} , Destination EP = {DestinationEP?.ToString()} , " +
 $"Destination = {DestinationName?.ToString()} , Text = {Text?.ToString()} , Send Time = {SendTime.ToString()}";
 /// <summary>
 /// Checks whether the <see cref="Message"/> comes from a <see cref="User"/> or from the Epistle server directly.<para> </para>
 /// Server messages come in the following format: <para> </para>
 /// <c>server:0:f12218f6b9e3481d964a109333f70ae7</c><para> </para>
 /// Message type IDs: <para> </para>
 /// 0 = User joined a convo.
 /// 1 = User left a convo.
 /// 2 = User was kicked out from a convo.
 /// 3 = The convo is about to expire (less than 24h left).
 /// 4 = The convo's metadata was changed.
 /// </summary>
 public bool IsFromServer()
 {
     return(SenderId == "0" && SenderName.Equals("Server", StringComparison.InvariantCultureIgnoreCase) && EncryptedBody.StartsWith("server:", StringComparison.InvariantCultureIgnoreCase));
 }
        } // end of constructor

        #endregion constructors

        /// <summary>
        /// ToString()
        /// Overrides the ChatMessage ToString() object
        /// Time is Displayed in Local Time but Serialized in universal
        /// </summary>
        /// <returns>a formatted string</returns>
        public override string ToString()
        {
            return($"{TimeStamp.ToLocalTime()} {SenderName.PadRight(15, ' ')} : {Message}");
        }
        public override void SendEmailList(Guid emailListId, IList <string> toAddresses, ExpandoObject templateModel, string subject, IUnitOfWork unitOfWork, Guid?templateWebsiteId = null, IList <Attachment> attachments = null)
        {
            object        SenderName;
            List <String> Sender = new List <String>();

            foreach (string toAddress in toAddresses)
            {
                if (RegularExpressionLibrary.IsValidEmail(toAddress))
                {
                    continue;
                }
                throw new ArgumentException(string.Concat("To address: ", toAddress, " is not a valid email address."));
            }
            EmailList emailList = this.GetEmailList(unitOfWork, emailListId, templateWebsiteId);

            if (emailList == null)
            {
                return;
            }
            //BUSA-1090 Wish list email notification (share)
            if (((IDictionary <String, Object>)templateModel).TryGetValue("SenderName", out SenderName))
            {
                ((IDictionary <String, Object>)templateModel).TryGetValue("SenderName", out SenderName);
                Sender.Add(SenderName.ToString());
                foreach (string CCAddress in Sender)
                {
                    if (RegularExpressionLibrary.IsValidEmail(CCAddress))
                    {
                        continue;
                    }
                    throw new ArgumentException(string.Concat("CC address: ", CCAddress, " is not a valid email address."));
                }
            }

            //BUSA-1090 Wish list email notification (share)
            emailList.FromAddress = CustomSettings.DefaultWishListEmailAddress;

            // add toAddresses and ccAddresses for RMA notification
            object        IsRmaEmail;
            List <string> ccAddresses = new List <string>();

            if (((IDictionary <String, Object>)templateModel).TryGetValue("IsRmaEmail", out IsRmaEmail))
            {
                if (!string.IsNullOrEmpty(CustomSettings.RMA_ToAddress))
                {
                    string[] addresses = CustomSettings.RMA_ToAddress.Split(';');
                    for (int i = 0; i < addresses.Length; i++)
                    {
                        toAddresses.Add(addresses[i].Trim());
                    }
                }
                if (!string.IsNullOrEmpty(CustomSettings.RMA_CC_Address))
                {
                    string[] addresses = CustomSettings.RMA_CC_Address.Split(';');
                    for (int i = 0; i < addresses.Length; i++)
                    {
                        ccAddresses.Add(addresses[i].Trim());
                    }
                }
                if (!string.IsNullOrEmpty(CustomSettings.RMA_BCC_Address))
                {
                    string[] addresses = CustomSettings.RMA_BCC_Address.Split(';');
                    for (int i = 0; i < addresses.Length; i++)
                    {
                        Sender.Add(addresses[i].Trim());
                    }
                }
            }

            SendEmailParameter sendEmailParameter = new SendEmailParameter()
            {
                ToAddresses  = toAddresses,
                CCAddresses  = ccAddresses,
                Attachments  = attachments,
                BccAddresses = Sender,
                FromAddress  = (emailList.FromAddress.IsBlank() ? this.EmailsSettings.DefaultEmail : emailList.FromAddress),
                Subject      = (subject.IsBlank() ? this.EntityTranslationService.TranslateProperty <EmailList>(emailList, (EmailList o) => o.Subject) : subject)
            };

            SendEmailParameter sendEmailParameter1 = sendEmailParameter;
            string             htmlTemplate        = this.GetHtmlTemplate(emailList, templateWebsiteId);

            this.ParseAndSendEmail(htmlTemplate, templateModel, sendEmailParameter1, unitOfWork);
        }