Joachim Breitner

graphing your gaim chat history

Published 2006-11-08 in sections English, Digital World.

I’m a fan of statistics, so I created a small perl script that reads your gaim message history and, for the top 10 contacts, creates graphs: One for the total bytes chatted, one for the bytes chatted on each day, and two with weighted averages, over one week and one month timespan. You need the perl modules in libgd-graph-perl and libxml-xpath-perl, and my script. Run it and it will output the four png’s in the current directory.

I don’t have examples, as the output is far too private to put up here, and I’m too lazy to create interesting test data. There is a lot you can discover in these graphs: When you got to know someone (or when he started IMing), when you were not good terms with someone etc.


Tried this out; it seems to give lots of 'could not parse line' errors, then end saying that it has no data sets/points.

I'm using gaim 1.5.
#1 Neil am 2006-11-08
Sounds like your file structure in ~/.gaim/logs looks different. Could you give me the output of

find ~/.gaim/logs -mindepth 2 -type f -printf %p_%s\\n

(or parts of it, with all private data replaced by dummy data)
#2 Joachim Breitner (Homepage) am 2006-11-08

I got this error when trying your script :

Illegal division by zero at /usr/share/perl5/GD/Graph/ line 2014.

I just installed the libgd-graph-perl and libxml-xpath-perl on a debian sid.
#3 Alexandre am 2006-11-08
I got them from there as well. But that sounds like a gd bug, if the data were wrong then gd should have complained about it…

Sorry that I can’t do much debugging from here with that one.
#4 Joachim Breitner (Homepage) am 2006-11-08
nice work, my complain is that the labels are too few, the most chatted contact is not on the viewable labels :)
#5 garaged am 2006-11-09
It takes the 10 contacts with the highest chat volumne. Maybe you only recently started to chat with that person?
#6 Joachim Breitner (Homepage) am 2006-11-09
cool hack.. i got better results with the regex below (less "could not parse" errors, and exclusion of system logs). (gaim version 1:2.0.0+beta4-4)


while (<INPUT>) {

m#^.*/([^/]+)/([^/]+)/(\d\d\d\d-\d\d-\d\d).*\.txt_(\d+)$# or do {print "Could not parse line $_"; next};

my ($me, $who, $date, $size) = ($1, $2, $3, $4);

next if ($who eq ".system");

$sums{$who} += $size;

$days{$date}{$who} += $size;

#7 matt (Homepage) am 2006-11-10
I corrected the regexp as follows:


or do {print "Could not parse line $_"; next};

my ($who,$date,$size) = ($1,$2,$3);
#8 sbi am 2006-11-23
Its a cool script. However my output only has one label on it so I can't tell who the other lines are. Any reason it would do this?
#9 john am 2006-11-28
Not really. But I changed a part of the code that might be involved, so please try again.
#10 Joachim Breitner (Homepage) am 2006-11-28
I keep getting this:

ERROR: Date::Manip unable to determine TimeZone.

at /usr/share/perl5/Date/ line 3636

Date::Manip::Date_TimeZone called at /usr/share/perl5/Date/ line 677

Date::Manip::Date_Init() called at /usr/share/perl5/Date/ line 1447

Date::Manip::ParseDate('today') called at line 106
#11 diego (Homepage) am 2006-12-03
Strange. What distribution? What Version of Date::Manip (libdate-manip-perl)? Maybe it can’t detect your own timezone: The problem seems to appear when trying to parse “today”...
#12 Joachim Breitner (Homepage) am 2006-12-03

Have something to say? You can post a comment by sending an e-Mail to me at <>, and I will include it here.