
GMail Offline Database. Export
Hello, Habrasociety!
For a long time I wanted to get the jabber story from GMail (in principle it’s quite convenient, but I want to use it without additional barriers)
When I caught sight of the topic Downloading the message history from GTalk to my computer , I was glad, but having seen the cumbersomeness and efforts made for extraction, I decided that the game is not worth the candle.
Therefore, I decided to go the other way, and figure out Google Gears \ GMail Offline.
First of all, we need to Deliver Gears
We log in to GMail, go to chats and mark the necessary chat sessions with a shortcut (for example export ).
Next, go to Gmail Offline Settings , select Enable Gmail Offline for this computer , click on the Change shortcut settings link and put Everything opposite the export label (all the others can be set to No so as not to download too much.
Next, save the changes and wait for Gears to synchronize the necessary chains with a localhost.
Walking through the Firefox directories, I found the Google Gears repository.
The bottom line is that letters and chats are in the file
% username% @ % servername% -GoogleMail @ % servername% #database
where % servername% - usually gmail.com, but for Google services for a domain - it will be your domain, respectively.
Note: a file can be called and ... # database [1] and [2] or without [number] at all, so if there are no chats in one file, then you will need to try with all (except those whose name has -b , -t , -u , this is some kind of service information, we are not interested in it)
The database file itself is located in % GearsDatabaseDir%/mail.google.com/http_80
where _80 can also be _443 if SSL is used, and % GearsDatabaseDir% for your platform can be found here.
As it turned out, the database is in SQLite format. Further it is easier. sqlite3 downloaded from offsite helps us get to the very core of GMail Offline.
First, check if there are messages for the shortcut we need: Receive: So, there are messages, you can start exporting. Create a header () and a “footer” () of the future HTML chat file, and run: (+3 hours replace with your time zone) Now all you have to do is “merge” the files into one. Under Windows: (if you do not install / B, then under winxp there remains some kind of dumb character. Copy puts it for some reason) Bash: That’s briefly all. You can also use html2text, which, given the amount of design (CSS has not been used!) - At least rationally. _________ Thank you for invite Dreadatour
For a long time I wanted to get the jabber story from GMail (in principle it’s quite convenient, but I want to use it without additional barriers)
When I caught sight of the topic Downloading the message history from GTalk to my computer , I was glad, but having seen the cumbersomeness and efforts made for extraction, I decided that the game is not worth the candle.
Therefore, I decided to go the other way, and figure out Google Gears \ GMail Offline.
Training
First of all, we need to Deliver Gears
We log in to GMail, go to chats and mark the necessary chat sessions with a shortcut (for example export ).
Next, go to Gmail Offline Settings , select Enable Gmail Offline for this computer , click on the Change shortcut settings link and put Everything opposite the export label (all the others can be set to No so as not to download too much.
Next, save the changes and wait for Gears to synchronize the necessary chains with a localhost.
Base
Walking through the Firefox directories, I found the Google Gears repository.
The bottom line is that letters and chats are in the file
% username% @ % servername% -GoogleMail @ % servername% #database
where % servername% - usually gmail.com, but for Google services for a domain - it will be your domain, respectively.
Note: a file can be called and ... # database [1] and [2] or without [number] at all, so if there are no chats in one file, then you will need to try with all (except those whose name has -b , -t , -u , this is some kind of service information, we are not interested in it)
The database file itself is located in % GearsDatabaseDir%/mail.google.com/http_80
where _80 can also be _443 if SSL is used, and % GearsDatabaseDir% for your platform can be found here.
As it turned out, the database is in SQLite format. Further it is easier. sqlite3 downloaded from offsite helps us get to the very core of GMail Offline.
Pull out
First, check if there are messages for the shortcut we need: Receive: So, there are messages, you can start exporting. Create a header () and a “footer” () of the future HTML chat file, and run: (+3 hours replace with your time zone) Now all you have to do is “merge” the files into one. Under Windows: (if you do not install / B, then under winxp there remains some kind of dumb character. Copy puts it for some reason) Bash: That’s briefly all. You can also use html2text, which, given the amount of design (CSS has not been used!) - At least rationally. _________ Thank you for invite Dreadatour
sqlite3 -line "user@gmail.com-GoogleMail@gmail.com#database" "SELECT l.`Label` as `label`,COUNT(*) as messages FROM `Labels` l, Messages m, MessageLabels ml WHERE ml.`LabelId`=l.`LabelId` AND m.`rowid`=ml.`MessageId` AND l.`Label`='export'"
label = export
messages = 662
sqlite3 -list -separator '\n\n' "user@gmail.com-GoogleMail@gmail.com#database" "SELECT ''|| datetime(m.`datems`/1000,'unixepoch','+3 hours') || '
' || c.`c1Body` || '
' FROM MessagesFT_content c, Messages m, MessageLabels ml, Labels l WHERE ml.`LabelId`=l.`labelId` AND c.`rowid`=ml.`MessageId` AND m.`MessageId`=c.`rowid` AND l.`Label`='export' ORDER BY m.`datems` ASC" > body.html
copy /B header.tpl + body.html + footer.tpl history_export.html
cat header.tpl >> history_export.html
cat body.html>> history_export.html
cat footer.tpl >> history_export.html