Comments (8)
I don't know of any way right now, so no foreseeable way to add this -- BUT if anyone finds a way to get all emails of a certain Thread (Gmail conversations) via IMAP or some other way, please comment here!
from ruby-gmail.
http://code.google.com/apis/gmail/imap/#x-gm-thrid
from ruby-gmail.
data = gmail.imap.fetch(message.uid, "(X-GM-MSGID)")
I'm getting ParseError exception - Ruby's net/imap does not recognize the attribute.
I'm now trying to monkey-patch net/imap in the Large Hadron Collider.
from ruby-gmail.
Found the patch somewhere (adds two last when cases):
module Net
class IMAP
class ResponseParser
def msg_att
match(T_LPAR)
attr = {}
while true
token = lookahead
case token.symbol
when T_RPAR
shift_token
break
when T_SPACE
shift_token
token = lookahead
end
case token.value
when /\A(?:ENVELOPE)\z/ni
name, val = envelope_data
when /\A(?:FLAGS)\z/ni
name, val = flags_data
when /\A(?:INTERNALDATE)\z/ni
name, val = internaldate_data
when /\A(?:RFC822(?:\.HEADER|\.TEXT)?)\z/ni
name, val = rfc822_text
when /\A(?:RFC822\.SIZE)\z/ni
name, val = rfc822_size
when /\A(?:BODY(?:STRUCTURE)?)\z/ni
name, val = body_data
when /\A(?:UID)\z/ni
name, val = uid_data
when /\A(?:X-GM-MSGID)\z/ni # Added X-GM-MSGID extension
name, val = uid_data
when /\A(?:X-GM-THRID)\z/ni # Added X-GM-THRID extension
name, val = uid_data
else
parse_error("unknown attribute `%s'", token.value)
end
attr[name] = val
end
return attr
end
end
end
end
(I'll try to rework it to add only significant lines with alias_method or sth)
And then:
data = gmail.imap.fetch(uid, "(X-GM-THRID)")
thread_id = data[0].attr["X-GM-THRID"].to_s(16)
from ruby-gmail.
Thanks @wojt-eu , that patch worked!
from ruby-gmail.
Glad to hear, @alagu. I recall I have tried to make the patch smaller (so that it didn't repeat whole msg_att method) but failed. It works though, It's used in production.
from ruby-gmail.
Is there a pull request for this anywhere? If not, I'll try to get this in as soon as I can get a test written.
from ruby-gmail.
I didn't find a PR for this and I don't want to monkey patch IMAP so I am going to close this. If there is another way to do this without modifying internals then please open a new issue.
from ruby-gmail.
Related Issues (20)
- Special characters in the :gm search option
- Can't send, then receive on the same session.
- Reading a message marks the message as read
- How do I select an email given it's id?
- Uncaught exception: 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbuO6
- Open invitation: let's combine efforts at gmailgem/gmail
- How can I retrieve archived messages HOT 1
- No way to tell if I'm logged in
- Support for charset
- Gem is unusable, "Please log in via your web browser" HOT 7
- Google prevents signin HOT 1
- archive doesn't seem to work
- Collect email subject and body
- Sent emails
- Wrong format in to_imap_date method HOT 4
- How do I read the mail content? HOT 1
- How I can disable log message in stderr?
- <Net::IMAP::NoResponseError: Please log in via your web browser
- Managing HOT 1
- Impact on "Insecure apps disable connection to G Suite accounts"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ruby-gmail.