Ejemplo n.º 1
0
  public NewProviderSupport() {
    this.emailDaysCutoff = getEmailDaysCutoff();
    this.maximumMessageSize = getMaxMessageSize();
    this.maximumMessagesToProcess =
        Integer.valueOf(SysConfigManager.instance().getValue("maximumMessages", "50"));

    this.maximumLoginFailures =
        Integer.valueOf(SysConfigManager.instance().getValue("maximumLoginFailures", "3"));
  }
Ejemplo n.º 2
0
  public void notifyAccountLock(Account account, String context) {
    PartnerCode partnerCode = account.getPartnerCode();
    String lockedOutMessageBody =
        SysConfigManager.instance()
            .getValue("lockedOutMessageBody", LOCKED_OUT_MESSAGE_BODY, partnerCode);
    String lockedOutMessageSubject =
        SysConfigManager.instance()
            .getValue("lockedOutMessageSubject", LOCKED_OUT_MESSAGE_SUBJECT, partnerCode);
    String lockedOutMessageFrom =
        SysConfigManager.instance()
            .getValue("lockedOutMessageFrom", LOCKED_OUT_MESSAGE_FROM, partnerCode);
    String lockedOutMessageAlias =
        SysConfigManager.instance()
            .getValue("lockedOutMessageAlias", LOCKED_OUT_MESSAGE_ALIAS, partnerCode);

    try {
      Email email = new Email();
      email.setSubject(lockedOutMessageSubject);

      email.setStatus("0");
      email.setUserId(account.getUser_id());
      email.setMessage_type("EMAIL");

      email.setFrom(lockedOutMessageFrom);
      email.setFrom_alias(lockedOutMessageAlias);
      email.setTo(account.getLoginName());
      email.setBodySize(lockedOutMessageBody.length());

      DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      email.setMaildate(dateFormat.format(new Date(System.currentTimeMillis()))); // ugh!

      email.setOriginal_account(account.getLoginName());

      // create the pojgo
      EmailPojo emailPojo = new EmailPojo();
      emailPojo.setEmail(email);

      Body body = new Body();
      body.setData(lockedOutMessageBody.getBytes());

      // note, the email will be encoded to prevent sql-injection. since this email is destined
      // directly for the
      // device, we need to reverse the encoding after the call to newSaveEmail
      new EmailRecievedService().newSaveEmail(account, email, body);

      // Added by Dan so we stop checking accounts that have incorrect passwords
      account.setStatus("0");

    } catch (Throwable t) {
      log.warn(String.format("failed to save locked out message for %s", context), t);
    }
  }
Ejemplo n.º 3
0
 public boolean isTimeToReconcile(Account account) {
   return account.getLast_reconciliation() == null
       || (System.currentTimeMillis() - account.getLast_reconciliation().getTime())
           > 1000l
               * 60
               * Long.valueOf(
                   SysConfigManager.instance().getValue("reconciliationIntervalInMinutes", "60"));
 }
Ejemplo n.º 4
0
  private int getEmailDaysCutoff() {
    String emailDaysCutoff = SysConfigManager.instance().getValue("emailDaysCutoff");

    if (StringUtils.isEmpty(emailDaysCutoff)) {
      return 30;
    } else {
      return Integer.valueOf(emailDaysCutoff);
    }
  }
Ejemplo n.º 5
0
  protected String getEmailDroppedMessage(
      Account account, Date sentDate, int reportedSize, String from) throws MessagingException {
    String time = new SimpleDateFormat("hh:mm a").format(sentDate);
    String date = new SimpleDateFormat("MMMMM dd, yyyy").format(sentDate);

    String emailDroppedMessage =
        SysConfigManager.instance()
            .getValue("emailDroppedMessage", EMAIL_DROPPED_MESSAGE, account.getPartnerCode());

    return String.format(emailDroppedMessage, time, date, from, reportedSize);
  }
Ejemplo n.º 6
0
  private int getMaxMessageSize() {
    try {
      String config = SysConfigManager.instance().getValue("maxMessageSize");

      if (StringUtils.isEmpty(config)) {
        return DEFAULT_MAXIMUM_MESSAGE_SIZE;
      } else {
        return Integer.parseInt(config);
      }
    } catch (Throwable t) {
      log.warn(
          String.format(
              "Unable to determined maximum message size, defaulting to %d",
              DEFAULT_MAXIMUM_MESSAGE_SIZE),
          t);
      return DEFAULT_MAXIMUM_MESSAGE_SIZE;
    }
  }
Ejemplo n.º 7
0
 static {
   mailcheckDisableIntervalInHours =
       Long.valueOf(
           SysConfigManager.instance().getValue("mailcheckDisableIntervalInHours", "720"));
   dayMultiplier = 1000l * 60 * 60;
 }