ekiga r7237 - in trunk: lib/engine/presence/avahi lib/engine/presence/skel src/endpoints



Author: jpuydt
Date: Thu Oct 16 13:44:31 2008
New Revision: 7237
URL: http://svn.gnome.org/viewvc/ekiga?rev=7237&view=rev

Log:
Use gmref_ptr for the presence fetchers too

Modified:
   trunk/lib/engine/presence/avahi/avahi-cluster.cpp
   trunk/lib/engine/presence/skel/presence-core.cpp
   trunk/lib/engine/presence/skel/presence-core.h
   trunk/src/endpoints/opal-main.cpp

Modified: trunk/lib/engine/presence/avahi/avahi-cluster.cpp
==============================================================================
--- trunk/lib/engine/presence/avahi/avahi-cluster.cpp	(original)
+++ trunk/lib/engine/presence/avahi/avahi-cluster.cpp	Thu Oct 16 13:44:31 2008
@@ -46,7 +46,7 @@
   add_heap (*heap);
 
   /* don't check the cast: it has been checked already by avahi-main!*/
-  presence_core->add_presence_fetcher (*heap);
+  presence_core->add_presence_fetcher (heap);
 }
 
 Avahi::Cluster::~Cluster ()

Modified: trunk/lib/engine/presence/skel/presence-core.cpp
==============================================================================
--- trunk/lib/engine/presence/skel/presence-core.cpp	(original)
+++ trunk/lib/engine/presence/skel/presence-core.cpp	Thu Oct 16 13:44:31 2008
@@ -161,25 +161,18 @@
 }
 
 void
-Ekiga::PresenceCore::add_presence_fetcher (PresenceFetcher &fetcher)
+Ekiga::PresenceCore::add_presence_fetcher (gmref_ptr<PresenceFetcher> fetcher)
 {
-  presence_fetchers.push_back (&fetcher);
-  fetcher.presence_received.connect (sigc::mem_fun (this,
-						    &Ekiga::PresenceCore::on_presence_received));
-  fetcher.status_received.connect (sigc::mem_fun (this,
-						  &Ekiga::PresenceCore::on_status_received));
+  presence_fetchers.push_back (fetcher);
+  fetcher->presence_received.connect (sigc::mem_fun (this,
+						     &Ekiga::PresenceCore::on_presence_received));
+  fetcher->status_received.connect (sigc::mem_fun (this,
+						   &Ekiga::PresenceCore::on_status_received));
   for (std::map<std::string, uri_info>::const_iterator iter
 	 = uri_infos.begin ();
        iter != uri_infos.end ();
        ++iter)
-    fetcher.fetch (iter->first);
-}
-
-void
-Ekiga::PresenceCore::remove_presence_fetcher (PresenceFetcher& fetcher)
-{
-  presence_fetchers.remove (&fetcher);
-  // FIXME: unconnect the signals!
+    fetcher->fetch (iter->first);
 }
 
 void
@@ -189,10 +182,10 @@
 
   if (uri_infos[uri].count == 1) {
 
-    for (std::list<PresenceFetcher*>::iterator iter
+    for (std::list<gmref_ptr<PresenceFetcher> >::iterator iter
 	   = presence_fetchers.begin ();
 	 iter != presence_fetchers.end ();
-	 iter++)
+	 ++iter)
       (*iter)->fetch (uri);
   }
 
@@ -208,10 +201,10 @@
 
     uri_infos.erase (uri_infos.find (uri));
 
-    for (std::list<PresenceFetcher*>::iterator iter
+    for (std::list<gmref_ptr<PresenceFetcher> >::iterator iter
 	   = presence_fetchers.begin ();
 	 iter != presence_fetchers.end ();
-	 iter++)
+	 ++iter)
       (*iter)->unfetch (uri);
   }
 }

Modified: trunk/lib/engine/presence/skel/presence-core.h
==============================================================================
--- trunk/lib/engine/presence/skel/presence-core.h	(original)
+++ trunk/lib/engine/presence/skel/presence-core.h	Thu Oct 16 13:44:31 2008
@@ -52,7 +52,7 @@
  */
 
 
-  class PresentityDecorator: public GmRefCounted
+  class PresentityDecorator: public virtual GmRefCounted
   {
   public:
 
@@ -70,7 +70,7 @@
 				MenuBuilder &/*builder*/) = 0;
   };
 
-  class PresenceFetcher
+  class PresenceFetcher: public virtual GmRefCounted
   {
   public:
 
@@ -239,12 +239,7 @@
     /** Adds a fetcher to the pool of presentce fetchers.
      * @param The presence fetcher.
      */
-    void add_presence_fetcher (PresenceFetcher &fetcher);
-
-    /** Removes a fetcher from the pool of presentce fetchers.
-     * @param The presence fetcher.
-     */
-    void remove_presence_fetcher (PresenceFetcher &fetcher);
+    void add_presence_fetcher (gmref_ptr<PresenceFetcher> fetcher);
 
     /** Tells the PresenceCore that someone is interested in presence
      * information for the given uri.
@@ -266,7 +261,7 @@
 
   private:
 
-    std::list<PresenceFetcher*> presence_fetchers;
+    std::list<gmref_ptr<PresenceFetcher> > presence_fetchers;
     void on_presence_received (const std::string uri,
 			       const std::string presence);
     void on_status_received (const std::string uri,

Modified: trunk/src/endpoints/opal-main.cpp
==============================================================================
--- trunk/src/endpoints/opal-main.cpp	(original)
+++ trunk/src/endpoints/opal-main.cpp	Thu Oct 16 13:44:31 2008
@@ -141,7 +141,7 @@
 
 #ifdef HAVE_SIP
     presence_core->add_presentity_decorator (sip_manager);
-    presence_core->add_presence_fetcher (*sip_manager);
+    presence_core->add_presence_fetcher (sip_manager);
     presence_core->add_presence_publisher (*sip_manager);
 #endif
 #ifdef HAVE_H323



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]