Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add priority headers for email #106

Merged
merged 2 commits into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [0.3.3] - 2025-02-07
- Add priority headers for email

## [0.3.2] - 2024-01-10
- Add Email/parse method

Expand Down
45 changes: 45 additions & 0 deletions lib/jmap/mail/email/email.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ class Email with EquatableMixin {
final Map<IndividualHeaderIdentifier, String?>? headerCalendarEvent;
final Map<IndividualHeaderIdentifier, String?>? sMimeStatusHeader;
final Map<IndividualHeaderIdentifier, String?>? identityHeader;
final Map<IndividualHeaderIdentifier, String?>? xPriorityHeader;
final Map<IndividualHeaderIdentifier, String?>? importanceHeader;
final Map<IndividualHeaderIdentifier, String?>? priorityHeader;

Email({
this.id,
Expand Down Expand Up @@ -86,6 +89,9 @@ class Email with EquatableMixin {
this.headerCalendarEvent,
this.sMimeStatusHeader,
this.identityHeader,
this.xPriorityHeader,
this.importanceHeader,
this.priorityHeader,
});

factory Email.fromJson(Map<String, dynamic> json) {
Expand Down Expand Up @@ -123,6 +129,21 @@ class Email with EquatableMixin {
headerCalendarEvent: IndividualHeaderIdentifierNullableConverter().parseEntry(IndividualHeaderIdentifier.headerCalendarEvent.value, json[IndividualHeaderIdentifier.headerCalendarEvent.value] as String?),
sMimeStatusHeader: IndividualHeaderIdentifierNullableConverter().parseEntry(IndividualHeaderIdentifier.sMimeStatusHeader.value, json[IndividualHeaderIdentifier.sMimeStatusHeader.value] as String?),
identityHeader: IndividualHeaderIdentifierNullableConverter().parseEntry(IndividualHeaderIdentifier.identityHeader.value, json[IndividualHeaderIdentifier.identityHeader.value] as String?),
xPriorityHeader: IndividualHeaderIdentifierNullableConverter()
.parseEntry(
IndividualHeaderIdentifier.xPriorityHeader.value,
json[IndividualHeaderIdentifier.xPriorityHeader.value] as String?,
),
importanceHeader: IndividualHeaderIdentifierNullableConverter()
.parseEntry(
IndividualHeaderIdentifier.importanceHeader.value,
json[IndividualHeaderIdentifier.importanceHeader.value] as String?,
),
priorityHeader: IndividualHeaderIdentifierNullableConverter()
.parseEntry(
IndividualHeaderIdentifier.priorityHeader.value,
json[IndividualHeaderIdentifier.priorityHeader.value] as String?,
),
);
}

Expand Down Expand Up @@ -166,6 +187,27 @@ class Email with EquatableMixin {
writeNotNull(IndividualHeaderIdentifier.headerCalendarEvent.value, IndividualHeaderIdentifierNullableConverter().toJson(headerCalendarEvent, IndividualHeaderIdentifier.headerCalendarEvent));
writeNotNull(IndividualHeaderIdentifier.sMimeStatusHeader.value, IndividualHeaderIdentifierNullableConverter().toJson(sMimeStatusHeader, IndividualHeaderIdentifier.sMimeStatusHeader));
writeNotNull(IndividualHeaderIdentifier.identityHeader.value, IndividualHeaderIdentifierNullableConverter().toJson(identityHeader, IndividualHeaderIdentifier.identityHeader));
writeNotNull(
IndividualHeaderIdentifier.xPriorityHeader.value,
IndividualHeaderIdentifierNullableConverter().toJson(
xPriorityHeader,
IndividualHeaderIdentifier.xPriorityHeader,
),
);
writeNotNull(
IndividualHeaderIdentifier.importanceHeader.value,
IndividualHeaderIdentifierNullableConverter().toJson(
importanceHeader,
IndividualHeaderIdentifier.importanceHeader,
),
);
writeNotNull(
IndividualHeaderIdentifier.priorityHeader.value,
IndividualHeaderIdentifierNullableConverter().toJson(
priorityHeader,
IndividualHeaderIdentifier.priorityHeader,
),
);
return val;
}

Expand Down Expand Up @@ -202,6 +244,9 @@ class Email with EquatableMixin {
headerCalendarEvent,
sMimeStatusHeader,
identityHeader,
xPriorityHeader,
importanceHeader,
priorityHeader,
];
}

Expand Down
3 changes: 3 additions & 0 deletions lib/jmap/mail/email/individual_header_identifier.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ class IndividualHeaderIdentifier with EquatableMixin {
static final contentLanguageHeader = IndividualHeaderIdentifier('header:Content-Language:asText');
static final sMimeStatusHeader = IndividualHeaderIdentifier('header:X-SMIME-Status:asText');
static final identityHeader = IndividualHeaderIdentifier('header:X-JMAP-Identity:asText');
static final xPriorityHeader = IndividualHeaderIdentifier('header:X-Priority:asText');
static final priorityHeader = IndividualHeaderIdentifier('header:Priority:asText');
static final importanceHeader = IndividualHeaderIdentifier('header:Importance:asText');

final String value;

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: jmap_dart_client
description: A JMAP client library to make JMAP method calls and process the responses.
version: 0.3.2
version: 0.3.3
homepage: https://github.com/linagora/jmap-dart-client.git

environment:
Expand Down