コード例 #1
0
        public void OnCommand(GameClient client, string[] args)
        {
            if (IsSpammingCommand(client.Player, "email"))
            {
                return;
            }

            if (args.Length == 1)
            {
                client.Out.SendMessage(
                    "Usage: /email <address>",
                    eChatType.CT_System,
                    eChatLoc.CL_SystemWindow);
                return;
            }

            EmailSyntaxValidator emailsyntaxvalidator; // validate mail
            string EmailAddy = args[1];

            emailsyntaxvalidator = new EmailSyntaxValidator(EmailAddy, true);
            if (!emailsyntaxvalidator.IsValid)
            {
                client.Out.SendMessage(
                    "Please enter a valid e-mail address.",
                    eChatType.CT_System,
                    eChatLoc.CL_SystemWindow);
                return;
            }

            try
            {
                var obj = (GamePlayer)client.Player;

                if (obj != null)
                {
                    string oldEmail = obj.Client.Account.Mail;
                    obj.Client.Account.Mail = EmailAddy;                // Set email

                    GameServer.Database.SaveObject(obj.Client.Account); // Save account.

                    // Log change
                    AuditMgr.AddAuditEntry(client, AuditType.Account, AuditSubtype.AccountEmailChange, oldEmail, EmailAddy);

                    client.Out.SendMessage(
                        "Contact e-mail address set to " +
                        obj.Client.Account.Mail + ". Thanks!",
                        eChatType.CT_System, eChatLoc.CL_SystemWindow);
                }
            }
            catch (Exception)
            {
                client.Out.SendMessage(
                    "Error - Usage: /email <address>",
                    eChatType.CT_System, eChatLoc.CL_SystemWindow);
            }
        }
コード例 #2
0
ファイル: email.cs プロジェクト: mynew4/DOLSharp
		public void OnCommand(GameClient client, string[] args)
		{
			if (IsSpammingCommand(client.Player, "email"))
				return;

			if (args.Length == 1)
			{
				client.Out.SendMessage("Usage: /email <address>",
				                       eChatType.CT_System,
				                       eChatLoc.CL_SystemWindow);
				return;
			}
			EmailSyntaxValidator emailsyntaxvalidator; // validate mail
			string EmailAddy = args[1];
			emailsyntaxvalidator = new EmailSyntaxValidator(EmailAddy, true);
			if (!emailsyntaxvalidator.IsValid)
			{
				client.Out.SendMessage("Please enter a valid e-mail address.",
				                       eChatType.CT_System,
				                       eChatLoc.CL_SystemWindow);
				return;
			}


			try
			{
				var obj = (GamePlayer) client.Player;

				if (obj != null)
				{
					string oldEmail = obj.Client.Account.Mail;
					obj.Client.Account.Mail = EmailAddy; // Set email

					GameServer.Database.SaveObject(obj.Client.Account); // Save account.

					// Log change
					AuditMgr.AddAuditEntry(client, AuditType.Account, AuditSubtype.AccountEmailChange, oldEmail, EmailAddy);

					client.Out.SendMessage("Contact e-mail address set to " +
					                       obj.Client.Account.Mail + ". Thanks!",
					                       eChatType.CT_System, eChatLoc.CL_SystemWindow);
				}
			}
			catch (Exception)
			{
				client.Out.SendMessage("Error - Usage: /email <address>",
				                       eChatType.CT_System, eChatLoc.CL_SystemWindow);
			}
		}
コード例 #3
0
ファイル: email.cs プロジェクト: mywebext/DOL
        /// <summary>
        /// Determines if an email has valid syntax
        /// </summary>
        /// <param name="email">the email to test</param>
        /// <param name="TLDrequired">indicates whether or not the
        /// email must end with a known TLD to be considered valid</param>
        /// <returns>boolean indicating if the email has valid syntax</returns>
        /// <remarks>
        /// Validates an email address specifying whether or not
        /// the email is required to have a TLD that is valid.
        /// </remarks>
        public static bool Valid(string email, bool TLDrequired)
        {
            EmailSyntaxValidator v;
            bool valid;

            //call syntax validator
            v = new EmailSyntaxValidator(email, TLDrequired);

            //determine validity
            valid = v.IsValid;

            //cleanup
            v = null;

            //return indication of validity
            return(valid);
        }
コード例 #4
0
ファイル: email.cs プロジェクト: mynew4/DOLSharp
		/// <summary>
		/// Determines if an email has valid syntax
		/// </summary>
		/// <param name="email">the email to test</param>
		/// <param name="TLDrequired">indicates whether or not the 
		/// email must end with a known TLD to be considered valid</param>
		/// <returns>boolean indicating if the email has valid syntax</returns>
		/// <remarks>
		/// Validates an email address specifying whether or not
		/// the email is required to have a TLD that is valid.
		/// </remarks>
		public static bool Valid(string email, bool TLDrequired)
		{
			EmailSyntaxValidator v;
			bool valid;

			//call syntax validator
			v = new EmailSyntaxValidator(email, TLDrequired);

			//determine validity
			valid = v.IsValid;

			//cleanup
			v = null;

			//return indication of validity
			return valid;
		}