ekiga r7306 - in trunk: lib/engine/addressbook/call-history lib/engine/addressbook/evolution lib/engine/addressbook/kab lib/engine/addressbook/ldap lib/engine/presence/local-roster src/endpoints



Author: jpuydt
Date: Thu Oct 30 15:18:25 2008
New Revision: 7306
URL: http://svn.gnome.org/viewvc/ekiga?rev=7306&view=rev

Log:
Made all implementations of the contact core objects follow the new api

Modified:
   trunk/lib/engine/addressbook/call-history/history-book.cpp
   trunk/lib/engine/addressbook/call-history/history-contact.cpp
   trunk/lib/engine/addressbook/call-history/history-source.cpp
   trunk/lib/engine/addressbook/call-history/history-source.h
   trunk/lib/engine/addressbook/evolution/evolution-book.cpp
   trunk/lib/engine/addressbook/evolution/evolution-contact.cpp
   trunk/lib/engine/addressbook/evolution/evolution-source.cpp
   trunk/lib/engine/addressbook/kab/kab-book.cpp
   trunk/lib/engine/addressbook/kab/kab-contact.cpp
   trunk/lib/engine/addressbook/kab/kab-source.cpp
   trunk/lib/engine/addressbook/ldap/ldap-book.cpp
   trunk/lib/engine/addressbook/ldap/ldap-book.h
   trunk/lib/engine/addressbook/ldap/ldap-contact.cpp
   trunk/lib/engine/addressbook/ldap/ldap-source.cpp
   trunk/lib/engine/addressbook/ldap/ldap-source.h
   trunk/lib/engine/presence/local-roster/local-roster-bridge.cpp
   trunk/src/endpoints/h323-endpoint.cpp
   trunk/src/endpoints/h323-endpoint.h
   trunk/src/endpoints/sip-endpoint.cpp
   trunk/src/endpoints/sip-endpoint.h

Modified: trunk/lib/engine/addressbook/call-history/history-book.cpp
==============================================================================
--- trunk/lib/engine/addressbook/call-history/history-book.cpp	(original)
+++ trunk/lib/engine/addressbook/call-history/history-book.cpp	Thu Oct 30 15:18:25 2008
@@ -105,10 +105,7 @@
 void
 History::Book::add (xmlNodePtr node)
 {
-  Contact *contact = NULL;
-
-  contact = new Contact (core, node);
-  common_add (*contact);
+  add_contact (new Contact (core, node));
 }
 
 void
@@ -118,29 +115,22 @@
                     const std::string & call_duration,
 		    const call_type c_t)
 {
-  Contact *contact = NULL;
-  xmlNodePtr root = NULL;
 
   if ( !uri.empty ()) {
 
-    root = xmlDocGetRootElement (doc);
+    xmlNodePtr root = xmlDocGetRootElement (doc);
 
-    contact = new Contact (core, name, uri, call_start, call_duration, c_t);
+    gmref_ptr<Contact> contact = new Contact (core, name, uri,
+					      call_start, call_duration, c_t);
 
     xmlAddChild (root, contact->get_node ());
 
     save ();
 
-    common_add (*contact);
+    add_contact (contact);
   }
 }
 
