1998-09-09 00:52:38 +00:00
|
|
|
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License
|
|
|
|
* Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS"
|
|
|
|
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
|
|
|
|
* the License for the specific language governing rights and limitations
|
|
|
|
* under the License.
|
|
|
|
*
|
|
|
|
* The Original Code is the Grendel mail/news client.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape Communications
|
|
|
|
* Corporation. Portions created by Netscape are Copyright (C) 1997
|
|
|
|
* Netscape Communications Corporation. All Rights Reserved.
|
1999-03-07 01:30:52 +00:00
|
|
|
*
|
|
|
|
* Contributors: Jeff Galyan <talisman@anamorphic.com>
|
|
|
|
* Joel York <yorkjoe@charlie.acc.iit.edu>
|
|
|
|
* Edwin Woudt <edwin@woudt.nl>
|
1998-09-09 00:52:38 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
package grendel;
|
|
|
|
|
1999-01-10 21:37:14 +00:00
|
|
|
import java.io.File;
|
|
|
|
|
|
|
|
import java.util.Properties;
|
|
|
|
|
|
|
|
import javax.mail.Folder;
|
|
|
|
import javax.mail.Message;
|
|
|
|
import javax.mail.MessagingException;
|
|
|
|
import javax.mail.Session;
|
|
|
|
|
1998-09-09 00:52:38 +00:00
|
|
|
import calypso.util.Preferences;
|
|
|
|
import calypso.util.PreferencesFactory;
|
|
|
|
|
1999-01-10 21:37:14 +00:00
|
|
|
import grendel.storage.BerkeleyStore;
|
|
|
|
import grendel.storage.MessageExtra;
|
|
|
|
|
1998-09-09 00:52:38 +00:00
|
|
|
import grendel.ui.MessageDisplayManager;
|
|
|
|
import grendel.ui.MultiMessageDisplayManager;
|
|
|
|
import grendel.ui.UnifiedMessageDisplayManager;
|
1999-02-19 22:39:23 +00:00
|
|
|
import grendel.ui.DialogAuthenticator;
|
1998-09-09 00:52:38 +00:00
|
|
|
|
1999-03-03 10:10:23 +00:00
|
|
|
import grendel.util.Constants;
|
|
|
|
|
1998-09-09 00:52:38 +00:00
|
|
|
/**
|
|
|
|
* This launches the Grendel GUI.
|
|
|
|
*/
|
|
|
|
|
|
|
|
public class Main {
|
|
|
|
static MessageDisplayManager fManager;
|
|
|
|
|
1999-01-10 21:37:14 +00:00
|
|
|
public static void main(String argv[]) throws MessagingException {
|
1998-09-09 00:52:38 +00:00
|
|
|
Preferences prefs = PreferencesFactory.Get();
|
|
|
|
String pref = prefs.getString("mail.layout", "multi_pane");
|
1999-01-10 21:37:14 +00:00
|
|
|
Properties props = new Properties();
|
1999-02-05 03:45:34 +00:00
|
|
|
File mailDir;
|
1999-01-10 21:37:14 +00:00
|
|
|
// I'm borrowing pretty heavily from jwz's TestFolderViewer here,
|
|
|
|
// I may change this later, then again, I may not... (talisman)
|
1998-09-09 00:52:38 +00:00
|
|
|
|
1999-03-03 10:10:23 +00:00
|
|
|
if (prefs.getString("mail.directory", "") == "") {
|
|
|
|
mailDir = new File(Constants.HOMEDIR, "grndlmail");
|
1999-01-10 21:37:14 +00:00
|
|
|
if (!mailDir.exists()) {
|
|
|
|
if (mailDir.mkdir()) {
|
|
|
|
//success; put the mail directory in the prefs (talisman)
|
|
|
|
prefs.putString("mail.directory", mailDir.getPath());
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
prefs.putString("mail.directory", mailDir.getPath());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
props.put("mail.directory", prefs.getString("mail.directory", ""));
|
|
|
|
System.out.println(props.get("mail.directory"));
|
|
|
|
|
1999-02-19 22:39:23 +00:00
|
|
|
Session session = Session.getDefaultInstance(props, new DialogAuthenticator());
|
1999-01-10 21:37:14 +00:00
|
|
|
System.out.println(session);
|
|
|
|
BerkeleyStore store = new BerkeleyStore(session);
|
|
|
|
System.out.println(store);
|
|
|
|
// Folder folder = store.getDefaultFolder().getFolder("Inbox");
|
|
|
|
Folder folder = store.getDefaultFolder();
|
|
|
|
|
1998-09-09 00:52:38 +00:00
|
|
|
if (pref.equals("multi_pane")) {
|
|
|
|
fManager = new UnifiedMessageDisplayManager();
|
|
|
|
} else {
|
|
|
|
fManager = new MultiMessageDisplayManager();
|
|
|
|
}
|
|
|
|
MessageDisplayManager.SetDefaultManager(fManager);
|
1999-01-10 21:37:14 +00:00
|
|
|
// fManager.displayMaster();
|
|
|
|
fManager.displayMaster(folder.getFolder("Inbox"));
|
1998-09-09 00:52:38 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|