-
Notifications
You must be signed in to change notification settings - Fork 50
1st, 2st, 3st, and 4st -- added the UID to the FETCH message #151
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
Open
wu0lss4j
wants to merge
1
commit into
nicm:master
Choose a base branch
from
wu0lss4j:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
modified: imap-common.c
modified lines 1153 and 1188 adding UID FETCH instead of just FETCH,
hopefully now fdm will get all of gmail's special headers like
X-GM-LABELS, X-GM-THRID, and X-GM-MSGID
removed one UID FETCH because the return msg apparently the IMAP server
does not reply UID FETCH rather just FETCH
added the necessary logic to locate the " UID {UID}" at the end of the
IMAP server's reply to the UID FETCH instruction, correctly assuming
that everything that is in the message between X-GM-LABELS and UID are
the labels, it even checks for the special case where there are no gmail
labels.
Note: Gmail is extra special with labels, because if you tell fdm to
fetch all email from a single label, that label is not returned by gmail
and fdm will never see it. This is because gmail treats labels as
virtual folders.
Not happy with the code, and I think it can be further improved, it's
still quite fast, and I've yet to find another edge case with labels. So
far so good.
modified: configure.ac
added version info, but somehow doesn't stick, I wanted to call this
program fdm_i 2.2i_1 but ¯\_(ツ)_/¯, it ain't workin...
Owner
|
This seems more complicated than necessary, you just need to skip everything after the |
Owner
|
Or maybe the labels can contain )s? |
Author
|
Hi, I am not sure because, you can also have a ) in your label, for some
reason. So, if your code logic is to drop everything after the 1st closing
parenthesis after X-GM-LABELS, it may be counter productive, that is why I
went from the other direction, when I am “sure” that the ending is always “
UID nnn)”, or?
Sent from Gmail Mobile for iOS
Nicholas Marriott ***@***.***> escreveu
em seg., 20/10/2025 às 09:51 :
… nicm left a comment (nicm/fdm#151) This seems more complicated than
necessary, you just need to skip everything after the ) which clsoes the
X-GM-LABELS, no? So couldn't you just find that ), somethin
*DuckDuckGo* removed one tracker. More
<https://duckduckgo.com/-QoZ-qo7TnhDML4wcTPRCLPOUxlrW5ZFY2IRFm2gaIr8gz0gvrY1gwyCgj5emdt29ktrgGygxYAnC8nBsFIzk01thm5vAEU2cJNkYiOIcAqolkapVqE2WP5LeUWjOPYpLU6gQV9YA_1OAJgwi91JA8vK1s39_nCEvmM-1T9dVHr4-6G0SrrckxxrT3nwzOriJ72BZ8fO65dufRmMOetCYAzQcif0_vhExrnAab6GoJYrGB1hy2EhUycO0Ho3uFRLa9elW8LqIh7AQB1JBuBJfAWx0AZ2uBGWIytOtgY5lOi4D07AeECPKAklzwTYieknH3kFzWc_ymRBvglB2lHIUtam0lBViVzE1vQUU0J-FnjBTGL_i4vu4uYzxGUBgSTvO7d050yBkBbiNWe1Guh187ddICXcQIk6j1-QttTYbUexiY1KnWwAcT_wNTpLSNHe5Zg8Itz0HKUwkWyBgXGysQHp37-CJIWl-Y7xfS5MVjktvlbiKqQQiWiDDg>
Deactivate
<https://duckduckgo.com/>
*nicm* left a comment (nicm/fdm#151)
<#151 (comment)>
This seems more complicated than necessary, you just need to skip
everything after the ) which clsoes the X-GM-LABELS, no? So couldn't you
just find that ), something like:
@@ -1193,10 +1193,9 @@ imap_state_gmext_body(struct account *a, struct fetch_ctx *fctx)
if ((lb = strchr(lb, '(')) == NULL)
return (imap_invalid(a, line));
lb++; /* drop '(' */
- lblen = strlen(lb);
- if (lblen < 2 || lb[lblen - 1] != ')' || lb[lblen - 2] != ')')
+ if ((br = strchr(lb, ')') == NULL)
return (imap_invalid(a, line));
- lblen -= 2; /* drop '))' from the end */
+ lblen = br - lb;
add_tag(&m->tags, "gmail_msgid", "%llu", msgid);
add_tag(&m->tags, "gmail_thrid", "%llu", thrid);
—
Reply to this email directly, view it on GitHub
<#151 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/BDIRDFAEE7ZBBRSEO6SE7S33YSIBFAVCNFSM6AAAAACJBK33F6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTIMRQHE2TOMBYGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On branch master
Your branch is up to date with 'origin/master'.
Changes to be committed:
modified: imap-common.c
modified lines 1153 and 1188 adding UID FETCH instead of just FETCH, hopefully now fdm will get all of gmail's special headers like X-GM-LABELS, X-GM-THRID, and X-GM-MSGID
removed one UID FETCH because the return msg apparently the IMAP server does not reply UID FETCH rather just FETCH
added the necessary logic to locate the " UID {UID}" at the end of the IMAP server's reply to the UID FETCH instruction, correctly assuming that everything that is in the message between X-GM-LABELS and UID are the labels, it even checks for the special case where there are no gmail labels.
Note: Gmail is extra special with labels, because if you tell fdm to fetch all email from a single label, that label is not returned by gmail and fdm will never see it. This is because gmail treats labels as virtual folders.
Not happy with the code, and I think it can be further improved, it's still quite fast, and I've yet to find another edge case with labels. So far so good.
added version info, but somehow doesn't stick, I wanted to call this program fdm_i 2.2i_1 but ¯_(ツ)_/¯, it ain't workin...