|
|
@ -4416,9 +4416,6 @@ public class MessageHelper {
|
|
|
|
private void decodeICalendar(Context context, EntityAttachment local) {
|
|
|
|
private void decodeICalendar(Context context, EntityAttachment local) {
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
DB db = DB.getInstance(context);
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
boolean ical_tentative = prefs.getBoolean("ical_tentative", true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean permission = Helper.hasPermission(context, Manifest.permission.WRITE_CALENDAR);
|
|
|
|
boolean permission = Helper.hasPermission(context, Manifest.permission.WRITE_CALENDAR);
|
|
|
|
|
|
|
|
|
|
|
|
EntityMessage message = db.message().getMessage(local.message);
|
|
|
|
EntityMessage message = db.message().getMessage(local.message);
|
|
|
@ -4430,17 +4427,19 @@ public class MessageHelper {
|
|
|
|
EntityFolder.SYSTEM.equals(folder.type) ||
|
|
|
|
EntityFolder.SYSTEM.equals(folder.type) ||
|
|
|
|
EntityFolder.USER.equals(folder.type)));
|
|
|
|
EntityFolder.USER.equals(folder.type)));
|
|
|
|
|
|
|
|
|
|
|
|
if (!permission || !received || account == null || account.calendar == null || !ical_tentative) {
|
|
|
|
if (!permission || !received || account == null || account.calendar == null) {
|
|
|
|
EntityLog.log(context, "Event not processed" +
|
|
|
|
EntityLog.log(context, "Event not processed" +
|
|
|
|
" permission=" + permission +
|
|
|
|
" permission=" + permission +
|
|
|
|
" account=" + (account != null) +
|
|
|
|
" account=" + (account != null) +
|
|
|
|
" folder=" + (folder != null) + ":" + (folder == null ? null : folder.type) +
|
|
|
|
" folder=" + (folder != null) + ":" + (folder == null ? null : folder.type) +
|
|
|
|
" received=" + received +
|
|
|
|
" received=" + received +
|
|
|
|
" calendar=" + (account == null ? null : account.calendar) +
|
|
|
|
" calendar=" + (account == null ? null : account.calendar));
|
|
|
|
" tentative=" + ical_tentative);
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
boolean ical_tentative = prefs.getBoolean("ical_tentative", true);
|
|
|
|
|
|
|
|
|
|
|
|
File file = local.getFile(context);
|
|
|
|
File file = local.getFile(context);
|
|
|
|
ICalendar icalendar = Biweekly.parse(file).first();
|
|
|
|
ICalendar icalendar = Biweekly.parse(file).first();
|
|
|
|
|
|
|
|
|
|
|
@ -4450,10 +4449,13 @@ public class MessageHelper {
|
|
|
|
// https://www.rfc-editor.org/rfc/rfc5546#section-3.2
|
|
|
|
// https://www.rfc-editor.org/rfc/rfc5546#section-3.2
|
|
|
|
if (method != null && method.isCancel())
|
|
|
|
if (method != null && method.isCancel())
|
|
|
|
CalendarHelper.delete(context, event, message);
|
|
|
|
CalendarHelper.delete(context, event, message);
|
|
|
|
else if (method == null || method.isRequest())
|
|
|
|
else if (method == null || method.isRequest()) {
|
|
|
|
CalendarHelper.insert(context, icalendar, event,
|
|
|
|
if (ical_tentative)
|
|
|
|
CalendarContract.Events.STATUS_TENTATIVE, account, message);
|
|
|
|
CalendarHelper.insert(context, icalendar, event,
|
|
|
|
else
|
|
|
|
CalendarContract.Events.STATUS_TENTATIVE, account, message);
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
EntityLog.log(context, "Tentative event not stored");
|
|
|
|
|
|
|
|
} else
|
|
|
|
EntityLog.log(context, "Unknown event method=" + method.getValue());
|
|
|
|
EntityLog.log(context, "Unknown event method=" + method.getValue());
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
Log.w(ex);
|
|
|
|
Log.w(ex);
|
|
|
|