ekiga r6296 - in trunk: . lib/engine/gui/gtk-frontend lib/engine/protocol/skel src/endpoints
- From: dsandras svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r6296 - in trunk: . lib/engine/gui/gtk-frontend lib/engine/protocol/skel src/endpoints
- Date: Wed, 21 May 2008 19:06:50 +0000 (UTC)
Author: dsandras
Date: Wed May 21 19:06:50 2008
New Revision: 6296
URL: http://svn.gnome.org/viewvc/ekiga?rev=6296&view=rev
Log:
Temporarily moved chat to the CallCore until I can provide some basic
ChatCore.
Modified:
trunk/ChangeLog
trunk/lib/engine/gui/gtk-frontend/chat-window-page.cpp
trunk/lib/engine/protocol/skel/call-core.cpp
trunk/lib/engine/protocol/skel/call-core.h
trunk/lib/engine/protocol/skel/call-manager.h
trunk/lib/engine/protocol/skel/call-protocol-manager.h
trunk/src/endpoints/sip.cpp
trunk/src/endpoints/sip.h
Modified: trunk/lib/engine/gui/gtk-frontend/chat-window-page.cpp
==============================================================================
--- trunk/lib/engine/gui/gtk-frontend/chat-window-page.cpp (original)
+++ trunk/lib/engine/gui/gtk-frontend/chat-window-page.cpp Wed May 21 19:06:50 2008
@@ -395,12 +395,10 @@
if (!message.empty ()) {
- //GMManager *call_core = dynamic_cast<GMManager *>(self->priv->core.get ("opal-component"));
+ Ekiga::CallCore *call_core = dynamic_cast<Ekiga::CallCore *>(self->priv->core.get ("call-core"));
- //
- std::cout << "FIXME" << std::endl << std::flush;
-// if (call_core)
- // call_core->send_message (self->priv->uri, message);
+ if (call_core)
+ call_core->send_message (self->priv->uri, message);
}
}
Modified: trunk/lib/engine/protocol/skel/call-core.cpp
==============================================================================
--- trunk/lib/engine/protocol/skel/call-core.cpp (original)
+++ trunk/lib/engine/protocol/skel/call-core.cpp Wed May 21 19:06:50 2008
@@ -52,10 +52,18 @@
manager_added.emit (manager);
// IM stuff
- manager.im_failed.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_im_failed), &manager));
- manager.im_received.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_im_received), &manager));
- manager.im_sent.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_im_sent), &manager));
- manager.new_chat.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_new_chat), &manager));
+ // It should finally get out of the CallCore
+ // Currently IM Managers are CallProtocolManagers
+ // Of course, not all CallProtocolManagers implement IM
+ for (CallManager::iterator iter = manager.begin ();
+ iter != manager.end ();
+ iter++) {
+
+ (*iter)->im_failed.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_im_failed), &manager));
+ (*iter)->im_received.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_im_received), &manager));
+ (*iter)->im_sent.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_im_sent), &manager));
+ (*iter)->new_chat.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_new_chat), &manager));
+ }
manager.mwi_event.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_mwi_event), &manager));
manager.registration_event.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_registration_event), &manager));
@@ -99,6 +107,25 @@
}
+bool CallCore::send_message (const std::string & uri,
+ const std::string & message)
+{
+ for (std::set<CallManager *>::iterator iter = managers.begin ();
+ iter != managers.end ();
+ iter++) {
+ for (CallManager::iterator miter = (*iter)->begin ();
+ miter != (*iter)->end ();
+ miter++) {
+
+ if ((*miter)->send_message (uri, message))
+ return true;
+ }
+ }
+
+ return false;
+}
+
+
void CallCore::add_call (Call *call, CallManager *manager)
{
call->ringing.connect (sigc::bind (sigc::mem_fun (this, &CallCore::on_ringing_call), call, manager));
Modified: trunk/lib/engine/protocol/skel/call-core.h
==============================================================================
--- trunk/lib/engine/protocol/skel/call-core.h (original)
+++ trunk/lib/engine/protocol/skel/call-core.h Wed May 21 19:06:50 2008
@@ -148,23 +148,16 @@
* NOTICE
*
* At some point, Instant Messaging and its signals should be moved out of
- * the CallCore and put into a shiny new object. Probably the Presence i
+ * the CallCore and put into a shiny new object. Probably the Presence
* one. But that's a TODO for later. Later we could also introduce the notion
* of Conversation.
*/
- /** Send a message to the given uri
- * @param: uri where to send the message
- * message what to send to the remote peer
- * @return: true if the operation could be handled
- * (that does not mean the message got though)
- */
- /*
- bool send_message (const std::string uri,
- const std::string message);
-*/
- /** See call-manager.h for API
+ /** See call-protocol-manager.h for API
*/
+ bool send_message (const std::string & uri,
+ const std::string & message);
+
sigc::signal<void, CallManager &, std::string, std::string> im_failed;
sigc::signal<void, CallManager &, std::string, std::string, std::string> im_received;
sigc::signal<void, CallManager &, std::string, std::string> im_sent;
Modified: trunk/lib/engine/protocol/skel/call-manager.h
==============================================================================
--- trunk/lib/engine/protocol/skel/call-manager.h (original)
+++ trunk/lib/engine/protocol/skel/call-manager.h Wed May 21 19:06:50 2008
@@ -195,43 +195,6 @@
/*
- * INSTANT MESSAGING
- */
-
- /** Send a message to the given uri
- * @param: uri : where to send the message
- * message: what to send to the remote peer
- */
- //virtual bool send_message (const std::string uri,
- //const std::string message) = 0;
-
- /** This signal is emitted when the transmission of a message failed
- * @param: uri : where the message could not be sent
- * error : a string describing the error that occured
- */
- sigc::signal<void, std::string, std::string> im_failed;
-
- /** This signal is emitted when a message has been received
- * @param: display_name: the display name of the sender
- * uri : the uri of the sender
- * message : the message sent by the sender
- */
- sigc::signal<void, std::string, std::string, std::string> im_received;
-
- /** This signal is emitted when a message has been sent
- * @param: uri : where the message has been sent
- * message: the message that was sent
- */
- sigc::signal<void, std::string, std::string> im_sent;
-
- /** This signal is emitted when a chat conversation should be initiated
- * @param: uri : the remote party
- * display_name : the display name
- */
- sigc::signal<void, std::string, std::string> new_chat;
-
-
- /*
* ACCOUNT INDICATIONS
*/
Modified: trunk/lib/engine/protocol/skel/call-protocol-manager.h
==============================================================================
--- trunk/lib/engine/protocol/skel/call-protocol-manager.h (original)
+++ trunk/lib/engine/protocol/skel/call-protocol-manager.h Wed May 21 19:06:50 2008
@@ -96,6 +96,56 @@
/*
+ * INSTANT MESSAGING
+ */
+
+ /**
+ * NOTICE
+ *
+ * At some point, Instant Messaging and its signals should be moved out of
+ * the CallCore and put into a shiny new object. Probably the Presence
+ * one. But that's a TODO for later. Later we could also introduce the notion
+ * of Conversation.
+ *
+ * Notice the current definition forces each CallProtocolManager to implement
+ * a send_message method. That is wrong. Please use a dummy function if needed
+ * before we implement something specific.
+ */
+
+ /** Send a message to the given uri
+ * @param: uri : where to send the message
+ * message: what to send to the remote peer
+ */
+ virtual bool send_message (const std::string & uri,
+ const std::string & message) = 0;
+
+ /** This signal is emitted when the transmission of a message failed
+ * @param: uri : where the message could not be sent
+ * error : a string describing the error that occured
+ */
+ sigc::signal<void, std::string, std::string> im_failed;
+
+ /** This signal is emitted when a message has been received
+ * @param: display_name: the display name of the sender
+ * uri : the uri of the sender
+ * message : the message sent by the sender
+ */
+ sigc::signal<void, std::string, std::string, std::string> im_received;
+
+ /** This signal is emitted when a message has been sent
+ * @param: uri : where the message has been sent
+ * message: the message that was sent
+ */
+ sigc::signal<void, std::string, std::string> im_sent;
+
+ /** This signal is emitted when a chat conversation should be initiated
+ * @param: uri : the remote party
+ * display_name : the display name
+ */
+ sigc::signal<void, std::string, std::string> new_chat;
+
+
+ /*
* Misc
*/
Modified: trunk/src/endpoints/sip.cpp
==============================================================================
--- trunk/src/endpoints/sip.cpp (original)
+++ trunk/src/endpoints/sip.cpp Wed May 21 19:06:50 2008
@@ -107,19 +107,6 @@
}
-bool GMSIPEndpoint::message (const std::string & _uri,
- const std::string & _message)
-{
- if (!_uri.empty () && (_uri.find ("sip:") == 0 || _uri.find (':') == string::npos) && !_message.empty ()) {
- Message (_uri.c_str (), _message.c_str ());
-
- return true;
- }
-
- return false;
-}
-
-
bool GMSIPEndpoint::populate_menu (Ekiga::Contact &contact,
Ekiga::MenuBuilder &builder)
{
@@ -260,6 +247,7 @@
}
}
+
bool GMSIPEndpoint::dial (const std::string & uri)
{
PString token;
@@ -280,6 +268,20 @@
return false;
}
+
+bool GMSIPEndpoint::send_message (const std::string & _uri,
+ const std::string & _message)
+{
+ if (!_uri.empty () && (_uri.find ("sip:") == 0 || _uri.find (':') == string::npos) && !_message.empty ()) {
+
+ Message (_uri.c_str (), _message.c_str ());
+ return true;
+ }
+
+ return false;
+}
+
+
const std::string & GMSIPEndpoint::get_protocol_name () const
{
return protocol_name;
@@ -798,7 +800,7 @@
std::string message_uri = (const char *) uri.AsString ();
std::string _message = (const char *) pdu.GetEntityBody ();
- runtime.run_in_main (sigc::bind (endpoint.im_received.make_slot (), display_name, message_uri, _message));
+ runtime.run_in_main (sigc::bind (im_received.make_slot (), display_name, message_uri, _message));
}
}
@@ -810,7 +812,7 @@
SIPURL to = messageUrl;
to.AdjustForRequestURI ();
std::string uri = (const char *) to.AsString ();
- runtime.run_in_main (sigc::bind (endpoint.im_failed.make_slot (), uri,
+ runtime.run_in_main (sigc::bind (im_failed.make_slot (), uri,
_("Could not send message")));
}
@@ -825,7 +827,7 @@
to.AdjustForRequestURI ();
std::string uri = (const char *) to.AsString ();
std::string _message = (const char *) body;
- runtime.run_in_main (sigc::bind (endpoint.im_sent.make_slot (), uri, _message));
+ runtime.run_in_main (sigc::bind (im_sent.make_slot (), uri, _message));
}
@@ -944,5 +946,5 @@
void GMSIPEndpoint::on_message (std::string name,
std::string uri)
{
- runtime.run_in_main (sigc::bind (endpoint.new_chat.make_slot (), name, uri));
+ runtime.run_in_main (sigc::bind (new_chat.make_slot (), name, uri));
}
Modified: trunk/src/endpoints/sip.h
==============================================================================
--- trunk/src/endpoints/sip.h (original)
+++ trunk/src/endpoints/sip.h Wed May 21 19:06:50 2008
@@ -90,6 +90,9 @@
/* ProtocolManager */
bool dial (const std::string & uri);
+ bool send_message (const std::string & uri,
+ const std::string & message);
+
const std::string & get_protocol_name () const;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]