-void
-History::Book::common_add (Contact &contact)
-{
-  add_contact (contact);
-}
-
 bool
 History::Book::populate_menu (Ekiga::MenuBuilder &builder)
 {
@@ -186,8 +176,7 @@
 {
   xmlNodePtr root = NULL;
 
-  while (begin () != end ())
-    remove_contact (*begin ());
+  remove_all_objects ();
 
   if (doc != NULL)
     xmlFreeDoc (doc);

Modified: trunk/lib/engine/addressbook/call-history/history-contact.cpp
==============================================================================
--- trunk/lib/engine/addressbook/call-history/history-contact.cpp	(original)
+++ trunk/lib/engine/addressbook/call-history/history-contact.cpp	Thu Oct 30 15:18:25 2008
@@ -169,7 +169,7 @@
 History::Contact::populate_menu (Ekiga::MenuBuilder &builder)
 {
   gmref_ptr<Ekiga::ContactCore> contact_core = core.get ("contact-core");
-  return contact_core->populate_contact_menu (*this, uri, builder);
+  return contact_core->populate_contact_menu (this, uri, builder);
 }
 
 xmlNodePtr

Modified: trunk/lib/engine/addressbook/call-history/history-source.cpp
==============================================================================
--- trunk/lib/engine/addressbook/call-history/history-source.cpp	(original)
+++ trunk/lib/engine/addressbook/call-history/history-source.cpp	Thu Oct 30 15:18:25 2008
@@ -41,7 +41,7 @@
 {
   book = new Book (core);
 
-  add_book (*book);
+  add_book (book);
 }
 
 History::Source::~Source ()
@@ -63,7 +63,7 @@
   return false;
 }
 
-History::Book*
+gmref_ptr<History::Book>
 History::Source::get_book () const
 {
   return book;

Modified: trunk/lib/engine/addressbook/call-history/history-source.h
==============================================================================
--- trunk/lib/engine/addressbook/call-history/history-source.h	(original)
+++ trunk/lib/engine/addressbook/call-history/history-source.h	Thu Oct 30 15:18:25 2008
@@ -70,12 +70,12 @@
 
     const std::set<std::string> existing_groups () const;
 
-    Book *get_book () const;
+    gmref_ptr<Book> get_book () const;
 
   private:
 
     Ekiga::ServiceCore &core;
-    Book *book;
+    gmref_ptr<Book> book;
 
   };
 

Modified: trunk/lib/engine/addressbook/evolution/evolution-book.cpp
==============================================================================
--- trunk/lib/engine/addressbook/evolution/evolution-book.cpp	(original)
+++ trunk/lib/engine/addressbook/evolution/evolution-book.cpp	Thu Oct 30 15:18:25 2008
@@ -66,9 +66,10 @@
 
     if (e_contact_get_const (econtact, E_CONTACT_FULL_NAME) != NULL) {
 
-      Evolution::Contact *contact =  new Evolution::Contact (services, book, econtact);
+      gmref_ptr<Contact> contact =  new Evolution::Contact (services, book,
+							    econtact);
 
-      add_contact (*contact);
+      add_contact (contact);
       nbr++;
     }
   }
@@ -96,7 +97,7 @@
     for (iterator iter = begin ();
 	 iter != end ();
 	 iter++)
-      if (iter->get_id () == (gchar *)ids->data) {
+      if ((*iter)->get_id () == (gchar *)ids->data) {
 
 	remove_contact (*iter);
 	break; // will do the loop on ids, but stop using iter which is invalid
@@ -124,9 +125,9 @@
 	 iter != end ();
 	 iter++)
 
-      if (iter->get_id()
+      if ((*iter)->get_id()
 	  == (const gchar *)e_contact_get_const (econtact, E_CONTACT_UID))
-	iter->update_econtact (econtact);
+	(*iter)->update_econtact (econtact);
   }
 }
 

