ekiga r5923 - in trunk: . lib/engine lib/engine/presence/skel src/clients src/components src/endpoints src/gui



Author: dsandras
Date: Sat Jan 19 22:09:39 2008
New Revision: 5923
URL: http://svn.gnome.org/viewvc/ekiga?rev=5923&view=rev

Log:
The PresencePublisher now uses the PersonalDetails class recently
introduced. Modified the SIP EndPoint so that it becomes a 
PresencePublisher. Also replace firstname/lastname by full_name, the
separation does not make sense anymore.


Modified:
   trunk/ChangeLog
   trunk/lib/engine/Makefile.am
   trunk/lib/engine/engine.cpp
   trunk/lib/engine/presence/skel/presence-core.cpp
   trunk/lib/engine/presence/skel/presence-core.h
   trunk/src/clients/avahi.cpp
   trunk/src/components/dbus.cpp
   trunk/src/endpoints/h323.h
   trunk/src/endpoints/manager.cpp
   trunk/src/endpoints/opal-main.cpp
   trunk/src/endpoints/sip.cpp
   trunk/src/endpoints/sip.h
   trunk/src/gui/assistant.cpp
   trunk/src/gui/misc.cpp
   trunk/src/gui/misc.h
   trunk/src/gui/preferences.cpp

Modified: trunk/lib/engine/Makefile.am
==============================================================================
--- trunk/lib/engine/Makefile.am	(original)
+++ trunk/lib/engine/Makefile.am	Sat Jan 19 22:09:39 2008
@@ -1,8 +1,9 @@
-SUBDIRS = framework addressbook presence gui protocol display
+SUBDIRS = framework addressbook presence gui protocol display components
 
 noinst_LTLIBRARIES = libekiga_engine.la
 
 INCLUDES = 								\
+	-I$(top_srcdir)/lib/gmconf/	 				\
 	-I$(top_srcdir)/lib/engine/	 				\
 	-I$(top_srcdir)/lib/engine/gui/gtk-core				\
 	-I$(top_srcdir)/lib/engine/gui/gtk-frontend			\
@@ -15,7 +16,8 @@
 	-I$(top_srcdir)/lib/engine/presence/skel			\
 	-I$(top_srcdir)/lib/engine/presence/avahi			\
 	-I$(top_srcdir)/lib/engine/presence/local-roster		\
-	-I$(top_srcdir)/lib/engine/display/skel
+	-I$(top_srcdir)/lib/engine/display/skel				\
+	-I$(top_srcdir)/lib/engine/components/gmconf-personal-details
 
 # XVideo/X
 if !WIN32
@@ -38,15 +40,16 @@
 
 libekiga_engine_la_LDFLAGS = -export-dynamic
 libekiga_engine_la_LIBADD = \
-	$(top_builddir)/lib/engine/gui/gtk-core/libgmgtk-core.la \
-	$(top_builddir)/lib/engine/gui/gtk-frontend/libgmgtk-frontend.la \
-	$(top_builddir)/lib/engine/protocol/skel/libgmprotocol.la \
-	$(top_builddir)/lib/engine/framework/libgmframework.la \
-	$(top_builddir)/lib/engine/addressbook/skel/libgmaddressbook.la \
-	$(top_builddir)/lib/engine/addressbook/call-history/libcall-history.la \
-	$(top_builddir)/lib/engine/presence/skel/libgmpresence.la \
-	$(top_builddir)/lib/engine/presence/local-roster/liblocal-roster.la \
-	$(top_builddir)/lib/engine/display/skel/libgmdisplay.la
+	$(top_builddir)/lib/engine/gui/gtk-core/libgmgtk-core.la 					\
+	$(top_builddir)/lib/engine/gui/gtk-frontend/libgmgtk-frontend.la 				\
+	$(top_builddir)/lib/engine/protocol/skel/libgmprotocol.la 					\
+	$(top_builddir)/lib/engine/framework/libgmframework.la 						\
+	$(top_builddir)/lib/engine/addressbook/skel/libgmaddressbook.la 				\
+	$(top_builddir)/lib/engine/addressbook/call-history/libcall-history.la 				\
+	$(top_builddir)/lib/engine/presence/skel/libgmpresence.la 					\
+	$(top_builddir)/lib/engine/presence/local-roster/liblocal-roster.la 				\
+	$(top_builddir)/lib/engine/display/skel/libgmdisplay.la						\
+	$(top_builddir)/lib/engine/components/gmconf-personal-details/libgmconfpersonaldetails.la	\
 	$(AM_LIBS)
 
 # XVideo/X

