Update event: added logging

pull/212/head
M66B 2 years ago
parent 09e9777f47
commit 628d17230f

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

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

Loading…
Cancel
Save