Modified: trunk/lib/engine/addressbook/evolution/evolution-contact.cpp
==============================================================================
--- trunk/lib/engine/addressbook/evolution/evolution-contact.cpp	(original)
+++ trunk/lib/engine/addressbook/evolution/evolution-contact.cpp	Thu Oct 30 15:18:25 2008
@@ -218,7 +218,7 @@
       std::string attr_value = get_attribute_value (attr_type);
       if ( !attr_value.empty ()) {
 
-	if (core->populate_contact_menu (*this, attr_value, tmp_builder)) {
+	if (core->populate_contact_menu (this, attr_value, tmp_builder)) {
 
 	  builder.add_ghost ("", get_attribute_name_from_type (attr_type));
 	  tmp_builder.populate_menu (builder);

Modified: trunk/lib/engine/addressbook/evolution/evolution-source.cpp
==============================================================================
--- trunk/lib/engine/addressbook/evolution/evolution-source.cpp	(original)
+++ trunk/lib/engine/addressbook/evolution/evolution-source.cpp	Thu Oct 30 15:18:25 2008
@@ -57,16 +57,16 @@
 Evolution::Source::add_group (ESourceGroup *group)
 {
   GSList *sources = NULL;
-  ESource *source = NULL;
-  ESource *s = NULL;
-  gchar *uri = NULL;
-  EBook *ebook = NULL;
-  Evolution::Book *book = NULL;
 
   sources = e_source_group_peek_sources (group);
 
   for ( ; sources != NULL; sources = g_slist_next (sources)) {
 
+    ESource *source = NULL;
+    ESource *s = NULL;
+    gchar *uri = NULL;
+    EBook *ebook = NULL;
+
     source = E_SOURCE (sources->data);
 
     s = e_source_copy (source);
@@ -80,12 +80,11 @@
     ebook = e_book_new (s, NULL);
     g_object_unref (s);
 
-    book = new Evolution::Book (services, ebook);
+    gmref_ptr<Book> book = new Evolution::Book (services, ebook);
 
     g_object_unref (ebook);
 
-    add_book (*book);
-
+    add_book (book);
   }
 }
 
@@ -117,7 +116,7 @@
 	 iter != end ();
 	 iter++) {
 
-      book_ebook = iter->get_ebook ();
+      book_ebook = (*iter)->get_ebook ();
 
       book_source = e_book_get_source (book_ebook);
 
@@ -126,7 +125,7 @@
       if (book_group == group) {
 
 	found = TRUE;
-	iter->removed.emit ();
+	(*iter)->removed.emit ();
       }
     }
 

Modified: trunk/lib/engine/addressbook/kab/kab-book.cpp
==============================================================================
--- trunk/lib/engine/addressbook/kab/kab-book.cpp	(original)
+++ trunk/lib/engine/addressbook/kab/kab-book.cpp	Thu Oct 30 15:18:25 2008
@@ -45,7 +45,6 @@
 KAB::Book::Book (Ekiga::ContactCore &_core): core(_core)
 {
   KABC::AddressBook *kab = KABC::StdAddressBook::self ();
-  Contact *contact = NULL;
 
   kab->load (); // FIXME: turn async!
 
@@ -53,8 +52,7 @@
        iter != kab->end ();
        iter++) {
 
-    contact = new Contact (core, &(*iter));
-    add_contact (*contact);
+    add_contact (new Contact (core, &(*iter)));
   }
 }
 

Modified: trunk/lib/engine/addressbook/kab/kab-contact.cpp
==============================================================================
--- trunk/lib/engine/addressbook/kab/kab-contact.cpp	(original)
+++ trunk/lib/engine/addressbook/kab/kab-contact.cpp	Thu Oct 30 15:18:25 2008
@@ -83,7 +83,7 @@
        iter++) {
 
     std::string precision = (*iter).typeLabel ().toUtf8 ().constData ();
-    result = result || core.populate_contact_menu (*this,
+    result = result || core.populate_contact_menu (this,
 						   (*iter).number ().toUtf8 ().constData (), builder);
   }
 

Modified: trunk/lib/engine/addressbook/kab/kab-source.cpp
==============================================================================
--- trunk/lib/engine/addressbook/kab/kab-source.cpp	(original)
+++ trunk/lib/engine/addressbook/kab/kab-source.cpp	Thu Oct 30 15:18:25 2008
@@ -41,9 +41,7 @@
 
 KAB::Source::Source (Ekiga::ContactCore &_core): core(_core)
 {
-  KAB::Book *book = new KAB::Book (core);
-
-  add_book (*book);
+  add_book (new KAB::Book (core));
 }
 
 KAB::Source::~Source ()

Modified: trunk/lib/engine/addressbook/ldap/ldap-book.cpp
==============================================================================
--- trunk/lib/engine/addressbook/ldap/ldap-book.cpp	(original)
+++ trunk/lib/engine/addressbook/ldap/ldap-book.cpp	Thu Oct 30 15:18:25 2008
@@ -74,11 +74,10 @@
 }
 
 /* parses a message to construct a nice contact */
