Mostly taken from: http://martinml.com/en/how-to-download-and-backup-your-gtalk-gmail-chat-logs/ but includes my developed script
I use GTalk a lot. I have stored thousands and thousands of conversations for about 5 years. And it's all there, in GMail, without being able to backup it locally, unlike normal e-mails.
Why would I want to backup my chats? Because I don't want to lose them, and because GMail is awfully slow when having more than a particular number of e-mails, and I think that includes chats. Also they show up in every search when I try to find an e-mail in particular.
- Labeling the chats and downloading them via IMAP: it looks like it worked (by accident?) in the early times of IMAP in GMail. Doesn't work anymore.
- Forwarding the chats to yourself: you have to do this one by one. It's not a very good method.
- Creationg a rule that forward the chats to yourself: it doesn't work with already existent chats, and I'm not sure it'd work with the new ones.
- Using a script to parse the Gmail website: if you have thousands and thousands of chats, like me, you will get blocked from your own account in a few hours. And it is a violation of the TOS, so you could lose your account permanently.
There is a function called Offline Gmail which allows to use Google Gears to download your e-mail to your browser so you can use while offline or when your connection is not reliable. For that Go to Google Gears and check your installation status, if it says Installed, proceed below. If not, install it and restart your browser. Google Chrome has it installed by default.
Now, You can choose to let Gmail decide which e-mails download, or you can specify a label. But... What if we marked our chats with a label...
So first search within All Mail as follows:
So the result would be as follows:
Now Select All the Search Results and Apply a new Label as shown, mine is LOGS:
Your Result should be something like below:
Now Go to Settings -> Offline
Enable Offline and Expand Download Options:
Select Options as you may please (I'd advice only to select LOGS)
Click "Save Changes". It would show you some progress as below:
After finishing you will have to locate the offline file. The browser I used was Chrome and the path you can see below, mine was: D:\Documents and Settings\USER\Local Settings\Application Data\Google\Chrome\User Data\Default\Plugin Data\Google Gears\mail.google.com\http_80. Highlighted is the file (It's size would be large as compared to the others)
Copy the Database to the location/folder where you have the two files, namely extract.exe and sql4.vbs. You can get the files from here 1 & 2. Rename your database to candorz (It will show you an error otherwise "File Not Found")
sql4.vbs, just double click it!!! A subfolder "msgs" would be created which will contain all your LOGS. Enjoy!!!