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:
parent
09e9777f47
commit
628d17230f
2 changed files with 16 additions and 3 deletions
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue