[ekiga/ds-gtk-application] OpalBank: Improved Ekiga & DiamondCard account Actions.
- From: Damien Sandras <dsandras src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga/ds-gtk-application] OpalBank: Improved Ekiga & DiamondCard account Actions.
- Date: Sun, 21 Dec 2014 16:59:37 +0000 (UTC)
commit 71f2c78c44f687dcc96b6de2d8357fcd90171a54
Author: Damien Sandras <dsandras seconix com>
Date: Sun Dec 21 17:55:21 2014 +0100
OpalBank: Improved Ekiga & DiamondCard account Actions.
Several changes here:
- If there is already an Ekiga.net account, we do not provide an action
to create another one.
- If there is already a DiamondCard account, we provide actions to
consult/recharge/... it.
lib/engine/components/opal/opal-bank.cpp | 72 +++++++++++++++++++++++------
lib/engine/components/opal/opal-bank.h | 4 ++
2 files changed, 61 insertions(+), 15 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-bank.cpp b/lib/engine/components/opal/opal-bank.cpp
index 6537946..916d695 100644
--- a/lib/engine/components/opal/opal-bank.cpp
+++ b/lib/engine/components/opal/opal-bank.cpp
@@ -42,6 +42,7 @@
#include <glib/gi18n.h>
+#include "platform.h"
#include "menu-builder.h"
#include "form-request-simple.h"
@@ -109,20 +110,7 @@ Opal::Bank::Bank (Ekiga::ServiceCore& core):
update_sip_endpoint_aor_map ();
/* Actor stuff */
- add_action (Ekiga::ActionPtr (new Ekiga::Action ("add-account-ekiga", _("_Add an Ekiga.net Account"),
- boost::bind (&Opal::Bank::new_account, this,
- Opal::Account::Ekiga, "", ""))));
- add_action (Ekiga::ActionPtr (new Ekiga::Action ("add-account-diamondcard", _("_Add an Ekiga Call Out
Account"),
- boost::bind (&Opal::Bank::new_account, this,
- Opal::Account::DiamondCard, "", ""))));
- add_action (Ekiga::ActionPtr (new Ekiga::Action ("add-account-sip", _("_Add a SIP Account"),
- boost::bind (&Opal::Bank::new_account, this,
- Opal::Account::SIP, "", ""))));
-#ifdef HAVE_H323
- add_action (Ekiga::ActionPtr (new Ekiga::Action ("add-account-h323", _("_Add an H.323 Account"),
- boost::bind (&Opal::Bank::new_account, this,
- Opal::Account::H323, "", ""))));
-#endif
+ add_actions ();
}
@@ -512,7 +500,61 @@ Opal::Bank::migrate_from_gconf (const std::list<std::string> old)
xmlDocDumpMemory (doc, &buffer, &doc_size);
settings->set_string ("accounts", (const char*)buffer);
-
+
delete settings;
xmlFreeDoc (doc);
}
+
+
+void
+Opal::Bank::on_consult (const std::string url)
+{
+ gm_platform_open_uri (url.c_str ());
+}
+
+
+void
+Opal::Bank::add_actions ()
+{
+ Opal::AccountPtr account = find_account ("ekiga.net");
+ if (!account)
+ add_action (Ekiga::ActionPtr (new Ekiga::Action ("add-account-ekiga",
+ _("_Add an Ekiga.net Account"),
+ boost::bind (&Opal::Bank::new_account, this,
+ Opal::Account::Ekiga, "", ""))));
+ account = find_account ("sip.diamondcard.us");
+ if (account) {
+ std::stringstream str;
+ std::stringstream url;
+ str << "https://www.diamondcard.us/exec/voip-login?accId=" << account->get_username () << "&pinCode=" <<
account->get_password () << "&spo=ekiga";
+
+ url.str ("");
+ url << str.str () << "&act=rch";
+ add_action (Ekiga::ActionPtr (new Ekiga::Action ("recharge-account-diamondcard",
+ _("Recharge the Ekiga Call Out account"),
+ boost::bind (&Opal::Bank::on_consult, this, url.str
()))));
+ url.str ("");
+ url << str.str () << "&act=bh";
+ add_action (Ekiga::ActionPtr (new Ekiga::Action ("balance-account-diamondcard",
+ _("Consult the Ekiga Call Out balance history"),
+ boost::bind (&Opal::Bank::on_consult, this, url.str
()))));
+ url.str ("");
+ url << str.str () << "&act=ch";
+ add_action (Ekiga::ActionPtr (new Ekiga::Action ("history-account-diamondcard",
+ _("Consult the Ekiga Call Out call history"),
+ boost::bind (&Opal::Bank::on_consult, this, url.str
()))));
+ }
+ else
+ add_action (Ekiga::ActionPtr (new Ekiga::Action ("add-account-diamondcard",
+ _("_Add an Ekiga Call Out Account"),
+ boost::bind (&Opal::Bank::new_account, this,
+ Opal::Account::DiamondCard, "", ""))));
+ add_action (Ekiga::ActionPtr (new Ekiga::Action ("add-account-sip", _("_Add a SIP Account"),
+ boost::bind (&Opal::Bank::new_account, this,
+ Opal::Account::SIP, "", ""))));
+#ifdef HAVE_H323
+ add_action (Ekiga::ActionPtr (new Ekiga::Action ("add-account-h323", _("_Add an H.323 Account"),
+ boost::bind (&Opal::Bank::new_account, this,
+ Opal::Account::H323, "", ""))));
+#endif
+}
diff --git a/lib/engine/components/opal/opal-bank.h b/lib/engine/components/opal/opal-bank.h
index 36d2637..0df22c4 100644
--- a/lib/engine/components/opal/opal-bank.h
+++ b/lib/engine/components/opal/opal-bank.h
@@ -147,6 +147,10 @@ private:
void update_sip_endpoint_aor_map ();
+ void on_consult (const std::string url);
+
+ void add_actions ();
+
Ekiga::Settings *protocols_settings;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]