Modified: trunk/lib/engine/engine.cpp
==============================================================================
--- trunk/lib/engine/engine.cpp	(original)
+++ trunk/lib/engine/engine.cpp	Sat Jan 19 22:09:39 2008
@@ -50,6 +50,7 @@
 #include "local-roster-bridge.h"
 #include "gtk-core-main.h"
 #include "gtk-frontend.h"
+#include "gmconf-personal-details-main.h"
 
 #ifndef WIN32
 #include "display-main-x.h"
@@ -92,6 +93,10 @@
   core->add (*display_core);
   core->add (*runtime);
 
+  if (!gmconf_personal_details_init (*core, &argc, &argv)) {
+    delete core;
+    return;
+  }
 
 #ifndef WIN32
   if (!display_x_init (*core, &argc, &argv)) {

Modified: trunk/lib/engine/presence/skel/presence-core.cpp
==============================================================================
--- trunk/lib/engine/presence/skel/presence-core.cpp	(original)
+++ trunk/lib/engine/presence/skel/presence-core.cpp	Sat Jan 19 22:09:39 2008
@@ -38,6 +38,23 @@
 #include <iostream>
 
 #include "presence-core.h"
+#include "personal-details.h"
+
+
+Ekiga::PresencePublisher::PresencePublisher (Ekiga::ServiceCore & core)
+{
+  Ekiga::PersonalDetails *details = dynamic_cast <Ekiga::PersonalDetails *> (core.get ("personal-details"));
+
+  if (details) // If none, then we have no implementation of personal-details and won't relay signals
+    details->personal_details_updated.connect (sigc::mem_fun (this, &Ekiga::PresencePublisher::on_personal_details_updated));
+}
+
+
+void Ekiga::PresencePublisher::on_personal_details_updated (Ekiga::PersonalDetails & details)
+{
+  this->publish (details.get_display_name (), details.get_short_status (), details.get_long_status ());
+}
+
 
 Ekiga::PresenceCore::~PresenceCore ()
 {
@@ -176,14 +193,15 @@
   presence_publishers.insert (&publisher);
 }
 
-void Ekiga::PresenceCore::publish (const std::string & presence,
+void Ekiga::PresenceCore::publish (const std::string & display_name,
+                                   const std::string & presence,
                                    const std::string & extended_status)
 {
   for (std::set<PresencePublisher *>::iterator iter
 	 = presence_publishers.begin ();
        iter != presence_publishers.end ();
        iter++)
-    (*iter)->publish (presence, extended_status);
+    (*iter)->publish (display_name, presence, extended_status);
 }
 
 bool

Modified: trunk/lib/engine/presence/skel/presence-core.h
==============================================================================
--- trunk/lib/engine/presence/skel/presence-core.h	(original)
+++ trunk/lib/engine/presence/skel/presence-core.h	Sat Jan 19 22:09:39 2008
@@ -41,9 +41,12 @@
 #include "services.h"
 #include "cluster.h"
 
+
 namespace Ekiga
 {
 
+  class PersonalDetails;
+
 /**
  * @defgroup presence Presence
  * @{
@@ -101,10 +104,14 @@
   {
   public:
 
-    virtual ~PresencePublisher () {}
+    PresencePublisher (Ekiga::ServiceCore &);
+    virtual ~PresencePublisher () {};
 
-    virtual void publish (const std::string & /*presence*/,
+    virtual void publish (const std::string & /*display_name*/,
+                          const std::string & /*presence*/,
                           const std::string & /*extended_status*/) = 0;
+  private:
+    void on_personal_details_updated (PersonalDetails & details);
   };
 
   /** Core object for the presence support.
@@ -262,7 +269,8 @@
 
     void add_presence_publisher (PresencePublisher &publisher);
 
-    void publish (const std::string & status, 
+    void publish (const std::string & display_name,
+                  const std::string & status, 
                   const std::string & extended_status);
 
   private:

Modified: trunk/src/clients/avahi.cpp
==============================================================================
--- trunk/src/clients/avahi.cpp	(original)
+++ trunk/src/clients/avahi.cpp	Sat Jan 19 22:09:39 2008
@@ -346,15 +346,13 @@
 int
 GMZeroconfPublisher::GetPersonalData()
 {
-  gchar	*lastname = NULL;
-  gchar	*firstname = NULL;
+  gchar	*full_name = NULL;
   std::string status;
   
   int state = 0;
 
   gnomemeeting_threads_enter ();
-  firstname = gm_conf_get_string (PERSONAL_DATA_KEY "firstname");
-  lastname = gm_conf_get_string (PERSONAL_DATA_KEY "lastname");
+  full_name = gm_conf_get_string (PERSONAL_DATA_KEY "full_name");
   h323_port = gm_conf_get_int (H323_KEY "listen_port");
   sip_port = gm_conf_get_int (SIP_KEY "listen_port");
   state = gm_conf_get_int (PERSONAL_DATA_KEY "status");
@@ -409,7 +407,7 @@
   }
 
   /* Update the internal state */
-  name = gnomemeeting_create_fullname (firstname, lastname); 
+  name = full_name; 
   h323_text_record = 
     avahi_string_list_add_printf (h323_text_record,"presence=%s", status.c_str ());
   sip_text_record = 
@@ -420,10 +418,6 @@
   sip_text_record = 
     avahi_string_list_add (sip_text_record, "software=Ekiga/" PACKAGE_VERSION);
 
-
-  g_free (lastname);
-  g_free (firstname);
-
   return 0;
 }
 

Modified: trunk/src/components/dbus.cpp
==============================================================================
--- trunk/src/components/dbus.cpp	(original)
+++ trunk/src/components/dbus.cpp	Sat Jan 19 22:09:39 2008
@@ -151,17 +151,13 @@
                                     char **name,
                                     G_GNUC_UNUSED GError **error)
 {
-  gchar *firstname = NULL;
-  gchar *lastname = NULL;
-
+  gchar * full_name;
   PTRACE (1, "DBus\tGetName");
 
-  firstname = gm_conf_get_string (PERSONAL_DATA_KEY "firstname");
-  lastname = gm_conf_get_string (PERSONAL_DATA_KEY "lastname");
-  *name = gnomemeeting_create_fullname (firstname, lastname);
+  full_name = gm_conf_get_string (PERSONAL_DATA_KEY "full_name");
+  if (full_name)
+    *name = full_name;
 
-  g_free (firstname);
-  g_free (lastname);
   /* not freeing the full name is not a leak : dbus will do it for us ! */
 
   return TRUE;
@@ -309,5 +305,3 @@
   dbus_g_proxy_call_no_reply (proxy, "Show", G_TYPE_INVALID);
   g_object_unref (proxy);
 }
