[ekiga/jp-opal-roster] Opal::Bank: first draft of the modification



commit c5f810bda60e3f5e1bb453d502b2c063bbfef567
Author: Julien Puydt <jpuydt free fr>
Date:   Sat Oct 26 14:37:03 2013 +0200

    Opal::Bank: first draft of the modification

 lib/engine/components/opal/opal-bank.cpp |   90 ++++++++++++++++++++++++++----
 lib/engine/components/opal/opal-bank.h   |   18 ++++--
 2 files changed, 91 insertions(+), 17 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-bank.cpp b/lib/engine/components/opal/opal-bank.cpp
index 258538f..9562424 100644
--- a/lib/engine/components/opal/opal-bank.cpp
+++ b/lib/engine/components/opal/opal-bank.cpp
@@ -1,6 +1,6 @@
 
 /* Ekiga -- A VoIP and Video-Conferencing application
- * Copyright (C) 2000-2009 Damien Sandras <dsandras seconix com>
+ * Copyright (C) 2000-2013 Damien Sandras <dsandras seconix com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -31,6 +31,7 @@
  *                         ------------------------------------------
  *   begin                : written in 2008 by Damien Sandras
  *   copyright            : (c) 2008 by Damien Sandras
+ *                          (c) 2013 by Julien Puydt
  *   description          : implementation of an opal account
  *
  */
@@ -48,8 +49,10 @@
 #include "opal-bank.h"
 #include "sip-endpoint.h"
 
+
 Opal::Bank::Bank (Ekiga::ServiceCore& core):
   sip_endpoint(core.get<Opal::Sip::EndPoint> ("opal-sip-endpoint")),
+  presence_core(core.get<Ekiga::PresenceCore> ("presence-core")),
   notification_core(core.get<Ekiga::NotificationCore> ("notification-core")),
   personal_details(core.get<Ekiga::PersonalDetails> ("personal-details")),
   audiooutput_core(core.get<Ekiga::AudioOutputCore> ("audiooutput-core")),
@@ -86,6 +89,7 @@ Opal::Bank::Bank (Ekiga::ServiceCore& core):
   update_sip_endpoint_aor_map ();
 }
 
+
 Opal::Bank::~Bank ()
 {
   // do it forcibly so we're sure the accounts are freed before our
@@ -97,6 +101,7 @@ Opal::Bank::~Bank ()
   delete protocols_settings;
 }
 
+
 bool
 Opal::Bank::populate_menu (Ekiga::MenuBuilder & builder)
 {
@@ -114,6 +119,7 @@ Opal::Bank::populate_menu (Ekiga::MenuBuilder & builder)
   return true;
 }
 
