]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Thu, 15 Dec 2005 20:20:57 +0000 (20:20 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Thu, 15 Dec 2005 20:20:57 +0000 (20:20 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@158 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/include/switch_event.h
src/mod/mod_event_test/mod_event_test.c
src/switch_event.c

index d19b47ca6f3e477bf30ab31b867559b547fdb9d4..587926b33a9e19f8a14daf3353ed34e2aefb7e6a 100644 (file)
@@ -60,6 +60,8 @@ struct switch_event_node {
        struct switch_event_node *next;
 };
 
+#define SWITCH_EVENT_SUBCLASS_ANY NULL
+
 SWITCH_DECLARE(switch_status) switch_event_shutdown(void);
 SWITCH_DECLARE(switch_status) switch_event_init(switch_memory_pool *pool);
 SWITCH_DECLARE(switch_status) switch_event_fire_subclass(switch_event_t event, char *subclass_name, char *data);
index 613e4511459a4b15f52825c6fc31e29f0f2e68ac..63d20ae66b9d5cfe2c01a32bf1ece2c127ebeb84 100644 (file)
@@ -61,7 +61,11 @@ SWITCH_MOD_DECLARE(switch_status) switch_module_load(switch_loadable_module_inte
                switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Couldn't register subclass!");
                return SWITCH_STATUS_GENERR;
        }
-       switch_event_bind((char *)modname, SWITCH_EVENT_ALL, NULL, event_handler, NULL);
+
+       if (switch_event_bind((char *)modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+               switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Couldn't bind!\n");
+               return SWITCH_STATUS_GENERR;
+       }
 
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_SUCCESS;
index 908f2c82487971ff80cc2967b7e67604d14de64e..4fc79b6a6dcfd053ea912bf2c93ffc48b8f5463c 100644 (file)
@@ -64,22 +64,25 @@ static int switch_events_match(switch_event *event, switch_event_node *node)
 
        
        if (node->event == SWITCH_EVENT_ALL) {
-               return 1;
+               match++;
+
+               if (!node->subclass) {
+                       return match;
+               }
        }
 
-       if (event->event == node->event) {
+       if (match || event->event == node->event) {
 
-               if (node->subclass) {
-                       match = (event->subclass && strstr(event->subclass->name, node->subclass->name));
-               } else if (event->subclass) {
+               if (event->subclass && node->subclass) {
+                       match = strstr(event->subclass->name, node->subclass->name) ? 1 : 0;
+               } else if (event->subclass && !node->subclass) {
+                       match = 1;
+               } else {
                        match = 0;
                }
-               
        }
 
-
        return match;
-
 }
 
 static void * SWITCH_THREAD_FUNC switch_event_thread(switch_thread *thread, void *obj)