Skip to content

Commit 0ccbd69

Browse files
committed
add XGMTHRID
1 parent 3e9ff50 commit 0ccbd69

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

imap/imapCommands.ml

+10-1
Original file line numberDiff line numberDiff line change
@@ -965,9 +965,12 @@ end
965965
module XGmExt1 = struct
966966
type msg_att_extension +=
967967
MSG_ATT_XGMMSGID of Uint64.t
968+
| MSG_ATT_XGMTHRID of Uint64.t
968969
| MSG_ATT_XGMLABELS of string list
969970

970971
let fetch_att_xgmmsgid = FETCH_ATT_EXTENSION "X-GM-MSGID"
972+
973+
let fetch_att_xgmthrid = FETCH_ATT_EXTENSION "X-GM-THRID"
971974

972975
let fetch_att_xgmlabels = FETCH_ATT_EXTENSION "X-GM-LABELS"
973976

@@ -979,6 +982,8 @@ module XGmExt1 = struct
979982
function
980983
MSG_ATT_XGMMSGID id ->
981984
Some (fun ppf -> fprintf ppf "(x-gm-msgid %s)" (Uint64.to_string id))
985+
| MSG_ATT_XGMTHRID id ->
986+
Some (fun ppf -> fprintf ppf "(x-gm-thrid %s)" (Uint64.to_string id))
982987
| MSG_ATT_XGMLABELS labels ->
983988
let p ppf = List.iter (fun x -> fprintf ppf "@ %S" x) in
984989
Some (fun ppf -> fprintf ppf "@[<2>(x-gm-labels%a)@]" p labels)
@@ -994,14 +999,18 @@ module XGmExt1 = struct
994999
str "X-GM-MSGID" >> char ' ' >> uint64 >>= fun n ->
9951000
ret (MSG_ATT_XGMMSGID n)
9961001
in
1002+
let thrid =
1003+
str "X-GM-THRID" >> char ' ' >> uint64 >>= fun n ->
1004+
ret (MSG_ATT_XGMTHRID n)
1005+
in
9971006
let labels =
9981007
str "X-GM-LABELS" >> char ' ' >>
9991008
char '(' >> sep (char ' ') astring >>= fun labels -> char ')' >>
10001009
ret (MSG_ATT_XGMLABELS labels)
10011010
in
10021011
match kind with
10031012
FETCH_DATA ->
1004-
alt msgid labels
1013+
altn [ msgid; thrid; labels ]
10051014
| _ ->
10061015
fail
10071016

imap/imapCommands.mli

+4-1
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,13 @@ end
157157
module XGmExt1 : sig
158158
type msg_att_extension +=
159159
MSG_ATT_XGMMSGID of Uint64.t
160-
| MSG_ATT_XGMLABELS of string list
160+
| MSG_ATT_XGMTHRID of Uint64.t
161+
| MSG_ATT_XGMLABELS of string list
161162

162163
val fetch_att_xgmmsgid : fetch_att
163164

165+
val fetch_att_xgmthrid : fetch_att
166+
164167
val fetch_att_xgmlabels : fetch_att
165168

166169
val uid_store_xgmlabels : ImapSet.t -> store_att_flags_sign -> bool -> string list -> unit command

lwt/imapLwt.ml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,7 @@ let fetch_messages s ~folder ~request ~req_type ?(modseq = Modseq.zero) ?mapping
13011301
| GmailLabels :: rest ->
13021302
loop (ImapCommands.XGmExt1.fetch_att_xgmlabels :: acc) headers rest
13031303
| GmailThreadID :: rest ->
1304-
failwith "fetch gmail thread id not implemented"
1304+
loop (ImapCommands.XGmExt1.fetch_att_xgmthrid :: acc) headers rest
13051305
| GmailMessageID :: rest ->
13061306
loop (ImapCommands.XGmExt1.fetch_att_xgmmsgid :: acc) headers rest
13071307
| FullHeaders :: rest ->
@@ -1371,6 +1371,9 @@ let fetch_messages s ~folder ~request ~req_type ?(modseq = Modseq.zero) ?mapping
13711371
| MSG_ATT_ITEM_EXTENSION (ImapCommands.XGmExt1.MSG_ATT_XGMMSGID gmail_message_id') ->
13721372
gmail_message_id := gmail_message_id';
13731373
needs_gmail_message_id := false
1374+
| MSG_ATT_ITEM_EXTENSION (ImapCommands.XGmExt1.MSG_ATT_XGMTHRID gmail_thread_id') ->
1375+
gmail_thread_id := gmail_thread_id';
1376+
needs_gmail_thread_id := false
13741377
| _ -> (* FIXME *) ()
13751378
in
13761379

0 commit comments

Comments
 (0)