Skip to content
This repository has been archived by the owner on Sep 12, 2018. It is now read-only.

Commit

Permalink
Merge branch 'feature/mailbox' of dlab/hive
Browse files Browse the repository at this point in the history
from pull-request 1362

* refs/heads/feature/mailbox:
  docs/mailbox: Describe how Mailbox works
  Mailbox: Ignore duplicated email
  Mailbox: Ignore auto-replied emails
  Introduce Mailbox Service
  user: Implement toString
  NotifiationMail: Fix ugly footer in reply
  Property: Introduce Property
  NotificationMail: Fix incorrect References header
  NotificationMail: Make message id simple
  Attachment: Fix error if filename is not given
  Attachment: Support streamming
  Attachment: Fix an incorrect error message
  User: Extract getPreferredLanguage method
  Diagnostic: Introduce the Diagnostic

Reviewed-by: 백기선 <keesun.baik@navercorp.com>
  • Loading branch information
백기선 committed Jan 27, 2015
2 parents fb98846 + 1e7b05f commit 116aec9
Show file tree
Hide file tree
Showing 56 changed files with 3,161 additions and 205 deletions.
43 changes: 25 additions & 18 deletions app/Global.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,42 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import java.io.IOException;
import java.lang.reflect.Method;
import java.math.BigInteger;
import java.net.InetAddress;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.SecureRandom;
import java.util.Date;

import mailbox.MailboxService;
import com.avaje.ebean.Ebean;
import controllers.SvnApp;
import models.*;

import controllers.UserApp;
import controllers.routes;
import models.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.impl.cookie.DateUtils;
import play.Application;
import play.GlobalSettings;
import play.Play;
import play.api.mvc.Handler;
import play.data.Form;
import play.mvc.*;
import play.mvc.Action;
import play.mvc.Http;
import play.mvc.Http.RequestHeader;
import play.mvc.Result;
import play.libs.F.Promise;

import utils.AccessControl;
import utils.AccessLogger;
import utils.ErrorViews;
import utils.YamlUtil;

import views.html.welcome.secret;
import play.mvc.Result;
import play.mvc.Results;
import utils.*;
import views.html.welcome.restart;
import views.html.welcome.secret;

import java.io.IOException;
import java.lang.reflect.Method;
import java.math.BigInteger;
import java.net.InetAddress;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.SecureRandom;
import java.util.Date;

import static play.data.Form.form;
import static play.mvc.Results.badRequest;

Expand All @@ -64,17 +65,22 @@ public class Global extends GlobalSettings {
private boolean isSecretInvalid = false;
private boolean isRestartRequired = false;

private MailboxService mailboxService = new MailboxService();

@Override
public void onStart(Application app) {
isSecretInvalid = equalsDefaultSecret();
insertInitialData();

Config.onStart();
Property.onStart();
PullRequest.onStart();
NotificationMail.onStart();
NotificationEvent.onStart();
Attachment.onStart();
YobiUpdate.onStart();
AccessControl.onStart();
mailboxService.start();
}

private boolean equalsDefaultSecret() {
Expand Down Expand Up @@ -208,6 +214,7 @@ public Handler onRouteRequest(RequestHeader request) {
}

public void onStop(Application app) {
mailboxService.stop();
}

@Override
Expand Down
8 changes: 8 additions & 0 deletions app/controllers/SiteApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,12 @@ public static Result update() throws GitAPIException {
return ok(update.render("title.siteSetting", currentVersion,
YobiUpdate.versionToUpdate, exception));
}

/**
* Diagnose Yobi
* @return
*/
public static Result diagnose() {
return ok(diagnostic.render("title.siteSetting", Diagnostic.checkAll()));
}
}
29 changes: 29 additions & 0 deletions app/mailbox/Content.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package mailbox;

import org.apache.commons.lang3.StringUtils;

import javax.mail.internet.MimePart;
import java.util.ArrayList;
import java.util.List;

public class Content {
public String body = "";
public final List<MimePart> attachments = new ArrayList<>();
public String type;

public Content() { }

public Content(MimePart attachment) {
this.attachments.add(attachment);
}

public Content merge(Content that) {
body += that.body;
if (StringUtils.isEmpty(type)) {
type = that.type;
}
attachments.addAll(that.attachments);

return this;
}
}
Loading

0 comments on commit 116aec9

Please sign in to comment.