[kronolith] SMS reminder for kronolith

Yedidia Klein yedidia at jct.ac.il
Sun Jul 6 01:52:09 PDT 2003


Hello,

I had started to write a daemon that will send SMS to remind kronolith 
events.
I'm assuming that there is a local sendsms command (my provider has an 
email gw - so it's easy to write)
it's easy to find in DB the starting time and the alarm delay.

I have two open issues:
a) how to find user cell number
        1) get it from turba (I don't like it cause normally a user 
isn't putting his data in turba and there is no username info in turba)
        2) add another kronolith pref in horde_pref table. - need 
apropriate place in kronolith config page.
b) how to make the SMS queue ? an option that I was thinking about was 
to check every 5 minutes (for example) the alarm that will happen in the 
coming 5 minutes and set UNIX "at" that will send the SMSes.. (this 
won't work for MS users - but this can be a feature :))
in this way if someone will put an alarm that should alarm in less that 
5 minutes there won't be any SMS...

what do you think ?

I'm attaching my perl script (that does nothing except showing name, 
meeting info and alarm time...) if someone is interested..

p.s. I saw on archives that someone already thought about it a year ago, 
did someone get to it ? maybe there is already a tool for this ?

thanks,

--Yedidia
-------------- next part --------------
#!/usr/bin/perl
use DBI;
use DBI::DBD;
use HTTP::Date;
use Time::Zone;

# Script init
$driver="mysql";
$dbname="horde";
$dbuser="horde";
$dbhost="localhost";
$dbpass="XXXXX";   # <-------- CHANGE THIS
$offset=tz_local_offset();

# DB init
$dsn = "DBI:$driver:database=$dbname;host=$dbhost;port=3361";
$dbh = DBI->connect($dsn,$dbuser,$dbpass);

$sql="select calendar_id,event_description,event_title,event_location,event_start,event_end,event_alarm from kronolith_events where event_alarm <> 0";

# run the SQL on DB
$sth = $dbh->prepare($sql) or die "could prepare the query";
$rc = $sth->execute or die "couldnt execute the query";

while ( @row = $sth->fetchrow_array ) {
           print "$row[0] is Meeting about $row[2] at $row[4]";
           $seconds=str2time(@row[4]);
	   $raw_alarm=$seconds-(@row[6]*60)+$offset;
	   $alarm=time2str($raw_alarm);
	   $alarm =~ s/GMT//g;
	   print " alarm at $alarm\n";
	   @alarm_array=gmtime($raw_alarm);
	   print "@alarm_array\n";
       }



More information about the kronolith mailing list