+
 bool
 Opal::Bank::populate_menu (Ekiga::ContactPtr contact,
                           const std::string uri,
@@ -122,6 +128,7 @@ Opal::Bank::populate_menu (Ekiga::ContactPtr contact,
   return populate_menu_helper (contact->get_name (), uri, builder);
 }
 
+
 bool
 Opal::Bank::populate_menu (Ekiga::PresentityPtr presentity,
                           const std::string uri,
@@ -130,6 +137,7 @@ Opal::Bank::populate_menu (Ekiga::PresentityPtr presentity,
   return populate_menu_helper (presentity->get_name (), uri, builder);
 }
 
+
 bool
 Opal::Bank::populate_menu_helper (const std::string fullname,
                                  const std::string& uri,
@@ -154,6 +162,7 @@ Opal::Bank::populate_menu_helper (const std::string fullname,
   return result;
 }
 
+
 void
 Opal::Bank::new_account (Account::Type acc_type,
                         std::string username,
@@ -215,9 +224,10 @@ Opal::Bank::new_account (Account::Type acc_type,
 }
 
 
-void Opal::Bank::on_new_account_form_submitted (bool submitted,
-                                               Ekiga::Form &result,
-                                                Account::Type acc_type)
+void
+Opal::Bank::on_new_account_form_submitted (bool submitted,
+                                          Ekiga::Form& result,
+                                          Account::Type acc_type)
 {
   if (!submitted)
     return;
@@ -262,14 +272,15 @@ void Opal::Bank::on_new_account_form_submitted (bool submitted,
 }
 
 
-void Opal::Bank::add (Account::Type acc_type,
-                      std::string name,
-                      std::string host,
-                      std::string user,
-                      std::string auth_user,
-                      std::string password,
-                      bool enabled,
-                      unsigned timeout)
+void
+Opal::Bank::add (Account::Type acc_type,
+                std::string name,
+                std::string host,
+                std::string user,
+                std::string auth_user,
+                std::string password,
+                bool enabled,
+                unsigned timeout)
 {
   AccountPtr account
     = AccountPtr(new Opal::Account (sip_endpoint,
@@ -286,6 +297,7 @@ void Opal::Bank::add (Account::Type acc_type,
   Ekiga::BankImpl<Account>::add_connection (account, account->status_received.connect (boost::ref 
(status_received)));
 }
 
+
 void
 Opal::Bank::call_manager_ready ()
 {
@@ -298,6 +310,7 @@ Opal::Bank::call_manager_ready ()
   }
 }
 
+
 Opal::AccountPtr
 Opal::Bank::find_account (const std::string& aor)
 {
@@ -314,6 +327,7 @@ Opal::Bank::find_account (const std::string& aor)
   return result;
 }
 
+
 void
 Opal::Bank::save () const
 {
@@ -326,6 +340,7 @@ Opal::Bank::save () const
   protocols_settings->set_string_list ("accounts-list", accounts);
 }
 
+
 void
 Opal::Bank::publish (const Ekiga::PersonalDetails& details)
 {
@@ -335,6 +350,7 @@ Opal::Bank::publish (const Ekiga::PersonalDetails& details)
     (*iter)->publish (details);
 }
 
+
 void
 Opal::Bank::fetch (const std::string uri)
 {
@@ -344,6 +360,7 @@ Opal::Bank::fetch (const std::string uri)
     (*iter)->fetch (uri);
 }
 
+
 void
 Opal::Bank::unfetch (const std::string uri)
 {
@@ -353,6 +370,7 @@ Opal::Bank::unfetch (const std::string uri)
     (*iter)->unfetch (uri);
 }
 
+
 void
 Opal::Bank::on_registration_event (std::string aor,
                                   Opal::Account::RegistrationState state,
@@ -364,6 +382,7 @@ Opal::Bank::on_registration_event (std::string aor,
     account->handle_registration_event (state, msg);
 }
 
+
 void
 Opal::Bank::on_mwi_event (std::string aor,
                          std::string info)
@@ -374,6 +393,7 @@ Opal::Bank::on_mwi_event (std::string aor,
     account->handle_message_waiting_information (info);
 }
 
+
 void
 Opal::Bank::update_sip_endpoint_aor_map ()
 {
@@ -386,3 +406,49 @@ Opal::Bank::update_sip_endpoint_aor_map ()
 
   sip_endpoint->update_aor_map (result);
 }
+
+
+void
+Opal::Bank::visit_heaps (boost::function1<bool, Ekiga::HeapPtr> visitor) const
+{
+  visit_objects (visitor);
+}
+
+
+const std::set<std::string>
+Opal::Bank::existing_groups () const
+{
+  std::set<std::string> result;
+
+  for (const_iterator iter = begin ();
+       iter != end ();
+       ++iter) {
+
+    std::set<std::string> groups = (*iter)->get_groups ();
+    result.insert (groups.begin (), groups.end ());
+  }
+
+  result.insert (_("Family"));
+  result.insert (_("Friend"));
+  /* Translator: http://www.ietf.org/rfc/rfc4480.txt proposes several
+     relationships between you and your contact; associate means
+     someone who is at the same "level" than you.
+  */
+  result.insert (_("Associate"));
+  /* Translator: http://www.ietf.org/rfc/rfc4480.txt proposes several
+     relationships between you and your contact; assistant means
+     someone who is at a lower "level" than you.
+  */
+  result.insert (_("Assistant"));
+  /* Translator: http://www.ietf.org/rfc/rfc4480.txt proposes several
+     relationships between you and your contact; supervisor means
+     someone who is at a higher "level" than you.
+  */
+  result.insert (_("Supervisor"));
+  /* Translator: http://www.ietf.org/rfc/rfc4480.txt proposes several
+     relationships between you and your contact; self means yourself.
+  */
+  result.insert (_("Self"));
+
+  return result;
+}
diff --git a/lib/engine/components/opal/opal-bank.h b/lib/engine/components/opal/opal-bank.h
index 163ebbd..76903fa 100644
--- a/lib/engine/components/opal/opal-bank.h
+++ b/lib/engine/components/opal/opal-bank.h
@@ -1,6 +1,6 @@
 
 /* Ekiga -- A VoIP and Video-Conferencing application
- * Copyright (C) 2000-2009 Damien Sandras <dsandras seconix com>
+ * Copyright (C) 2000-2013 Damien Sandras <dsandras seconix com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -31,7 +31,8 @@
  *                         ------------------------------------------
  *   begin                : written in 2008 by Damien Sandras
  *   copyright            : (c) 2008 by Damien Sandras
- *   description          : declaration of an OPAL bank 
+ *                          (c) 2013 by Julien Puydt
+ *   description          : declaration of an OPAL bank
  *
  */
 
@@ -51,8 +52,9 @@ namespace Opal
    * @internal
    * @{
    */
-  class Bank: 
+  class Bank:
       public Ekiga::BankImpl<Account>,
+      public Ekiga::Cluster,
       public Ekiga::PresencePublisher,
       public Ekiga::PresenceFetcher,
       public Ekiga::ContactDecorator,
@@ -98,7 +100,7 @@ public:
                        Ekiga::MenuBuilder& builder);
 
     /** Find the account with the given address of record in the Bank
-     * @param aor is the address of record of the Account or the host to look 
+     * @param aor is the address of record of the Account or the host to look
      *        for
      * @return The Opal::Account if an Account was found, false otherwise.
      *         The returned account should not be freed.
@@ -108,8 +110,14 @@ public:
 
     void call_manager_ready ();
 
+    /* this object is an Ekiga::Cluster */
+    void visit_heaps (boost::function1<bool, Ekiga::HeapPtr> visitor) const;
+
+    const std::set<std::string> existing_groups () const;
+
 private:
     boost::shared_ptr<Opal::Sip::EndPoint> sip_endpoint;
+    boost::weak_ptr<Ekiga::PresenceCore> presence_core;
     boost::shared_ptr<Ekiga::NotificationCore> notification_core;
     boost::shared_ptr<Ekiga::PersonalDetails> personal_details;
     boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core;
@@ -124,7 +132,7 @@ private:
                                        Account::Type acc_type);
 
     void add (Account::Type acc_type,
-              std::string name, 
+              std::string name,
               std::string host,
               std::string user,
               std::string auth_user,


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