Ejemplo n.º 1
0
 static String[] composeReadableRecipientList(MultiPartEmail email) {
   String[] RRL = {"To: ", "Cc: ", "Bcc: "};
   Iterator<String> toIT = Utils.noGenericTypeToStringType(email.getToAddresses()).iterator(),
       ccIT = Utils.noGenericTypeToStringType(email.getCcAddresses()).iterator(),
       bccIT = Utils.noGenericTypeToStringType(email.getBccAddresses()).iterator();
   while (toIT.hasNext()) {
     RRL[0] += toIT.next() + ", ";
   }
   while (ccIT.hasNext()) {
     RRL[1] += ccIT.next() + ", ";
   }
   while (bccIT.hasNext()) {
     RRL[2] += bccIT.next() + ", ";
   }
   return RRL;
 }
Ejemplo n.º 2
0
 static HtmlEmail removeRecipient(HtmlEmail email, String emailToRemove) throws EmailException {
   List<String> to = Utils.noGenericTypeToStringType(email.getToAddresses()),
       cc = Utils.noGenericTypeToStringType(email.getCcAddresses()),
       bcc = Utils.noGenericTypeToStringType(email.getBccAddresses());
   if (to.contains(emailToRemove)) {
     to.remove(emailToRemove);
     email.setTo(to);
   } else if (cc.contains(emailToRemove)) {
     cc.remove(emailToRemove);
     email.setCc(cc);
   } else if (bcc.contains(emailToRemove)) {
     bcc.remove(emailToRemove);
     email.setBcc(bcc);
   }
   return email;
 }
Ejemplo n.º 3
0
 public static void setNonHtmlMessage(CommandSender sender, String[] args) {
   if (inProgress(sender.getName())) {
     switch (getCurrentEmail(sender.getName())) {
       case "simple":
         LogHelper.showWarning("emailNonHtmlNotAllowed", sender);
         return;
       case "multi":
         LogHelper.showWarning("emailNonHtmlNotAllowed", sender);
         return;
       case "html":
         break;
       default:
         LogHelper.showWarning("emailNotInProgressEdit", sender);
         return;
     }
     HtmlEmail email = htmlEmail.get(sender.getName());
     try {
       email.setMsg(Utils.implode(args, " "));
     } catch (EmailException e) {
       sendErrorMessage(sender, e);
       return;
     }
     LogHelper.showWarning("emailNonHtmlMessageSet", sender);
     htmlEmail.put(sender.getName(), email);
   } else {
     LogHelper.showWarning("emailNotInProgressEdit", sender);
   }
 }
Ejemplo n.º 4
0
 static void editMessageMulti(CommandSender sender, String[] args) {
   MultiPartEmail email = multiEmail.get(sender.getName());
   try {
     email.setMsg(Utils.implode(args, " "));
   } catch (EmailException e) {
     sendErrorMessage(sender, e);
     return;
   }
   LogHelper.showInfo("emailMessageSet", sender);
   multiEmail.put(sender.getName(), email);
 }
Ejemplo n.º 5
0
 static void editSubjectHTML(CommandSender sender, String[] args) {
   HtmlEmail email = htmlEmail.get(sender.getName());
   email.setSubject(Utils.implode(args, " "));
   LogHelper.showInfo("emailSubjectSet", sender);
   htmlEmail.put(sender.getName(), email);
 }
Ejemplo n.º 6
0
 static void editSubjectMulti(CommandSender sender, String[] args) {
   MultiPartEmail email = multiEmail.get(sender.getName());
   email.setSubject(Utils.implode(args, " "));
   LogHelper.showInfo("emailSubjectSet", sender);
   multiEmail.put(sender.getName(), email);
 }