[asterisk-commits] russell: branch russell/events r59247 -
/team/russell/events/main/event.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Mar 26 20:14:22 MST 2007
Author: russell
Date: Mon Mar 26 22:14:22 2007
New Revision: 59247
URL: http://svn.digium.com/view/asterisk?view=rev&rev=59247
Log:
Actually observe the event criteria given by subscribers so that they only get
events that match what they ask for.
Modified:
team/russell/events/main/event.c
Modified: team/russell/events/main/event.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/main/event.c?view=diff&rev=59247&r1=59246&r2=59247
==============================================================================
--- team/russell/events/main/event.c (original)
+++ team/russell/events/main/event.c Mon Mar 26 22:14:22 2007
@@ -718,9 +718,27 @@
/* Subscribers to this specific event first */
AST_RWLIST_RDLOCK(&ast_event_subs[host_event_type]);
- /* XXX Check subscription parameters! */
- AST_RWLIST_TRAVERSE(&ast_event_subs[host_event_type], sub, entry)
+ AST_RWLIST_TRAVERSE(&ast_event_subs[host_event_type], sub, entry) {
+ struct ast_event_ie_val *ie_val;
+ AST_LIST_TRAVERSE(&sub->ie_vals, ie_val, entry) {
+ if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_EXISTS &&
+ ast_event_get_ie_raw(event_ref->event, ie_val->ie_type)) {
+ continue;
+ } else if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_UINT &&
+ ast_event_get_ie_uint(event_ref->event, ie_val->ie_type)
+ == ie_val->payload.uint) {
+ continue;
+ } else if (ie_val->ie_pltype == AST_EVENT_IE_PLTYPE_STR &&
+ !strcmp(ast_event_get_ie_str(event_ref->event, ie_val->ie_type),
+ ie_val->payload.str)) {
+ continue;
+ }
+ break;
+ }
+ if (ie_val)
+ continue;
sub->cb(event_ref->event);
+ }
AST_RWLIST_UNLOCK(&ast_event_subs[host_event_type]);
/* Now to subscribers to all event types */
More information about the asterisk-commits
mailing list