1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2025-02-24 07:01:05 +00:00

Update event: added logging

This commit is contained in:
M66B 2023-05-05 07:31:51 +02:00
parent 09e9777f47
commit 628d17230f
2 changed files with 16 additions and 3 deletions

View file

@ -253,17 +253,26 @@ public class CalendarHelper {
static void update(Context context, VEvent event, EntityMessage message) {
String uid = (event.getUid() == null ? null : event.getUid().getValue());
if (TextUtils.isEmpty(uid))
if (TextUtils.isEmpty(uid)) {
EntityLog.log(context, EntityLog.Type.General, message,
"Update event: no uid");
return;
}
List<Attendee> attendees = event.getAttendees();
if (attendees == null || attendees.size() == 0)
if (attendees == null || attendees.size() == 0) {
EntityLog.log(context, EntityLog.Type.General, message,
"Update event: no attendees");
return;
}
ParticipationStatus status = attendees.get(0).getParticipationStatus();
if (!ParticipationStatus.ACCEPTED.equals(status) &&
!ParticipationStatus.DECLINED.equals(status))
!ParticipationStatus.DECLINED.equals(status)) {
EntityLog.log(context, EntityLog.Type.General, message,
"Update event: not accepted/declined");
return;
}
ContentResolver resolver = context.getContentResolver();
try (Cursor cursor = resolver.query(CalendarContract.Events.CONTENT_URI,
@ -271,6 +280,9 @@ public class CalendarHelper {
CalendarContract.Events.UID_2445 + " = ?",
new String[]{uid},
null)) {
if (cursor.getCount() == 0)
EntityLog.log(context, EntityLog.Type.General, message,
"Update event: uid not found");
while (cursor.moveToNext()) {
long eventId = cursor.getLong(0);

View file

@ -1039,6 +1039,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
VEvent event = icalendar.getEvents().get(0);
EntityMessage message = db.message().getMessage(sid);
CalendarHelper.update(this, event, message);
break;
} catch (Throwable ex) {
Log.e(ex);