[ekg2-commit] ekg2: events.c (HEAD) plugins.c (HEAD) [peres]

CVS commit cvs w toxygen.net
Czw, 25 Paź 2007, 15:48:11 CEST


Module name:	ekg2
Changes by:	peres	2007-10-25 15:48:09

Modified files:
	events.c plugins.c

Log message:
Very simple user-fetchable events extension. Now user can connect an event
to any query supported by EKG2, but _without_ any param support.
For example:
/on -a sigusr1 1 * echo SIGUSR1

Index: events.c
===================================================================
RCS file: /home/cvs/ekg2/ekg/events.c,v
diff -d -u -r1.52 -r1.53
--- events.c	5 Jul 2007 19:46:53 -0000	1.52
+++ events.c	25 Oct 2007 13:48:08 -0000	1.53
@@ -71,7 +71,7 @@
                         return -1;
                 }
 
-		if (!(prio = atoi(params[2])) || !array_contains(events_all, params[1], 0)) {
+		if (!(prio = atoi(params[2])) /*|| (!array_contains(events_all, params[1], 0))*/) {
 			printq("invalid_params", name);
 			return -1;
 		}
@@ -308,7 +308,7 @@
 	int ev_max_prio = 0;
 	char **b, **c;
 
-	debug("// event_find_all (session %s) (name (%s), target (%s)\n", session, name, target);
+//	debug("// event_find_all (session %s) (name (%s), target (%s)\n", session, name, target);
 	b = array_make(target, ("|,;"), 0, 1, 0);
 	c = array_make(name, ("|,;"), 0, 1, 0);
 	for (l = events; l; l = l->next) {

Index: plugins.c
===================================================================
RCS file: /home/cvs/ekg2/ekg/plugins.c,v
diff -d -u -r1.115 -r1.116
--- plugins.c	1 Sep 2007 12:49:39 -0000	1.115
+++ plugins.c	25 Oct 2007 13:48:08 -0000	1.116
@@ -35,6 +35,7 @@
 #include "commands.h"
 #include "debug.h"
 #include "dynstuff.h"
+#include "events.h"
 #include "objects.h"
 #include "plugins.h"
 #include "userlist.h"
@@ -904,6 +905,14 @@
 	}
 	va_end(ap);
 
+	{	/* TEMPORARY CODE
+		 * to be replaced when new event support will be ready */
+		const char *n	= query_name(id);
+
+		if (n && !array_contains(events_all, n, 0)) /* skip queries with old-style handlers */
+			event_check(NULL, n, "*", NULL);
+	}
+
 	return result;
 }
 
@@ -927,6 +936,13 @@
 	}
 	va_end(ap);
 
+	{	/* TEMPORARY CODE
+		 * to be replaced when new event support will be ready */
+
+		if (!array_contains(events_all, name, 0)) /* skip queries with old-style handlers */
+			event_check(NULL, name, "*", NULL);
+	}
+
 	return result;
 }
 


Więcej informacji o liście dyskusyjnej ekg2-commit