-
-// ex:set ts=2 sw=2 et:

Modified: trunk/src/endpoints/h323.h
==============================================================================
--- trunk/src/endpoints/h323.h	(original)
+++ trunk/src/endpoints/h323.h	Sat Jan 19 22:09:39 2008
@@ -88,7 +88,7 @@
 
 
   /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Set the local user name following the firstname and last 
+   * BEHAVIOR     :  Set the local user name following the full 
    *                 name stored by the conf, set the gatekeeper alias, 
    *                 possibly as first alias.
    * PRE          :  /

Modified: trunk/src/endpoints/manager.cpp
==============================================================================
--- trunk/src/endpoints/manager.cpp	(original)
+++ trunk/src/endpoints/manager.cpp	Sat Jan 19 22:09:39 2008
@@ -224,7 +224,7 @@
   /* Initialise the endpoint paramaters */
   video_grabber = NULL;
   SetCallingState (GMManager::Standby);
-  
+
 #ifdef HAVE_AVAHI
   zcp = NULL;
 #endif
@@ -262,13 +262,13 @@
   // Create endpoints
   h323EP = new GMH323Endpoint (*this);
   h323EP->Init ();
-  // AddRouteEntry("pc:.* = h323:<da>");
+  AddRouteEntry("pc:.* = h323:<da>");
 	
   sipEP = new GMSIPEndpoint (*this, core);
   AddRouteEntry("pc:.* = sip:<da>");
   
   pcssEP = new GMPCSSEndpoint (*this);