-OPENLDAP::Contact *
-OPENLDAP::Book::parse_result (
-	      LDAPMessage *message)
+gmref_ptr<OPENLDAP::Contact>
+OPENLDAP::Book::parse_result (LDAPMessage* message)
 {
-  OPENLDAP::Contact *result = NULL;
+  gmref_ptr<Contact> result;
   BerElement *ber = NULL;
   struct berval bv, *bvals;
   std::string username;
@@ -111,7 +110,7 @@
 
   if (!username.empty () && !call_addresses.empty()) {
 
-    result = new OPENLDAP::Contact (core, fix_to_utf8 (username), call_addresses);
+    result = new Contact (core, fix_to_utf8 (username), call_addresses);
   }
 
   return result;
@@ -841,7 +840,6 @@
   struct timeval timeout = { 1, 0}; /* block 1s */
   LDAPMessage *msg_entry = NULL;
   LDAPMessage *msg_result = NULL;
-  OPENLDAP::Contact *contact = NULL;
   gchar* c_status = NULL;
 
   result = ldap_result (ldap_context, LDAP_RES_ANY, LDAP_MSG_ALL,
@@ -889,9 +887,9 @@
 
     if (ldap_msgtype (msg_result) == LDAP_RES_SEARCH_ENTRY) {
 
-      contact = parse_result (msg_result);
-      if (contact != NULL) {
-	add_contact (*contact);
+      gmref_ptr<Contact> contact = parse_result (msg_result);
+      if (contact) {
+	add_contact (contact);
         nbr++;
       }
     }

Modified: trunk/lib/engine/addressbook/ldap/ldap-book.h
==============================================================================
--- trunk/lib/engine/addressbook/ldap/ldap-book.h	(original)
+++ trunk/lib/engine/addressbook/ldap/ldap-book.h	Thu Oct 30 15:18:25 2008
@@ -122,7 +122,7 @@
     void refresh_bound ();
     void refresh_result ();
 
-    OPENLDAP::Contact *parse_result(struct ldapmsg *);
+    gmref_ptr<Contact> parse_result(struct ldapmsg *);
 
     void parse_uri();
 

Modified: trunk/lib/engine/addressbook/ldap/ldap-contact.cpp
==============================================================================
--- trunk/lib/engine/addressbook/ldap/ldap-contact.cpp	(original)
+++ trunk/lib/engine/addressbook/ldap/ldap-contact.cpp	Thu Oct 30 15:18:25 2008
@@ -80,7 +80,7 @@
     = uris.begin ();
     iter != uris.end ();
     iter++) {
-      if (contact_core->populate_contact_menu (*this, iter->second, tmp_builder)) {
+      if (contact_core->populate_contact_menu (this, iter->second, tmp_builder)) {
 	  builder.add_ghost ("", iter->first);
 	  tmp_builder.populate_menu (builder);
 	  result = true;

Modified: trunk/lib/engine/addressbook/ldap/ldap-source.cpp
==============================================================================
--- trunk/lib/engine/addressbook/ldap/ldap-source.cpp	(original)
+++ trunk/lib/engine/addressbook/ldap/ldap-source.cpp	Thu Oct 30 15:18:25 2008
@@ -97,32 +97,27 @@
 void
 OPENLDAP::Source::add (xmlNodePtr node)
 {
-  Book *book = NULL;
-
-  book = new Book (core, node);
-
-  common_add (*book);
+  common_add (new Book (core, node));
 }
 
 void
 OPENLDAP::Source::add ()
 {
-  Book *book = NULL;
   xmlNodePtr root;
 
   root = xmlDocGetRootElement (doc);
-  book = new Book (core, bookinfo);
+  gmref_ptr<Book> book = new Book (core, bookinfo);
 
   xmlAddChild (root, book->get_node ());
 
-  common_add (*book);
+  common_add (book);
 }
 
 void
-OPENLDAP::Source::common_add (Book &book)
+OPENLDAP::Source::common_add (gmref_ptr<Book> book)
 {
-  book.trigger_saving.connect (sigc::mem_fun (this,
-					      &OPENLDAP::Source::save));
+  book->trigger_saving.connect (sigc::mem_fun (this,
+					       &OPENLDAP::Source::save));
   add_book (book);
 }
 

Modified: trunk/lib/engine/addressbook/ldap/ldap-source.h
==============================================================================
--- trunk/lib/engine/addressbook/ldap/ldap-source.h	(original)
+++ trunk/lib/engine/addressbook/ldap/ldap-source.h	Thu Oct 30 15:18:25 2008
@@ -84,9 +84,7 @@
 
     void add ();
 
-    void common_add (Book &book);
-
-    void on_remove_me (Book *book);
+    void common_add (gmref_ptr<Book> book);
 
     void save ();
 

Modified: trunk/lib/engine/presence/local-roster/local-roster-bridge.cpp
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-roster-bridge.cpp	(original)
+++ trunk/lib/engine/presence/local-roster/local-roster-bridge.cpp	Thu Oct 30 15:18:25 2008
@@ -67,7 +67,7 @@
     const std::string get_description () const
     { return "\tComponent to push contacts into the local roster"; }
 
-    bool populate_menu (Ekiga::Contact &contact,
+    bool populate_menu (gmref_ptr<Ekiga::Contact> contact,
 			const std::string uri,
 			Ekiga::MenuBuilder &builder);
 
@@ -79,7 +79,7 @@
 
 
 bool
-Local::ContactDecorator::populate_menu (Ekiga::Contact &contact,
+Local::ContactDecorator::populate_menu (gmref_ptr<Ekiga::Contact> contact,
 					const std::string uri,
 					Ekiga::MenuBuilder &builder)
 {
@@ -87,13 +87,13 @@
 
   if (cluster.is_supported_uri (uri)) {
 
-    Heap &heap = cluster.get_heap ();
+    Heap& heap = cluster.get_heap ();
 
     if (!heap.has_presentity_with_uri (uri)) {
 
       builder.add_action ("add", _("Add to local roster"),
 			  sigc::bind (sigc::mem_fun (heap, &Local::Heap::new_presentity),
-				      contact.get_name (), uri));
+				      contact->get_name (), uri));
       populated = true;
     }
   }

Modified: trunk/src/endpoints/h323-endpoint.cpp
==============================================================================
--- trunk/src/endpoints/h323-endpoint.cpp	(original)
+++ trunk/src/endpoints/h323-endpoint.cpp	Thu Oct 30 15:18:25 2008
@@ -104,11 +104,11 @@
 }
 
 
-bool Opal::H323::EndPoint::populate_menu (Ekiga::Contact &contact,
+bool Opal::H323::EndPoint::populate_menu (gmref_ptr<Ekiga::Contact> contact,
                                           std::string uri,
                                           Ekiga::MenuBuilder &builder)
 {
-  return menu_builder_add_actions (contact.get_name (), uri, builder);
+  return menu_builder_add_actions (contact->get_name (), uri, builder);
 }
 
 

Modified: trunk/src/endpoints/h323-endpoint.h
==============================================================================
--- trunk/src/endpoints/h323-endpoint.h	(original)
+++ trunk/src/endpoints/h323-endpoint.h	Thu Oct 30 15:18:25 2008
@@ -65,7 +65,7 @@
 
 
       /* ContactDecorator and PresentityDecorator */
-      bool populate_menu (Ekiga::Contact &contact,
+      bool populate_menu (gmref_ptr<Ekiga::Contact> contact,
 			  const std::string uri,
                           Ekiga::MenuBuilder &builder);
 

Modified: trunk/src/endpoints/sip-endpoint.cpp
==============================================================================
--- trunk/src/endpoints/sip-endpoint.cpp	(original)
+++ trunk/src/endpoints/sip-endpoint.cpp	Thu Oct 30 15:18:25 2008
@@ -175,11 +175,11 @@
 }
 
 
-bool Opal::Sip::EndPoint::populate_menu (Ekiga::Contact &contact,
+bool Opal::Sip::EndPoint::populate_menu (gmref_ptr<Ekiga::Contact> contact,
                                          const std::string uri,
                                          Ekiga::MenuBuilder &builder)
 {
-  return menu_builder_add_actions (contact.get_name (), uri, builder);
+  return menu_builder_add_actions (contact->get_name (), uri, builder);
 }
 
 

Modified: trunk/src/endpoints/sip-endpoint.h
==============================================================================
--- trunk/src/endpoints/sip-endpoint.h	(original)
+++ trunk/src/endpoints/sip-endpoint.h	Thu Oct 30 15:18:25 2008
@@ -77,7 +77,7 @@
       ~EndPoint ();
 
       /* ContactDecorator and PresentityDecorator */
-      bool populate_menu (Ekiga::Contact &contact,
+      bool populate_menu (gmref_ptr<Ekiga::Contact> contact,
 			  const std::string uri,
                           Ekiga::MenuBuilder &builder);
 



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