21st Birthday in 436 days
Sun September 12, 2010
Sun September 12, 2010
Turning 40 in 7376 days
Wed September 12, 2029
Wed September 12, 2029
I developed a simple chat logging database from the Pidgin html log parser.
It's one of those things I put in mgccl's google codes repository.
I call it pidginlog for now.
While it is called chat log, it is intended to log IM's instead of IRC or group chat logs.
You can find the download here, or check the SVN.
If you don't get how to use it, read the code, logic should be pretty clear. This requires you to run pidgin and a PHP server on the same machine.
You also have to use cron job or other kind of schedule service to run the script once in a while to make this thing actually useful.
If you don't understand the code or have no idea of what I just talked about, chose a user friendly alternative like IM-history, Dexrex or Web Pidgin.
In the future I will make a web front end to this program...or not. phpmyadmin is powerful enough for a front end.
I wish to put my chat logs in a database, then I can do a lot of fun operation on it. I wrote this php script so read Pidgin's html logs. I will write something separate to put it in a database.
I use html instead of text log so there is no ambiguous expressions (for example, someone copied a chat log and sent to you), and provided all information(which nickname is the user? one that's colored blue.).
To achieve what I really want, it's much better to wrote a plugin for Pidgin. I heard there was a Remote Logging plugin(which is exactly what I needed) but never saw anything come out from it. I hope there is someone who want to revive the project.
Some notes:
1. Pidgin can change the format anytime and render this not usable.
2. This is only useful in 1 on 1 IM's. in conversations, it can only record if you said something vs someone else said something.
3. the log will not be parsed if it's not complete(which means it didn't end in html end tag)
//this script reads a pidgin log html file. //Configuration!!!! //Logs to check //The directory to the log file, without the last slash $f = 'C:\Documents and Settings\UserXP\Application Data\.purple\logs'; //$s is an array of service name //$u is an array of usernames $s[] = 'aim'; $u[] = 'mgcclx'; //use html or not $html = 1; //if use html, which html tags are allowed $html_allow = '<br/><span><font><p><a>'; //Write your own logging function //For every message, it call this function once function logging_function($service,$user,$other,$user_or_other,$time,$speaker,$content){ return true; } for($i=count($s)-1;$i>-1;$i--){ $o = scandir($f.'/'.$s[$i].'/'.$u[$i]); for($j=count($o)-1;$j>1;$j--){ $d[$j] = $f.'/'.$s[$i].'/'.$u[$i].'/'.$o[$j].'/'; $files = file_list($d[$j],'html'); for($k=0;$k<count($files);$k++){ $log = parse_log($d[$j].$files[$k],$html,$html_allow); if($log===FALSE){ continue; } for($l=0;$l<count($log);$l++){ logging_function($s[$i],$u[$i],$o[$j],$log[$l][0],$log[$l][1],$log[$l][2],$log[$l][3]); } } } } function parse_log($file_name,$html=0,$html_allow = '<br/><span><font><p><a>'){ $line = file($file_name); $c = count($line); if(rtrim($line[$c-1])!='</body></html>'){ return FALSE; } preg_match("@Conversation with (.*?) at (.*?) (.*?) on (.*?) \((.*?)\)@u", $line[0], $match); $date=$match[2]; $prev = 'AM'; for($i=1;$i<$c;$i++){ if(preg_match('@<font color="#(.*?)"><font size="2">\((.*?)\)</font> <b>(.*?):</b></font> (.*)<br/>@u', $line[$i], $match)==1){ if($match[1]=="16569E"){ $match[1]=1; }else{ $match[1]=0; } if(substr($match[2],-2)=='AM'&&$prev=='PM'){ $t = explode('/',$date); $date = gmdate("n/j/Y", gmmktime(0,0,0,$t[0],$t[1],$t[2])+86401); } $prev = substr($match[2],-2); $match[2] = $date.' '.$match[2]; if(strpos($match[3],' <AUTO-REPLY>')!== FALSE){ $match[3] = str_replace(' <AUTO-REPLY>','',$match[3]); $match[4] = '<AUTO-REPLY> '.$match[4]; } if($html){ $match[4] = strip_tags($match[4],'<br/><span><font><p><a>'); }else{ $match[4] = str_replace('<br/>',"\n",$match[4]); $match[4] = strip_tags($match[4]); } $log[] = array($match[1],$match[2],$match[3],$match[4]); } } return $log; } //this function found on http://us3.php.net/manual/en/function.scandir.php //by phpdotnet at lavavortex dot com function file_list($d,$x){ foreach(array_diff(scandir($d),array('.','..')) as $f)if(is_file($d.'/'.$f)&&(($x)?ereg($x.'$',$f):1))$l[]=$f; return $l; }
I saw this joke.
Boss to Secretary: I want to go to Beijing for a few days. Come with me.
secretary to husband: I have to go to Beijing with the boss.
husband to mistress: my wife won't be at home for a few days.
mistress to student: I won't be teaching you for a few days.
student to grandpa(boss): I don't have classes for a few days, let's have a fishing trip.
so, now, as you can see, the reverse happens, where boss->secretary->husband->mistress->student change their plans...
How can this problem be resolved?
Maybe one of them had enough with this and chose to do one thing anyway.
Maybe one of them become scientific and start investigate.
I don't know...
Edit: Helie offered a solution!
Obviously, the solution is to go fishing IN BEIJING
I saw this "Everyday I do" page, it's a list of dates and what the blog owner did on that day. It's like a dairy, but minimal amount of words to present all the information one need to know.
Nice. A list of things one did everyday... I need that so I can analyze and program my future according to my previous actions.
I should do something like that, posting stuff like that on Google Calendar. So it record all the things I did that I think useful to record.
Yep, it's like what twitter is intended to do. but easier to use for this purpose.
Google can export things into iCalendar.
and iCalendar have a core module that support journal entries, which I found amazing for record what one does everyday.
Of course someone can write a program that convert twitter twits and put in the Google Calendar... but I can't be bothered to search for it.
Here is the "things I did" page.
Recent comments
2 min 3 sec ago
1 day 2 hours ago
1 day 8 hours ago
1 day 9 hours ago
2 days 6 hours ago
3 days 9 hours ago
3 days 17 hours ago
1 week 12 hours ago
1 week 13 hours ago
1 week 1 day ago