-// AddRouteEntry("h323:.* = pc:<da>");
+  AddRouteEntry("h323:.* = pc:<da>");
   AddRouteEntry("sip:.* = pc:<da>");
   
   autoStartTransmitVideo = autoStartReceiveVideo = true;
@@ -1301,33 +1301,22 @@
 void
 GMManager::SetUserNameAndAlias ()
 {
-  gchar *firstname = NULL;
-  gchar *lastname = NULL;
-  gchar *local_name = NULL;
-  
+  gchar *full_name = NULL;
   
   gnomemeeting_threads_enter ();
-  firstname = gm_conf_get_string (PERSONAL_DATA_KEY "firstname");
-  lastname = gm_conf_get_string (PERSONAL_DATA_KEY "lastname");
+  full_name = gm_conf_get_string (PERSONAL_DATA_KEY "full_name");
   gnomemeeting_threads_leave ();
 
-  
-  local_name = gnomemeeting_create_fullname (firstname, lastname);
-  if (local_name)
-    SetDefaultDisplayName (local_name);
-
+  if (full_name)
+    SetDefaultDisplayName (full_name);
   
   /* Update the H.323 endpoint user name and alias */
   h323EP->SetUserNameAndAlias ();
-
   
   /* Update the SIP endpoint user name and alias */
   sipEP->SetUserNameAndAlias ();
 
-
-  g_free (local_name);
-  g_free (firstname);
-  g_free (lastname);
+  g_free (full_name);
 }
 
 
@@ -1376,9 +1365,7 @@
   g_free (ip);
   
   /* GMConf notifiers for what we manager */
