mirror of
https://github.com/moparisthebest/davmail
synced 2025-03-03 18:59:53 -05:00
Reformat and fixes from audit
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1702 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
551c608812
commit
f89511775d
@ -36,7 +36,7 @@ import java.security.KeyStore;
|
||||
* Generic abstract server common to SMTP and POP3 implementations
|
||||
*/
|
||||
public abstract class AbstractServer extends Thread {
|
||||
protected boolean nosslFlag; // will cause same behavior as before with unchanged config files
|
||||
protected boolean nosslFlag; // will cause same behavior as before with unchanged config files
|
||||
private final int port;
|
||||
private ServerSocket serverSocket;
|
||||
|
||||
|
@ -20,11 +20,11 @@ package davmail;
|
||||
|
||||
import davmail.exception.DavMailException;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Locale;
|
||||
import java.util.ResourceBundle;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Internationalization message.
|
||||
|
@ -154,7 +154,7 @@ public final class DavGateway {
|
||||
@Override
|
||||
public void run() {
|
||||
String releasedVersion = getReleasedVersion();
|
||||
if (currentVersion != null && currentVersion.length() > 0 && releasedVersion != null && currentVersion.compareTo(releasedVersion) < 0) {
|
||||
if (currentVersion != null && currentVersion.length() > 0 && releasedVersion != null && currentVersion.compareTo(releasedVersion) < 0) {
|
||||
DavGatewayTray.info(new BundleMessage("LOG_NEW_VERSION_AVAILABLE", releasedVersion));
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ public class CaldavServer extends AbstractServer {
|
||||
*/
|
||||
public CaldavServer(int port) {
|
||||
super(CaldavServer.class.getName(), port, CaldavServer.DEFAULT_PORT);
|
||||
nosslFlag = Settings.getBooleanProperty("davmail.ssl.nosecurecaldav");
|
||||
nosslFlag = Settings.getBooleanProperty("davmail.ssl.nosecurecaldav");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,11 +34,11 @@ public class DavMailAuthenticationException extends DavMailException {
|
||||
/**
|
||||
* Create a DavMail authentication exception with the given BundleMessage key and arguments.
|
||||
*
|
||||
* @param key message key
|
||||
* @param key message key
|
||||
* @param arguments message values
|
||||
*/
|
||||
public DavMailAuthenticationException(String key, Object... arguments) {
|
||||
super(key, arguments);
|
||||
super(key, arguments);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ public class DoubleDotInputStream extends PushbackInputStream {
|
||||
}
|
||||
// push back characters
|
||||
if (index >= 0) {
|
||||
while(index >= 0) {
|
||||
while (index >= 0) {
|
||||
unread(buffer[index--]);
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import java.io.OutputStream;
|
||||
public class DoubleDotOutputStream extends FilterOutputStream {
|
||||
|
||||
// remember last 2 bytes written
|
||||
int[] buf = {0, 0};
|
||||
final int[] buf = {0, 0};
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
|
@ -658,7 +658,7 @@ public abstract class ExchangeSession {
|
||||
public abstract void deleteMessage(Message message) throws IOException;
|
||||
|
||||
/**
|
||||
* Send message to recipients, properties contains bcc recipients and other non MIME flags.
|
||||
* Send message.
|
||||
*
|
||||
* @param messageBody MIME message body
|
||||
* @throws IOException on error
|
||||
@ -1435,7 +1435,7 @@ public abstract class ExchangeSession {
|
||||
messages = ExchangeSession.this.searchMessages(folderPath, null);
|
||||
fixUids(messages);
|
||||
recent = 0;
|
||||
for (Message message:messages) {
|
||||
for (Message message : messages) {
|
||||
if (message.recent) {
|
||||
recent++;
|
||||
}
|
||||
@ -1674,7 +1674,7 @@ public abstract class ExchangeSession {
|
||||
buffer.append("\\Deleted ");
|
||||
}
|
||||
if (recent) {
|
||||
buffer.append("\\Recent ");
|
||||
buffer.append("\\Recent ");
|
||||
}
|
||||
if (flagged) {
|
||||
buffer.append("\\Flagged ");
|
||||
@ -2596,7 +2596,7 @@ public abstract class ExchangeSession {
|
||||
LOGGER.debug("Shared or public calendar: exclude private events");
|
||||
privateCondition = isEqualTo("sensitivity", 0);
|
||||
}
|
||||
|
||||
|
||||
return searchEvents(folderPath, ITEM_PROPERTIES,
|
||||
and(filter, privateCondition));
|
||||
}
|
||||
@ -3135,7 +3135,7 @@ public abstract class ExchangeSession {
|
||||
if (attendee == null || attendee.indexOf('@') < 0 || attendee.charAt(attendee.length() - 1) == '@') {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
attendee = replaceIcal4Principal(attendee);
|
||||
if (attendee.startsWith("mailto:") || attendee.startsWith("MAILTO:")) {
|
||||
attendee = attendee.substring("mailto:".length());
|
||||
|
@ -95,6 +95,15 @@ public final class ExchangeSessionFactory {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create authenticated Exchange session
|
||||
*
|
||||
* @param baseUrl OWA base URL
|
||||
* @param userName user login
|
||||
* @param password user password
|
||||
* @return authenticated session
|
||||
* @throws IOException on error
|
||||
*/
|
||||
public static ExchangeSession getInstance(String baseUrl, String userName, String password) throws IOException {
|
||||
ExchangeSession session = null;
|
||||
try {
|
||||
@ -129,7 +138,7 @@ public final class ExchangeSessionFactory {
|
||||
try {
|
||||
session = new DavExchangeSession(poolKey.url, poolKey.userName, poolKey.password);
|
||||
} catch (WebdavNotAvailableException e) {
|
||||
ExchangeSession.LOGGER.debug(e.getMessage()+", retry with EWS");
|
||||
ExchangeSession.LOGGER.debug(e.getMessage() + ", retry with EWS");
|
||||
session = new EwsExchangeSession(poolKey.url, poolKey.userName, poolKey.password);
|
||||
// success, enable EWS flag
|
||||
ExchangeSession.LOGGER.debug("EWS found, changing davmail.enableEws setting");
|
||||
|
@ -19,8 +19,8 @@
|
||||
package davmail.exchange;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.Reader;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
/**
|
||||
* ICS Buffered Reader.
|
||||
@ -32,6 +32,7 @@ public class ICSBufferedReader extends BufferedReader {
|
||||
|
||||
/**
|
||||
* Create an ICS reader on the provided reader
|
||||
*
|
||||
* @param in input reader
|
||||
* @throws IOException on error
|
||||
*/
|
||||
|
@ -19,10 +19,13 @@
|
||||
package davmail.exchange;
|
||||
|
||||
import javax.mail.internet.MimeUtility;
|
||||
import java.io.*;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
/**
|
||||
* Mime OutputStreamWriter to build in memory Mime message.
|
||||
|
@ -26,6 +26,7 @@ import davmail.exception.DavMailException;
|
||||
public class NetworkDownException extends DavMailException {
|
||||
/**
|
||||
* Build a network down exception with the provided BundleMessage key.
|
||||
*
|
||||
* @param key message key
|
||||
*/
|
||||
public NetworkDownException(String key) {
|
||||
@ -34,7 +35,8 @@ public class NetworkDownException extends DavMailException {
|
||||
|
||||
/**
|
||||
* Build a network down exception with the provided BundleMessage key.
|
||||
* @param key message key
|
||||
*
|
||||
* @param key message key
|
||||
* @param message detailed message
|
||||
*/
|
||||
public NetworkDownException(String key, Object message) {
|
||||
|
@ -108,6 +108,11 @@ public class VCalendar extends VObject {
|
||||
return "TRUE".equals(vObject.getPropertyValue("X-MICROSOFT-CDO-ALLDAYEVENT"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if vCalendar is CDO allday.
|
||||
*
|
||||
* @return true if vCalendar has X-MICROSOFT-CDO-ALLDAYEVENT property set to TRUE
|
||||
*/
|
||||
public boolean isCdoAllDay() {
|
||||
return firstVevent != null && isCdoAllDay(firstVevent);
|
||||
}
|
||||
@ -147,7 +152,7 @@ public class VCalendar extends VObject {
|
||||
String tzid = null;
|
||||
if (fromServer) {
|
||||
// get current tzid
|
||||
VObject vObject = getVTimezone();
|
||||
VObject vObject = vTimezone;
|
||||
if (vObject != null) {
|
||||
String currentTzid = vObject.getPropertyValue("TZID");
|
||||
// fix TZID with \n (Exchange 2010 bug)
|
||||
@ -460,10 +465,14 @@ public class VCalendar extends VObject {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove VAlarm from VCalendar.
|
||||
*/
|
||||
public void removeVAlarm() {
|
||||
if (vObjects != null) {
|
||||
for (VObject vObject : vObjects) {
|
||||
if ("VEVENT".equals(vObject.type)) {
|
||||
// As VALARM is the only possible inner object, just drop all objects
|
||||
if (vObject.vObjects != null) {
|
||||
vObject.vObjects = null;
|
||||
}
|
||||
@ -472,6 +481,11 @@ public class VCalendar extends VObject {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if VCalendar has a VALARM item.
|
||||
*
|
||||
* @return true if VCalendar has a VALARM
|
||||
*/
|
||||
public boolean hasVAlarm() {
|
||||
if (vObjects != null) {
|
||||
for (VObject vObject : vObjects) {
|
||||
@ -485,18 +499,39 @@ public class VCalendar extends VObject {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if this VCalendar is a meeting.
|
||||
*
|
||||
* @return true if this VCalendar has attendees
|
||||
*/
|
||||
public boolean isMeeting() {
|
||||
return getFirstVeventProperty("ATTENDEE") != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if current user is meeting organizer.
|
||||
*
|
||||
* @return true it user email matched organizer email
|
||||
*/
|
||||
public boolean isMeetingOrganizer() {
|
||||
return email.equals(getEmailValue(getFirstVeventProperty("ORGANIZER")));
|
||||
return email.equalsIgnoreCase(getEmailValue(getFirstVeventProperty("ORGANIZER")));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set property value on first VEVENT.
|
||||
*
|
||||
* @param propertyName property name
|
||||
* @param propertyValue property value
|
||||
*/
|
||||
public void setFirstVeventPropertyValue(String propertyName, String propertyValue) {
|
||||
firstVevent.setPropertyValue(propertyName, propertyValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add property on first VEVENT.
|
||||
*
|
||||
* @param vProperty property object
|
||||
*/
|
||||
public void addFirstVeventProperty(VProperty vProperty) {
|
||||
firstVevent.addProperty(vProperty);
|
||||
}
|
||||
@ -505,8 +540,19 @@ public class VCalendar extends VObject {
|
||||
* VCalendar recipients for notifications
|
||||
*/
|
||||
public static class Recipients {
|
||||
/**
|
||||
* attendee list
|
||||
*/
|
||||
public String attendees;
|
||||
|
||||
/**
|
||||
* optional attendee list
|
||||
*/
|
||||
public String optionalAttendees;
|
||||
|
||||
/**
|
||||
* vCalendar organizer
|
||||
*/
|
||||
public String organizer;
|
||||
}
|
||||
|
||||
@ -573,17 +619,22 @@ public class VCalendar extends VObject {
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get recurring VCalendar occurence exceptions.
|
||||
*
|
||||
* @return event occurences
|
||||
*/
|
||||
public List<VObject> getModifiedOccurrences() {
|
||||
boolean first = true;
|
||||
ArrayList<VObject> results = new ArrayList<VObject>();
|
||||
for (VObject vObject:vObjects) {
|
||||
if ("VEVENT".equals(vObject.type)) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
results.add(vObject);
|
||||
}
|
||||
}
|
||||
for (VObject vObject : vObjects) {
|
||||
if ("VEVENT".equals(vObject.type)) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
results.add(vObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
@ -84,6 +84,9 @@ public class VObject {
|
||||
this(new ICSBufferedReader(new StringReader(itemBody)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Create empty VCalendar object;
|
||||
*/
|
||||
public VObject() {
|
||||
}
|
||||
|
||||
@ -101,6 +104,11 @@ public class VObject {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add vObject.
|
||||
*
|
||||
* @param vObject inner object
|
||||
*/
|
||||
public void addVObject(VObject vObject) {
|
||||
if (vObjects == null) {
|
||||
vObjects = new ArrayList<VObject>();
|
||||
@ -108,6 +116,11 @@ public class VObject {
|
||||
vObjects.add(vObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add vProperty.
|
||||
*
|
||||
* @param property vProperty
|
||||
*/
|
||||
public void addProperty(VProperty property) {
|
||||
if (property.getValue() != null) {
|
||||
if (properties == null) {
|
||||
@ -154,6 +167,12 @@ public class VObject {
|
||||
return properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get vProperty by name.
|
||||
*
|
||||
* @param name property name
|
||||
* @return property object
|
||||
*/
|
||||
public VProperty getProperty(String name) {
|
||||
if (properties != null) {
|
||||
for (VProperty property : properties) {
|
||||
@ -166,6 +185,12 @@ public class VObject {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get multivalued vProperty by name.
|
||||
*
|
||||
* @param name property name
|
||||
* @return property list
|
||||
*/
|
||||
public List<VProperty> getProperties(String name) {
|
||||
List<VProperty> result = null;
|
||||
if (properties != null) {
|
||||
@ -182,6 +207,12 @@ public class VObject {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get vProperty value by name.
|
||||
*
|
||||
* @param name property name
|
||||
* @return property value
|
||||
*/
|
||||
public String getPropertyValue(String name) {
|
||||
VProperty property = getProperty(name);
|
||||
if (property != null) {
|
||||
@ -191,6 +222,12 @@ public class VObject {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set vProperty value on vObject, remove property if value is null.
|
||||
*
|
||||
* @param name property name
|
||||
* @param value property value
|
||||
*/
|
||||
public void setPropertyValue(String name, String value) {
|
||||
if (value == null) {
|
||||
removeProperty(name);
|
||||
@ -205,13 +242,24 @@ public class VObject {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add vProperty value on vObject.
|
||||
*
|
||||
* @param name property name
|
||||
* @param value property value
|
||||
*/
|
||||
public void addPropertyValue(String name, String value) {
|
||||
if (value != null) {
|
||||
VProperty property = new VProperty(name, value);
|
||||
addProperty(property);
|
||||
addProperty(property);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove vProperty from vObject.
|
||||
*
|
||||
* @param name property name
|
||||
*/
|
||||
public void removeProperty(String name) {
|
||||
if (properties != null) {
|
||||
VProperty property = getProperty(name);
|
||||
@ -221,6 +269,11 @@ public class VObject {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove vProperty object from vObject.
|
||||
*
|
||||
* @param property object
|
||||
*/
|
||||
public void removeProperty(VProperty property) {
|
||||
if (properties != null) {
|
||||
properties.remove(property);
|
||||
|
@ -234,6 +234,12 @@ public class VProperty {
|
||||
addParam(paramName, (String) null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set param value on property.
|
||||
*
|
||||
* @param paramName param name
|
||||
* @param paramValue param value
|
||||
*/
|
||||
public void setParam(String paramName, String paramValue) {
|
||||
Param currentParam = getParam(paramName);
|
||||
if (currentParam != null) {
|
||||
@ -242,6 +248,12 @@ public class VProperty {
|
||||
addParam(paramName, paramValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add param value on property.
|
||||
*
|
||||
* @param paramName param name
|
||||
* @param paramValue param value
|
||||
*/
|
||||
public void addParam(String paramName, String paramValue) {
|
||||
List<String> paramValues = new ArrayList<String>();
|
||||
paramValues.add(paramValue);
|
||||
|
@ -35,7 +35,7 @@ import java.util.Map;
|
||||
* XmlStreamReader utility methods
|
||||
*/
|
||||
public final class XMLStreamUtil {
|
||||
protected static final Logger LOGGER = Logger.getLogger(XMLStreamUtil.class);
|
||||
private static final Logger LOGGER = Logger.getLogger(XMLStreamUtil.class);
|
||||
|
||||
private XMLStreamUtil() {
|
||||
}
|
||||
@ -114,7 +114,7 @@ public final class XMLStreamUtil {
|
||||
/**
|
||||
* Test if reader is on a start tag.
|
||||
*
|
||||
* @param reader xml stream reader
|
||||
* @param reader xml stream reader
|
||||
* @return true if reader is on a start tag
|
||||
*/
|
||||
public static boolean isStartTag(XMLStreamReader reader) {
|
||||
@ -167,6 +167,12 @@ public final class XMLStreamUtil {
|
||||
return xmlInputFactory.createXMLStreamReader(inputStream);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get element text.
|
||||
*
|
||||
* @param reader stream reader
|
||||
* @return element text
|
||||
*/
|
||||
public static String getElementText(XMLStreamReader reader) {
|
||||
String value = null;
|
||||
try {
|
||||
|
@ -2577,7 +2577,8 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
int totalCount;
|
||||
int lastLogCount;
|
||||
|
||||
public int read(byte buffer[], int offset, int length) throws IOException {
|
||||
@Override
|
||||
public int read(byte[] buffer, int offset, int length) throws IOException {
|
||||
int count = super.read(buffer, offset, length);
|
||||
totalCount += count;
|
||||
if (totalCount - lastLogCount > 1024 * 1024) {
|
||||
|
@ -199,7 +199,6 @@ public class Field {
|
||||
createField(URN_SCHEMAS_CALENDAR, "timezone"); // DistinguishedPropertySetType.PublicStrings/urn:schemas:calendar:timezone/String
|
||||
|
||||
|
||||
|
||||
createField(SCHEMAS_EXCHANGE, "sensitivity"); // PR_SENSITIVITY 0x0036 Integer
|
||||
createField(URN_SCHEMAS_CALENDAR, "timezoneid"); // DistinguishedPropertySetType.PublicStrings/urn:schemas:calendar:timezoneid/Integer
|
||||
// should use PidLidServerProcessed ?
|
||||
|
@ -21,7 +21,7 @@ package davmail.exchange.ews;
|
||||
/**
|
||||
* Item update conflict resolution
|
||||
*/
|
||||
@SuppressWarnings({"JavaDoc"})
|
||||
@SuppressWarnings({"JavaDoc", "UnusedDeclaration"})
|
||||
public final class ConflictResolution extends AttributeOption {
|
||||
private ConflictResolution(String value) {
|
||||
super("ConflictResolution", value);
|
||||
|
@ -21,7 +21,7 @@ package davmail.exchange.ews;
|
||||
/**
|
||||
* DeleteItem disposal type.
|
||||
*/
|
||||
@SuppressWarnings({"JavaDoc"})
|
||||
@SuppressWarnings({"JavaDoc", "UnusedDeclaration"})
|
||||
public class DeleteType extends AttributeOption {
|
||||
private DeleteType(String value) {
|
||||
super("DeleteType", value);
|
||||
|
@ -21,7 +21,7 @@ package davmail.exchange.ews;
|
||||
/**
|
||||
* Disposal.
|
||||
*/
|
||||
@SuppressWarnings({"JavaDoc"})
|
||||
@SuppressWarnings({"JavaDoc", "UnusedDeclaration"})
|
||||
public final class Disposal extends AttributeOption {
|
||||
private Disposal(String value) {
|
||||
super("DeleteType", value);
|
||||
|
@ -43,7 +43,7 @@ public final class DistinguishedFolderId extends FolderId {
|
||||
publicfoldersroot, root, junkemail, searchfolders, voicemail
|
||||
}
|
||||
|
||||
protected static final Map<Name, DistinguishedFolderId> folderIdMap = new HashMap<Name, DistinguishedFolderId>();
|
||||
private static final Map<Name, DistinguishedFolderId> folderIdMap = new HashMap<Name, DistinguishedFolderId>();
|
||||
|
||||
static {
|
||||
for (Name name : Name.values()) {
|
||||
|
@ -447,6 +447,9 @@ public abstract class EWSMethod extends PostMethod {
|
||||
* Recurring event occurrence
|
||||
*/
|
||||
public static class Occurrence {
|
||||
/**
|
||||
* Original occurence start date
|
||||
*/
|
||||
public String originalStart;
|
||||
}
|
||||
|
||||
@ -625,7 +628,7 @@ public abstract class EWSMethod extends PostMethod {
|
||||
/**
|
||||
* Add occurrence.
|
||||
*
|
||||
* @param attendee attendee object
|
||||
* @param occurrence event occurence
|
||||
*/
|
||||
public void addOccurrence(Occurrence occurrence) {
|
||||
if (occurrences == null) {
|
||||
@ -634,6 +637,11 @@ public abstract class EWSMethod extends PostMethod {
|
||||
occurrences.add(occurrence);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get occurences.
|
||||
*
|
||||
* @return event occurences
|
||||
*/
|
||||
public List<Occurrence> getOccurrences() {
|
||||
return occurrences;
|
||||
}
|
||||
@ -818,7 +826,7 @@ public abstract class EWSMethod extends PostMethod {
|
||||
}
|
||||
}
|
||||
|
||||
protected void handleOccurrence(XMLStreamReader reader, Item item) throws XMLStreamException {
|
||||
protected void handleOccurrence(XMLStreamReader reader, Item item) throws XMLStreamException {
|
||||
while (reader.hasNext() && !(XMLStreamUtil.isEndTag(reader, "Occurrence"))) {
|
||||
reader.next();
|
||||
if (XMLStreamUtil.isStartTag(reader)) {
|
||||
|
@ -1398,7 +1398,7 @@ public class EwsExchangeSession extends ExchangeSession {
|
||||
// instancetype 0 single appointment / 1 master recurring appointment
|
||||
if (excludeTasks) {
|
||||
return or(isTrue("isrecurring"),
|
||||
and(isFalse("isrecurring"), dateCondition));
|
||||
and(isFalse("isrecurring"), dateCondition));
|
||||
} else {
|
||||
return or(not(isEqualTo("outlookmessageclass", "IPM.Appointment")),
|
||||
isTrue("isrecurring"),
|
||||
|
@ -139,7 +139,7 @@ public class ExtendedFieldURI implements FieldURI {
|
||||
} else {
|
||||
buffer.append("<t:Value>");
|
||||
if ("0x10f3".equals(propertyTag)) {
|
||||
buffer.append(StringUtil.xmlEncode(StringUtil.encodeUrlcompname(value)));
|
||||
buffer.append(StringUtil.xmlEncode(StringUtil.encodeUrlcompname(value)));
|
||||
} else {
|
||||
buffer.append(StringUtil.xmlEncode(value));
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import java.util.Map;
|
||||
* EWS MAPI fields;
|
||||
*/
|
||||
public final class Field {
|
||||
protected static final Map<String, FieldURI> FIELD_MAP = new HashMap<String, FieldURI>();
|
||||
private static final Map<String, FieldURI> FIELD_MAP = new HashMap<String, FieldURI>();
|
||||
|
||||
private Field() {
|
||||
}
|
||||
@ -161,7 +161,7 @@ public final class Field {
|
||||
FIELD_MAP.put("im", new ExtendedFieldURI(ExtendedFieldURI.DistinguishedPropertySetType.Address, 0x8062, ExtendedFieldURI.PropertyType.String));
|
||||
FIELD_MAP.put("othermobile", new ExtendedFieldURI(0x3A1E, ExtendedFieldURI.PropertyType.String));
|
||||
FIELD_MAP.put("internationalisdnnumber", new ExtendedFieldURI(0x3A2D, ExtendedFieldURI.PropertyType.String));
|
||||
|
||||
|
||||
FIELD_MAP.put("otherTelephone", new ExtendedFieldURI(0x3A21, ExtendedFieldURI.PropertyType.String));
|
||||
FIELD_MAP.put("homefax", new ExtendedFieldURI(0x3A25, ExtendedFieldURI.PropertyType.String));
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class FolderId extends Option {
|
||||
* Build Folder id from response item.
|
||||
*
|
||||
* @param mailbox mailbox name
|
||||
* @param item response item
|
||||
* @param item response item
|
||||
*/
|
||||
public FolderId(String mailbox, EWSMethod.Item item) {
|
||||
this("t:FolderId", item.get("FolderId"), item.get("ChangeKey"), mailbox);
|
||||
|
@ -32,7 +32,6 @@ public class GetUserConfigurationMethod extends EWSMethod {
|
||||
|
||||
/**
|
||||
* Get User Configuration method.
|
||||
*
|
||||
*/
|
||||
public GetUserConfigurationMethod() {
|
||||
super("UserConfiguration", "GetUserConfiguration");
|
||||
|
@ -32,8 +32,10 @@ public class IndexedFieldURI implements FieldURI {
|
||||
/**
|
||||
* Create indexed field uri.
|
||||
*
|
||||
* @param fieldURI base field uri
|
||||
* @param fieldIndex field name
|
||||
* @param fieldURI base field uri
|
||||
* @param fieldIndex field name
|
||||
* @param fieldItemType field item type
|
||||
* @param collectionName collection name
|
||||
*/
|
||||
public IndexedFieldURI(String fieldURI, String fieldIndex, String fieldItemType, String collectionName) {
|
||||
this.fieldURI = fieldURI;
|
||||
|
@ -229,9 +229,8 @@ public final class DavGatewayHttpClientFacade {
|
||||
* @param httpClient httpClient instance
|
||||
* @param url url string
|
||||
* @return HttpStatus code
|
||||
* @throws IOException on error
|
||||
*/
|
||||
public static int getHttpStatus(HttpClient httpClient, String url) throws IOException {
|
||||
public static int getHttpStatus(HttpClient httpClient, String url) {
|
||||
int status = 0;
|
||||
HttpMethod testMethod = new GetMethod(url);
|
||||
testMethod.setDoAuthentication(false);
|
||||
|
@ -30,10 +30,11 @@ public final class DavGatewayOTPPrompt {
|
||||
|
||||
/**
|
||||
* Ask user token password
|
||||
*
|
||||
* @return user provided one time password
|
||||
*/
|
||||
public static String getOneTimePassword() {
|
||||
PasswordPromptDialog passwordPromptDialog = new PasswordPromptDialog(BundleMessage.format("UI_OTP_PASSWORD_PROMPT"));
|
||||
PasswordPromptDialog passwordPromptDialog = new PasswordPromptDialog(BundleMessage.format("UI_OTP_PASSWORD_PROMPT"));
|
||||
return String.valueOf(passwordPromptDialog.getPassword());
|
||||
}
|
||||
}
|
||||
|
@ -18,23 +18,23 @@
|
||||
*/
|
||||
package davmail.http;
|
||||
|
||||
import davmail.Settings;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
import davmail.Settings;
|
||||
import davmail.ui.AcceptCertificateDialog;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
|
||||
import javax.net.ssl.TrustManager;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
import javax.net.ssl.X509TrustManager;
|
||||
import java.awt.*;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.security.*;
|
||||
import java.security.cert.CertificateEncodingException;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.io.IOException;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
/**
|
||||
* Custom Trust Manager, let user accept or deny.
|
||||
|
@ -187,7 +187,7 @@ public class NTLMv2Scheme implements AuthScheme {
|
||||
this.state = TYPE1_MSG_GENERATED;
|
||||
} else {
|
||||
int flags = NtlmFlags.NTLMSSP_NEGOTIATE_NTLM2 | NtlmFlags.NTLMSSP_NEGOTIATE_ALWAYS_SIGN |
|
||||
NtlmFlags.NTLMSSP_NEGOTIATE_NTLM | NtlmFlags.NTLMSSP_NEGOTIATE_UNICODE;
|
||||
NtlmFlags.NTLMSSP_NEGOTIATE_NTLM | NtlmFlags.NTLMSSP_NEGOTIATE_UNICODE;
|
||||
Type3Message type3Message = new Type3Message(type2Message, ntcredentials.getPassword(),
|
||||
ntcredentials.getDomain(), ntcredentials.getUserName(), ntcredentials.getHost(), flags);
|
||||
response = EncodingUtil.getAsciiString(Base64.encodeBase64(type3Message.toByteArray()));
|
||||
|
@ -20,9 +20,9 @@ package davmail.http;
|
||||
|
||||
import sun.security.pkcs11.SunPKCS11;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.security.Provider;
|
||||
import java.security.Security;
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
||||
/**
|
||||
* Add the SunPKCS11 Provider.
|
||||
|
@ -94,7 +94,7 @@ public class ImapConnection extends AbstractConnection {
|
||||
commandId = tokens.nextToken();
|
||||
|
||||
checkInfiniteLoop(line);
|
||||
|
||||
|
||||
if (tokens.hasMoreTokens()) {
|
||||
String command = tokens.nextToken();
|
||||
|
||||
@ -622,6 +622,7 @@ public class ImapConnection extends AbstractConnection {
|
||||
|
||||
/**
|
||||
* Detect infinite loop on the client side.
|
||||
*
|
||||
* @param line IMAP command line
|
||||
* @throws IOException on infinite loop
|
||||
*/
|
||||
@ -637,7 +638,7 @@ public class ImapConnection extends AbstractConnection {
|
||||
lastCommandCount++;
|
||||
if (lastCommandCount > 100 && !"NOOP".equalsIgnoreCase(lastCommand)) {
|
||||
// more than a hundred times the same command => this is a client infinite loop, close connection
|
||||
throw new IOException("Infinite loop on command "+command+" detected");
|
||||
throw new IOException("Infinite loop on command " + command + " detected");
|
||||
}
|
||||
} else {
|
||||
// new command, reset
|
||||
|
@ -42,7 +42,7 @@ public class ImapServer extends AbstractServer {
|
||||
*/
|
||||
public ImapServer(int port) {
|
||||
super(ImapServer.class.getName(), port, ImapServer.DEFAULT_PORT);
|
||||
nosslFlag = Settings.getBooleanProperty("davmail.ssl.nosecureimap");
|
||||
nosslFlag = Settings.getBooleanProperty("davmail.ssl.nosecureimap");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -469,7 +469,7 @@ public class LdapConnection extends AbstractConnection {
|
||||
}
|
||||
|
||||
DavGatewayTray.switchIcon();
|
||||
|
||||
|
||||
handleRequest(inbuf, offset);
|
||||
}
|
||||
|
||||
@ -487,7 +487,7 @@ public class LdapConnection extends AbstractConnection {
|
||||
} finally {
|
||||
// cancel all search threads
|
||||
synchronized (searchThreadMap) {
|
||||
for (SearchRunnable searchRunnable:searchThreadMap.values()) {
|
||||
for (SearchRunnable searchRunnable : searchThreadMap.values()) {
|
||||
searchRunnable.abandon();
|
||||
}
|
||||
}
|
||||
|
@ -39,9 +39,9 @@ public class LdapServer extends AbstractServer {
|
||||
*
|
||||
* @param port pop listen port, 389 if not defined (0)
|
||||
*/
|
||||
public LdapServer(int port) {
|
||||
public LdapServer(int port) {
|
||||
super(LdapServer.class.getName(), port, LdapServer.DEFAULT_PORT);
|
||||
nosslFlag = Settings.getBooleanProperty("davmail.ssl.nosecureldap");
|
||||
nosslFlag = Settings.getBooleanProperty("davmail.ssl.nosecureldap");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -93,7 +93,7 @@ public class PopConnection extends AbstractConnection {
|
||||
|
||||
try {
|
||||
ExchangeSessionFactory.checkConfig();
|
||||
sendOK("DavMail "+ DavGateway.getCurrentVersion()+" POP ready at " + new Date());
|
||||
sendOK("DavMail " + DavGateway.getCurrentVersion() + " POP ready at " + new Date());
|
||||
|
||||
for (; ;) {
|
||||
line = readClient();
|
||||
|
@ -37,11 +37,12 @@ public class PopServer extends AbstractServer {
|
||||
/**
|
||||
* Create a ServerSocket to listen for connections.
|
||||
* Start the thread.
|
||||
*
|
||||
* @param port pop listen port, 110 if not defined (0)
|
||||
*/
|
||||
public PopServer(int port) {
|
||||
public PopServer(int port) {
|
||||
super(PopServer.class.getName(), port, PopServer.DEFAULT_PORT);
|
||||
nosslFlag = Settings.getBooleanProperty("davmail.ssl.nosecurepop");
|
||||
nosslFlag = Settings.getBooleanProperty("davmail.ssl.nosecurepop");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,7 +62,7 @@ public class SmtpConnection extends AbstractConnection {
|
||||
|
||||
try {
|
||||
ExchangeSessionFactory.checkConfig();
|
||||
sendClient("220 DavMail "+ DavGateway.getCurrentVersion()+" SMTP ready at " + new Date());
|
||||
sendClient("220 DavMail " + DavGateway.getCurrentVersion() + " SMTP ready at " + new Date());
|
||||
for (; ;) {
|
||||
line = readClient();
|
||||
// unable to read line, connection closed ?
|
||||
|
@ -36,11 +36,12 @@ public class SmtpServer extends AbstractServer {
|
||||
/**
|
||||
* Create a ServerSocket to listen for connections.
|
||||
* Start the thread.
|
||||
*
|
||||
* @param port smtp port
|
||||
*/
|
||||
public SmtpServer(int port) {
|
||||
super(SmtpServer.class.getName(), port, SmtpServer.DEFAULT_PORT);
|
||||
nosslFlag = Settings.getBooleanProperty("davmail.ssl.nosecuresmtp");
|
||||
nosslFlag = Settings.getBooleanProperty("davmail.ssl.nosecuresmtp");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,10 +18,10 @@
|
||||
*/
|
||||
package davmail.ui;
|
||||
|
||||
import davmail.DavGateway;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
import davmail.DavGateway;
|
||||
import davmail.ui.browser.DesktopBrowser;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.*;
|
||||
|
@ -18,9 +18,9 @@
|
||||
*/
|
||||
package davmail.ui;
|
||||
|
||||
import davmail.BundleMessage;
|
||||
import davmail.http.DavGatewayX509TrustManager;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
import davmail.BundleMessage;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
@ -32,7 +32,7 @@ import java.awt.event.ActionListener;
|
||||
*/
|
||||
public class NotificationDialog extends JDialog {
|
||||
|
||||
protected boolean sendNotification = false;
|
||||
protected boolean sendNotification;
|
||||
|
||||
protected JTextField toField;
|
||||
protected JTextField ccField;
|
||||
@ -56,6 +56,13 @@ public class NotificationDialog extends JDialog {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notification dialog to let user edit message body or cancel notification.
|
||||
*
|
||||
* @param to main recipients
|
||||
* @param cc copy recipients
|
||||
* @param subject notification subject
|
||||
*/
|
||||
public NotificationDialog(String to, String cc, String subject) {
|
||||
setModal(true);
|
||||
setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
|
||||
@ -157,22 +164,47 @@ public class NotificationDialog extends JDialog {
|
||||
return bodyPanel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel notification flag.
|
||||
*
|
||||
* @return false if user chose to cancel notification
|
||||
*/
|
||||
public boolean getSendNotification() {
|
||||
return sendNotification;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get edited recipients.
|
||||
*
|
||||
* @return recipients string
|
||||
*/
|
||||
public String getTo() {
|
||||
return toField.getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get edited copy recipients.
|
||||
*
|
||||
* @return copy recipients string
|
||||
*/
|
||||
public String getCc() {
|
||||
return ccField.getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get edited subject.
|
||||
*
|
||||
* @return subject
|
||||
*/
|
||||
public String getSubject() {
|
||||
return subjectField.getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get edited body.
|
||||
*
|
||||
* @return edited notification body
|
||||
*/
|
||||
public String getBody() {
|
||||
return bodyField.getText();
|
||||
}
|
||||
|
@ -18,7 +18,10 @@
|
||||
*/
|
||||
package davmail.ui;
|
||||
|
||||
import java.lang.reflect.*;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
|
||||
/**
|
||||
* Reflection based MacOS handler
|
||||
@ -195,6 +198,7 @@ public class OSXAdapter implements InvocationHandler {
|
||||
|
||||
//
|
||||
//
|
||||
|
||||
/**
|
||||
* Compare the method that was called to the intended method when the OSXAdapter instance was created
|
||||
* (e.g. handleAbout, handleQuit, handleOpenFile, etc.).
|
||||
|
@ -571,7 +571,7 @@ public class SettingsFrame extends JFrame {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
DesktopBrowser.browse("http://davmail.sourceforge.net");
|
||||
}
|
||||
});
|
||||
});
|
||||
tabbedPane.addChangeListener(new ChangeListener() {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
boolean isSslEnabled = isSslEnabled();
|
||||
|
@ -18,9 +18,9 @@
|
||||
*/
|
||||
package davmail.ui.browser;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* Wrapper class to call Java6 Desktop class to launch default browser.
|
||||
|
@ -18,9 +18,9 @@
|
||||
*/
|
||||
package davmail.ui.browser;
|
||||
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
import davmail.ui.AboutFrame;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.ui.AboutFrame;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
@ -36,6 +36,6 @@ public final class OSXDesktopBrowser {
|
||||
* @throws IOException on error
|
||||
*/
|
||||
public static void browse(URI location) throws IOException {
|
||||
Runtime.getRuntime().exec("open "+location.toString());
|
||||
Runtime.getRuntime().exec("open " + location.toString());
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ import org.eclipse.swt.program.Program;
|
||||
import java.net.URI;
|
||||
|
||||
/**
|
||||
* Wrapper class to call SWT Program class to launch default browser.
|
||||
* Wrapper class to call SWT Program class to launch default browser.
|
||||
*/
|
||||
public final class SwtDesktopBrowser {
|
||||
private SwtDesktopBrowser() {
|
||||
|
@ -18,13 +18,13 @@
|
||||
*/
|
||||
package davmail.ui.tray;
|
||||
|
||||
import davmail.Settings;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.DavGateway;
|
||||
import davmail.Settings;
|
||||
import davmail.ui.AboutFrame;
|
||||
import davmail.ui.SettingsFrame;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.lf5.LF5Appender;
|
||||
import org.apache.log4j.lf5.LogLevel;
|
||||
import org.apache.log4j.lf5.viewer.LogBrokerMonitor;
|
||||
|
@ -18,11 +18,11 @@
|
||||
*/
|
||||
package davmail.ui.tray;
|
||||
|
||||
import davmail.Settings;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.Settings;
|
||||
import davmail.exchange.NetworkDownException;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
|
@ -18,13 +18,13 @@
|
||||
*/
|
||||
package davmail.ui.tray;
|
||||
|
||||
import davmail.Settings;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.DavGateway;
|
||||
import davmail.Settings;
|
||||
import davmail.ui.AboutFrame;
|
||||
import davmail.ui.SettingsFrame;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.Level;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.lf5.LF5Appender;
|
||||
import org.apache.log4j.lf5.LogLevel;
|
||||
import org.apache.log4j.lf5.viewer.LogBrokerMonitor;
|
||||
|
@ -18,9 +18,9 @@
|
||||
*/
|
||||
package davmail.ui.tray;
|
||||
|
||||
import davmail.ui.OSXAdapter;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.DavGateway;
|
||||
import davmail.ui.OSXAdapter;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
@ -366,7 +366,7 @@ public final class StringUtil {
|
||||
* Get allday date value from zulu timestamp.
|
||||
*
|
||||
* @param value zulu datetime
|
||||
* @return yyyyMMdd allday date value
|
||||
* @return yyyyMMdd allday date value
|
||||
*/
|
||||
public static String convertZuluDateTimeToAllDay(String value) {
|
||||
String result = value;
|
||||
|
@ -18,15 +18,15 @@
|
||||
*/
|
||||
package davmail.web;
|
||||
|
||||
import davmail.Settings;
|
||||
import davmail.DavGateway;
|
||||
import davmail.BundleMessage;
|
||||
import davmail.DavGateway;
|
||||
import davmail.Settings;
|
||||
import davmail.ui.tray.DavGatewayTray;
|
||||
|
||||
import javax.servlet.ServletContextListener;
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import java.io.InputStream;
|
||||
import javax.servlet.ServletContextListener;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* Context Listener to start/stop DavMail
|
||||
|
Loading…
x
Reference in New Issue
Block a user