[225] in BarnOwl Developers

home help back first fref pref prev next nref lref last post

[D-O-H] r403 - trunk/owl

daemon@ATHENA.MIT.EDU (asedeno@darkmatter.mit.edu)
Thu Oct 29 18:03:53 2009

Resent-From: nelhage@mit.edu
Resent-To: barnowl-dev-mtg@charon.mit.edu
To: dirty-owl-hackers@mit.edu
From: asedeno@darkmatter.mit.edu
Reply-to: dirty-owl-hackers@MIT.EDU
Date: Wed, 25 Oct 2006 02:44:25 -0400 (EDT)

Author: asedeno
Date: 2006-10-25 02:44:24 -0400 (Wed, 25 Oct 2006)
New Revision: 403

Modified:
   trunk/owl/owl.c
   trunk/owl/variable.c
Log:
Hooking perl into owl's main loop.



Modified: trunk/owl/owl.c
===================================================================
--- trunk/owl/owl.c	2006-10-24 18:53:51 UTC (rev 402)
+++ trunk/owl/owl.c	2006-10-25 06:44:24 UTC (rev 403)
@@ -71,7 +71,7 @@
   int j, ret, initialsubs, debug, argcsave, followlast;
   int newmsgs, zpendcount, nexttimediff;
   struct sigaction sigact;
-  char *configfile, *tty, *perlout, *perlerr, **argvsave, buff[LINE], startupmsg[LINE];
+  char *configfile, *tty, *perlout, *perlerr, **argvsave, buff[LINE], startupmsg[LINE], *perl_mainloop_hook;
   owl_filter *f;
   owl_style *s;
   time_t nexttime, now;
@@ -91,6 +91,7 @@
   tty=NULL;
   debug=0;
   initialsubs=1;
+  perl_mainloop_hook = NULL;
   if (argc>0) {
     argv++;
     argc--;
@@ -445,6 +446,16 @@
       }
     }
 
+    /* Hook perl into the loop */
+    perl_mainloop_hook = owl_global_get_perl_mainloop_hook(&g);
+    if (perl_mainloop_hook) {
+      if (owl_perlconfig_is_function(perl_mainloop_hook)) {
+	owl_function_debugmsg("startup: executing perl mainloop hook");
+	perlout = owl_perlconfig_execute(perl_mainloop_hook);
+	if (perlout) owl_free(perlout);
+      }
+    }
+
     /* little hack */
     now=time(NULL);
     today=localtime(&now);

Modified: trunk/owl/variable.c
===================================================================
--- trunk/owl/variable.c	2006-10-24 18:53:51 UTC (rev 402)
+++ trunk/owl/variable.c	2006-10-25 06:44:24 UTC (rev 403)
@@ -355,6 +355,11 @@
 	       "Note that this is currently risky as you might accidentally\n"
 	       "delete a message right as it came in.\n" ),
 
+  OWLVAR_STRING( "perl_mainloop_hook" /* %OwlVarStub */, NULL,
+		 "mainloop hook to perl",
+		 "If this variable is set, owl will call to the perl function\n"
+		 "specified." ),
+  
   /* This MUST be last... */
   { NULL, 0, NULL, 0, NULL, NULL, NULL, NULL,
     NULL, NULL, NULL, NULL, NULL, NULL }


home help back first fref pref prev next nref lref last post