
andrew at morphoss
Apr 3, 2012, 4:29 PM
Post #2 of 4
(195 views)
Permalink
|
On Tue, 2012-04-03 at 16:57 -0400, skeezix wrote: > Hey everyone, > > I'm looking for a method by which changes made to a calendar may > have notifications emailed to someone; not event reminders or testing > for reads or syncs, but actual changes against events. > > I'm fairly certain something doesn't exist already, but if so.. > awesome :) Specifically, I'm thinking that should I (for example) make a > change on my phone that syncs up to my davical instance, it'd be great for > my wife to get an email to remind her to check the Agendav web based > version at her leisure, for instance. Including content of change might be > nice, but really I'm just looking to send 'A change has been made' hints > to interested parties. If kid checks in a change to calendar, we may need > to go look :) Hi Jeff, Something does not exist yet, but there is a system-wide hook in place to catch the event of "something changed to some calendar" which could be used to trigger an action. > In the event something doesn't yet exist, I'd like to make a quick > hack for the short term as I'm not in a position to help build a more > general solution right now.. > > If someone knows a query against the DB that emits something along > the lines of a yes/no, or count of the number of changes in the last 24 > hours (say), that'd do the trick. I'm quite busy of late so not had time > to go digging through the DB schema or the like :( > > I was thinking of something rudimentary along the lines of this > pseudo-query: > > Select count(*) from ... > > where change_date > sysdate - 1day > > OR insert_date > sysdate - 1day > > If we can get the text of the entry as well, groovy. > > I'll just wrap it up in a brief python script and my needs are > covered :) > > But if there's a better way, please let me know :) > > (I suppose I could try to add a trigger somewhere, but I'm sure > it'd be grossly unnecessary.) The way DAViCal allows for this (and other actions happening on event create / update / delete) is to allow a hook for logging the action. The function must be called 'log_caldav_action' and needs to take a few parameters, as described in the wiki here: http://wiki.davical.org/w/Configuration/hooks/log_caldav_action You could just define that function in your config.php (if it's *real* simple) or include a file defining it (probably a better approach). There's an example of one such on that wiki page. The reason this is "log" caldav action is because your function should do it's job as quickly and safely as possible. If it screws up then you will get error messages and screw up the response to the client, etc, etc. Once it has written it's log (or logged to a database table, if that's what you prefer) then I usually run a process via 'incron' that notices that the file has changed, move the file somewhere and process it, etc, etc, to do the more complicated stuff. If you only wanted to see the notifications every so often (e.g. daily) then a normal cron job would obviously work better. Cheers, Andrew. -- ------------------------------------------------------------------------ andrew (AT) morphoss (DOT) com +64(272)DEBIAN Life is too short to be taken seriously. -- Oscar Wilde ------------------------------------------------------------------------
|