[ekiga] Implemented Opal::Sip::EndPoint and Opal::H323::EndPoint populate_menu helper for Opal::CallManager
- From: Julien Puydt <jpuydt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Implemented Opal::Sip::EndPoint and Opal::H323::EndPoint populate_menu helper for Opal::CallManager
- Date: Fri, 1 Feb 2013 15:15:54 +0000 (UTC)
commit 0abef71533bbd54188f43f364bc201ab987f6441
Author: Julien Puydt <jpuydt free fr>
Date: Fri Feb 1 15:27:07 2013 +0100
Implemented Opal::Sip::EndPoint and Opal::H323::EndPoint populate_menu helper for Opal::CallManager
(but Opal::CallManager doesn't work correctly yet)
lib/engine/components/opal/h323-endpoint.cpp | 45 ++--------
lib/engine/components/opal/h323-endpoint.h | 20 +----
lib/engine/components/opal/sip-endpoint.cpp | 115 +++-----------------------
lib/engine/components/opal/sip-endpoint.h | 20 +----
4 files changed, 31 insertions(+), 169 deletions(-)
---
diff --git a/lib/engine/components/opal/h323-endpoint.cpp b/lib/engine/components/opal/h323-endpoint.cpp
index 147afd3..eec597c 100644
--- a/lib/engine/components/opal/h323-endpoint.cpp
+++ b/lib/engine/components/opal/h323-endpoint.cpp
@@ -115,42 +115,17 @@ Opal::H323::EndPoint::~EndPoint ()
}
bool
-Opal::H323::EndPoint::populate_menu (Ekiga::ContactPtr contact,
- std::string uri,
- Ekiga::MenuBuilder &builder)
+Opal::H323::EndPoint::populate_menu (const std::string& /*fullname*/,
+ const std::string& uri,
+ Ekiga::MenuBuilder& builder)
{
- return menu_builder_add_actions (contact->get_name (), uri, builder);
-}
-
-
-bool
-Opal::H323::EndPoint::populate_menu (Ekiga::PresentityPtr presentity,
- const std::string uri,
- Ekiga::MenuBuilder& builder)
-{
- return menu_builder_add_actions (presentity->get_name (), uri, builder);
-}
-
-
-bool
-Opal::H323::EndPoint::menu_builder_add_actions (const std::string & /*fullname*/,
- const std::string& uri,
- Ekiga::MenuBuilder & builder)
-{
- bool populated = false;
-
- if (uri.find ("h323:") == 0) {
-
- if (0 == GetConnectionCount ())
- builder.add_action ("phone-pick-up", _("Call"),
- boost::bind (&Opal::H323::EndPoint::on_dial, this, uri));
- else
- builder.add_action ("mail-forward", _("Transfer"),
- boost::bind (&Opal::H323::EndPoint::on_transfer, this, uri));
- populated = true;
- }
-
- return populated;
+ if (0 == GetConnectionCount ())
+ builder.add_action ("phone-pick-up", _("Call"),
+ boost::bind (&Opal::H323::EndPoint::on_dial, this, uri));
+ else
+ builder.add_action ("mail-forward", _("Transfer"),
+ boost::bind (&Opal::H323::EndPoint::on_transfer, this, uri));
+ return true;
}
diff --git a/lib/engine/components/opal/h323-endpoint.h b/lib/engine/components/opal/h323-endpoint.h
index f3f7699..cde6296 100644
--- a/lib/engine/components/opal/h323-endpoint.h
+++ b/lib/engine/components/opal/h323-endpoint.h
@@ -58,9 +58,7 @@ namespace Opal {
class EndPoint : public H323EndPoint,
public Ekiga::Service,
- public Ekiga::CallProtocolManager,
- public Ekiga::PresentityDecorator,
- public Ekiga::ContactDecorator
+ public Ekiga::CallProtocolManager
{
PCLASSINFO(EndPoint, H323EndPoint);
@@ -76,18 +74,10 @@ namespace Opal {
const std::string get_description () const
{ return "\tObject managing H323 objects with the Opal library"; }
- /* ContactDecorator and PresentityDecorator */
- bool populate_menu (Ekiga::ContactPtr contact,
- const std::string uri,
- Ekiga::MenuBuilder &builder);
-
- bool populate_menu (Ekiga::PresentityPtr presentity,
- const std::string uri,
- Ekiga::MenuBuilder & builder);
-
- bool menu_builder_add_actions (const std::string & fullname,
- const std::string& uri,
- Ekiga::MenuBuilder & builder);
+ // helper for Opal::Bank's contact/presentity decorator code
+ bool menu_builder_populate_menu (const std::string& fullname,
+ const std::string& uri,
+ Ekiga::MenuBuilder& builder);
/* CallProtocolManager */
diff --git a/lib/engine/components/opal/sip-endpoint.cpp b/lib/engine/components/opal/sip-endpoint.cpp
index ce6df39..1f41d8c 100644
--- a/lib/engine/components/opal/sip-endpoint.cpp
+++ b/lib/engine/components/opal/sip-endpoint.cpp
@@ -154,119 +154,26 @@ Opal::Sip::EndPoint::~EndPoint ()
{
}
-
-bool
-Opal::Sip::EndPoint::populate_menu (Ekiga::ContactPtr contact,
- const std::string uri,
- Ekiga::MenuBuilder &builder)
-{
- return menu_builder_add_actions (contact->get_name (), uri, builder);
-}
-
-
bool
-Opal::Sip::EndPoint::populate_menu (Ekiga::PresentityPtr presentity,
- const std::string uri,
+Opal::Sip::EndPoint::populate_menu (const std::string& fullname,
+ const std::string& uri,
Ekiga::MenuBuilder& builder)
{
- return menu_builder_add_actions (presentity->get_name (), uri, builder);
-}
-
-
-bool
-Opal::Sip::EndPoint::menu_builder_add_actions (const std::string& fullname,
- const std::string& uri,
- Ekiga::MenuBuilder & builder)
-{
bool populated = false;
std::list<std::string> uris;
std::list<std::string> accounts_list;
- if (!(uri.find ("sip:") == 0 || uri.find (":") == string::npos))
- return false;
-
- if (uri.find ("@") == string::npos) {
-
- for (Opal::Bank::iterator it = bank->begin ();
- it != bank->end ();
- it++) {
-
- if ((*it)->get_protocol_name () == "SIP" && (*it)->is_enabled ()) {
-
- std::stringstream uristr;
- std::string str = uri;
-
- for (unsigned i = 0 ; i < str.length() ; i++) {
-
- if (str [i] == ' ' || str [i] == '-') {
- str.erase (i,1);
- i--;
- }
- }
-
- if (str.find ("sip:") == string::npos)
- uristr << "sip:" << str;
- else
- uristr << str;
-
- uristr << "@" << (*it)->get_host ();
-
- uris.push_back (uristr.str ());
- accounts_list.push_back ((*it)->get_name ());
- }
- }
- } else {
- uris.push_back (uri);
- accounts_list.push_back ("");
- }
-
- std::list<std::string>::iterator ita = accounts_list.begin ();
- for (std::list<std::string>::iterator it = uris.begin ();
- it != uris.end ();
- it++) {
-
- std::stringstream call_action;
- std::stringstream transfer_action;
- if (!(*ita).empty ()) {
- call_action << _("Call") << " [" << (*ita) << "]";
- transfer_action << _("Transfer") << " [" << (*ita) << "]";
- }
- else {
- call_action << _("Call");
- transfer_action << _("Transfer");
- }
-
- if (0 == GetConnectionCount ())
- builder.add_action ("phone-pick-up", call_action.str (),
- boost::bind (&Opal::Sip::EndPoint::on_dial, this, (*it)));
- else
- builder.add_action ("mail-forward", transfer_action.str (),
- boost::bind (&Opal::Sip::EndPoint::on_transfer, this, (*it)));
-
- ita++;
- }
-
- ita = accounts_list.begin ();
- for (std::list<std::string>::iterator it = uris.begin ();
- it != uris.end ();
- it++) {
-
- std::stringstream msg_action;
- if (!(*ita).empty ())
- msg_action << _("Message") << " [" << (*ita) << "]";
- else
- msg_action << _("Message");
-
- builder.add_action ("im-message-new", msg_action.str (),
- boost::bind (&Opal::Sip::EndPoint::on_message, this, (*it), fullname));
-
- ita++;
- }
-
- populated = true;
+ if (0 == GetConnectionCount ())
+ builder.add_action ("phone-pick-up", _("Call"),
+ boost::bind (&Opal::Sip::EndPoint::on_dial, this, uri));
+ else
+ builder.add_action ("mail-forward", _("Transfer"),
+ boost::bind (&Opal::Sip::EndPoint::on_transfer, this, uri));
+ builder.add_action ("im-message-new", _("Message"),
+ boost::bind (&Opal::Sip::EndPoint::on_message, this, uri, fullname));
- return populated;
+ return true;
}
diff --git a/lib/engine/components/opal/sip-endpoint.h b/lib/engine/components/opal/sip-endpoint.h
index fe54800..a3371e1 100644
--- a/lib/engine/components/opal/sip-endpoint.h
+++ b/lib/engine/components/opal/sip-endpoint.h
@@ -59,9 +59,7 @@ namespace Opal {
class EndPoint : public SIPEndPoint,
public Ekiga::Service,
- public Ekiga::CallProtocolManager,
- public Ekiga::PresentityDecorator,
- public Ekiga::ContactDecorator
+ public Ekiga::CallProtocolManager
{
PCLASSINFO(EndPoint, SIPEndPoint);
@@ -83,18 +81,10 @@ namespace Opal {
const std::string get_description () const
{ return "\tObject managing SIP objects with the Opal library"; }
- /* ContactDecorator and PresentityDecorator */
- bool populate_menu (Ekiga::ContactPtr contact,
- const std::string uri,
- Ekiga::MenuBuilder &builder);
-
- bool populate_menu (Ekiga::PresentityPtr presentity,
- const std::string uri,
- Ekiga::MenuBuilder & builder);
-
- bool menu_builder_add_actions (const std::string & fullname,
- const std::string& uri,
- Ekiga::MenuBuilder & builder);
+ // helper for Opal::Bank's contact/presentity decorator code
+ bool populate_menu (const std::string& fullname,
+ const std::string& uri,
+ Ekiga::MenuBuilder& builder);
/* Chat subsystem */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]