Saturday, November 6, 2010

How to download and backup your GTalk/GMail chat logs

Mostly taken from: http://martinml.com/en/how-to-download-and-backup-your-gtalk-gmail-chat-logs/ but includes my developed script

Why?

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.

Invalid solutions

  • 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.

The solution

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:

Uploaded by CandorZ

So the result would be as follows:
 
Uploaded by CandorZ

Now Select All the Search Results and Apply a new Label as shown, mine is LOGS:
 
Uploaded by CandorZ

Your Result should be something like below:
Uploaded by CandorZ

Now Go to Settings -> Offline

Uploaded by CandorZ
  
Enable Offline and Expand Download Options:


Uploaded by CandorZ

Select Options as you may please (I'd advice only to select LOGS)

Uploaded by CandorZ

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)

Uploaded by CandorZ

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")

Uploaded by CandorZ
Now Run the sql4.vbs, just double click it!!! A subfolder "msgs" would be created which will contain all your LOGS. Enjoy!!!

Uploaded by CandorZ