Exemplo 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"));
  }
Exemplo 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);
    }
  }
Exemplo n.º 3
0
 public int getFilterHeight() {
   if (filterHeight != null) {
     return filterHeight;
   } else {
     return Integer.parseInt(
         SysConfigManager.instance().getValue("receiver.mail.image.filter.height"));
   }
 }
Exemplo n.º 4
0
 public int getFilterWidth() {
   if (filterWidth != null) {
     return filterWidth;
   } else {
     return Integer.parseInt(
         SysConfigManager.instance().getValue("receiver.mail.image.filter.width"));
   }
 }
Exemplo n.º 5
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"));
 }
Exemplo n.º 6
0
  private int getEmailDaysCutoff() {
    String emailDaysCutoff = SysConfigManager.instance().getValue("emailDaysCutoff");

    if (StringUtils.isEmpty(emailDaysCutoff)) {
      return 30;
    } else {
      return Integer.valueOf(emailDaysCutoff);
    }
  }
Exemplo n.º 7
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);
  }
Exemplo n.º 8
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;
    }
  }
Exemplo n.º 9
0
 static {
   mailcheckDisableIntervalInHours =
       Long.valueOf(
           SysConfigManager.instance().getValue("mailcheckDisableIntervalInHours", "720"));
   dayMultiplier = 1000l * 60 * 60;
 }