[vlc-commits] npapi: allow a Event Listener to subscribe to more than one event type

Sergey Radionov git at videolan.org
Sat Dec 24 14:40:05 CET 2011


npapi-vlc | branch: master | Sergey Radionov <RSATom at gmail.com> | Sat Dec 24 14:12:43 2011 +0700| [b9ad7cbdaddcc185e2bf9fa73b69b928aeb482a8] | committer: Jean-Baptiste Kempf

npapi: allow a Event Listener to subscribe to more than one event type

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=b9ad7cbdaddcc185e2bf9fa73b69b928aeb482a8
---

 npapi/vlcplugin_base.cpp |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/npapi/vlcplugin_base.cpp b/npapi/vlcplugin_base.cpp
index d4ed630..fbdff1f 100644
--- a/npapi/vlcplugin_base.cpp
+++ b/npapi/vlcplugin_base.cpp
@@ -279,18 +279,17 @@ bool EventObj::insert(const NPString &name, NPObject *listener, bool bubble)
     if( !event )
         return false;
 
-    lr_l::iterator iter;
-    for( iter = _llist.begin(); iter != _llist.end(); ++iter )
-        if( iter->listener() == listener && iter->bubble() == bubble )
-            break;
-
-    if( iter == _llist.end() )
-    {
-        _llist.push_back(Listener(event, listener, bubble));
-        return true;
+    for(lr_l::iterator iter = _llist.begin(); iter != _llist.end(); ++iter ){
+        if(iter->listener() == listener &&
+           event->libvlc_type == iter->event_type() &&
+           iter->bubble() == bubble)
+        {
+            return false;
+        }
     }
 
-    return false;
+    _llist.push_back(Listener(event, listener, bubble));
+    return true;
 }
 
 bool EventObj::remove(const NPString &name, NPObject *listener, bool bubble)



More information about the vlc-commits mailing list