-  gm_conf_notifier_add (PERSONAL_DATA_KEY "firstname",
-			fullname_changed_nt, this);
-  gm_conf_notifier_add (PERSONAL_DATA_KEY "lastname",
+  gm_conf_notifier_add (PERSONAL_DATA_KEY "full_name",
 			fullname_changed_nt, this);
 
   gm_conf_notifier_add (PROTOCOLS_KEY "interface",

Modified: trunk/src/endpoints/opal-main.cpp
==============================================================================
--- trunk/src/endpoints/opal-main.cpp	(original)
+++ trunk/src/endpoints/opal-main.cpp	Sat Jan 19 22:09:39 2008
@@ -65,15 +65,15 @@
   Ekiga::CallCore *call_core = NULL;
   Ekiga::DisplayCore *display_core = NULL;
   
-  GMManager *manager = new GMManager (core);
-  GMSIPEndpoint *sipEP = manager->GetSIPEndpoint ();
   //GMDisplayManager *displayManager = new GMDisplayManager_X(core);
-
   contact_core = dynamic_cast<Ekiga::ContactCore *> (core.get ("contact-core"));
   presence_core = dynamic_cast<Ekiga::PresenceCore *> (core.get ("presence-core"));
   call_core = dynamic_cast<Ekiga::CallCore *> (core.get ("call-core"));
   display_core = dynamic_cast<Ekiga::DisplayCore *> (core.get ("display-core"));
 
+  GMManager *manager = new GMManager (core);
+  GMSIPEndpoint *sipEP = manager->GetSIPEndpoint ();
+
   call_core->add_manager (*manager);
   core.add (*manager); // FIXME temporary
 
@@ -87,6 +87,7 @@
     presence_core->add_presentity_decorator (*manager);
     presence_core->add_supported_uri (sigc::ptr_fun (is_sip_address));
     presence_core->add_presence_fetcher (*sipEP);
+    presence_core->add_presence_publisher (*sipEP);
   }
   else 
     return false;

Modified: trunk/src/endpoints/sip.cpp
==============================================================================
--- trunk/src/endpoints/sip.cpp	(original)
+++ trunk/src/endpoints/sip.cpp	Sat Jan 19 22:09:39 2008
@@ -150,7 +150,10 @@
 
 /* The class */
 GMSIPEndpoint::GMSIPEndpoint (GMManager & ep, Ekiga::ServiceCore & _core)
-: SIPEndPoint (ep), endpoint (ep), core (_core)
+: SIPEndPoint (ep), 
+    Ekiga::PresencePublisher (_core), 
+    endpoint (ep), 
+    core (_core)
 {
   NoAnswerTimer.SetNotifier (PCREATE_NOTIFIER (OnNoAnswerTimeout));
   Init ();
@@ -197,6 +200,15 @@
 
 
 void 
+GMSIPEndpoint::publish (const std::string & display_name,
+                        const std::string & presence,
+                        const std::string & extended_status)
+{
+  std::cout << "should publish" << display_name << std::endl << std::flush;
+}
+
+
+void 
 GMSIPEndpoint::Init ()
 {
   gchar *outbound_proxy_host = NULL;

Modified: trunk/src/endpoints/sip.h
==============================================================================
--- trunk/src/endpoints/sip.h	(original)
+++ trunk/src/endpoints/sip.h	Sat Jan 19 22:09:39 2008
@@ -53,7 +53,9 @@
 
 /* Minimal SIP endpoint implementation */
 class GMSIPEndpoint 
-: public SIPEndPoint, public Ekiga::PresenceFetcher
+:   public SIPEndPoint, 
+    public Ekiga::PresenceFetcher,
+    public Ekiga::PresencePublisher
 {
   PCLASSINFO(GMSIPEndpoint, SIPEndPoint);
 
@@ -76,6 +78,9 @@
   /***/
   void fetch (const std::string uri);
   void unfetch (const std::string uri);
+  void publish (const std::string & /*display_name*/,
+                const std::string & /*presence*/,
+                const std::string & /*extended_status*/);
 
   
   /* DESCRIPTION  :  /
@@ -89,7 +94,7 @@
 
   
   /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Set the local user name following the firstname and last 
+   * BEHAVIOR     :  Set the local user name following the full 
    *                 name stored by the conf.
    * PRE          :  /
    */

Modified: trunk/src/gui/assistant.cpp
==============================================================================
--- trunk/src/gui/assistant.cpp	(original)
+++ trunk/src/gui/assistant.cpp	Sat Jan 19 22:09:39 2008
@@ -235,35 +235,24 @@
 static void
 prepare_personal_data_page (EkigaAssistant *assistant)
 {
-  gchar *firstname;
-  gchar *lastname;
-  gchar *text;
+  gchar *full_name;
 
-  firstname = gm_conf_get_string (PERSONAL_DATA_KEY "firstname");
-  lastname = gm_conf_get_string (PERSONAL_DATA_KEY "lastname");
+  full_name = gm_conf_get_string (PERSONAL_DATA_KEY "full_name");
 
-  text = gnomemeeting_create_fullname (firstname, lastname);
-  if (text) {
-    gtk_entry_set_text (GTK_ENTRY (assistant->priv->name), text);
-    g_free (text);
-  }
+  if (full_name)
+    gtk_entry_set_text (GTK_ENTRY (assistant->priv->name), full_name);
 
-  g_free (firstname);
-  g_free (lastname);
+  g_free (full_name);
 }
 
 static void
 apply_personal_data_page (EkigaAssistant *assistant)
 {
   GtkEntry *entry = GTK_ENTRY (assistant->priv->name);
-  gchar **couple = g_strsplit (gtk_entry_get_text (entry), " ", 2);
-
-  if (couple && couple[0])
-    gm_conf_set_string (PERSONAL_DATA_KEY "firstname", couple[0]);
-  if (couple && couple[1])
-    gm_conf_set_string (PERSONAL_DATA_KEY "lastname", couple[1]);
+  const gchar *full_name = gtk_entry_get_text (entry);
 
-  g_free (couple);
+  if (full_name)
+    gm_conf_set_string (PERSONAL_DATA_KEY "full_name", full_name);
 }
 
 /******************

Modified: trunk/src/gui/misc.cpp
==============================================================================
--- trunk/src/gui/misc.cpp	(original)
+++ trunk/src/gui/misc.cpp	Sat Jan 19 22:09:39 2008
@@ -388,40 +388,3 @@
   g_free (size);
   g_free (conf_key_size);
 }
-
-
-gchar *
-gnomemeeting_create_fullname (const gchar *firstname, 
-			      const gchar *lastname)
-{
-  gchar *fullname = NULL;
-
-  if (firstname && lastname) {
-
-    const gchar* separator = NULL;
-
-    if (strcmp (firstname, "") && strcmp (lastname, ""))
-      separator = " ";
-    else
-      separator = "";
-
-    if (strcmp (firstname, "") || strcmp (lastname, ""))
-      fullname = g_strconcat (firstname, separator, lastname, NULL);
-
-  } 
-  else {
-
-    if (firstname && strcmp (firstname, ""))
-      fullname = g_strdup (firstname);
-
-    if (lastname && strcmp (lastname, ""))
-      fullname = g_strdup (lastname);
-
-  }
-
-  if (!fullname)
-    fullname = g_strdup (g_get_real_name ());
-
-  return fullname;
-}
-

Modified: trunk/src/gui/misc.h
==============================================================================
--- trunk/src/gui/misc.h	(original)
+++ trunk/src/gui/misc.h	Sat Jan 19 22:09:39 2008
@@ -146,17 +146,4 @@
 void gnomemeeting_window_get_size (GtkWidget *w, 
 				   int &x, 
 				   int &y);
-
-
-/* DESCRIPTION  :  Concatenates a firstname and a lastname into a fullname.
- * BEHAVIOR     :  If both parts are non NULL and non-empty, 
- * 		   they are concatenated with a space in-between, 
- * 		   else fullname becomes a copy of the nonempty part.
- *                 If both parts are NULL or have a zero length, 
- *                 returns NULL.
- * PRE          :  /
- */
-gchar *gnomemeeting_create_fullname (const gchar *firstname, 
-				     const gchar *lastname);
-
 #endif

Modified: trunk/src/gui/preferences.cpp
==============================================================================
--- trunk/src/gui/preferences.cpp	(original)
+++ trunk/src/gui/preferences.cpp	Sat Jan 19 22:09:39 2008
@@ -383,18 +383,12 @@
                                 _("Personal Information"), 2, 2);
 
   entry =
-    gnome_prefs_entry_new (subsection, _("_First name:"),
-                           PERSONAL_DATA_KEY "firstname",
+    gnome_prefs_entry_new (subsection, _("_Full name:"),
+                           PERSONAL_DATA_KEY "full_name",
                            _("Enter your first name"), 0, false);
   gtk_widget_set_size_request (GTK_WIDGET (entry), 250, -1);
   gtk_entry_set_max_length (GTK_ENTRY (entry), 65);
 
-  entry =
-    gnome_prefs_entry_new (subsection, _("Sur_name:"),
-                           PERSONAL_DATA_KEY "lastname",
-                           _("Enter your surname"), 1, false);
-  gtk_widget_set_size_request (GTK_WIDGET (entry), 250, -1);
-  gtk_entry_set_max_length (GTK_ENTRY (entry), 65);
   /* Add the update button */
   gm_pw_add_update_button (prefs_window, container, GTK_STOCK_APPLY, _("_Apply"), GTK_SIGNAL_FUNC (personal_data_update_cb), _("Click here to update the users directory you are registered to with the new First Name, Last Name, E-Mail, Comment and Location"), 0, prefs_window);
 }                                                                              



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