[ekiga] Added an opal presence manager



commit b87b0ca244df76213792734ae57f6cdf788e435a
Author: Snark <jpuydt gnome org>
Date:   Thu Dec 23 21:29:24 2010 +0100

    Added an opal presence manager
    
    It currently only handles publishing of self-presence, and not perfectly

 lib/Makefile.am                                    |    2 +
 lib/engine/components/opal/opal-main.cpp           |    8 ++-
 .../components/opal/opal-presence-manager.cpp      |   51 ++++++++++++++++
 lib/engine/components/opal/opal-presence-manager.h |   61 ++++++++++++++++++++
 4 files changed, 119 insertions(+), 3 deletions(-)
---
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 7f3e00a..e894fb6 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -501,6 +501,8 @@ libekiga_la_SOURCES += \
 	$(components_dir)/opal/opal-bank.cpp \
 	$(components_dir)/opal/opal-call.h \
 	$(components_dir)/opal/opal-call.cpp \
+	$(components_dir)/opal/opal-presence-manager.h \
+	$(components_dir)/opal/opal-presence-manager.cpp \
 	$(components_dir)/opal/opal-codec-description.h \
 	$(components_dir)/opal/opal-codec-description.cpp \
 	$(components_dir)/opal/opal-gmconf-bridge.h \
diff --git a/lib/engine/components/opal/opal-main.cpp b/lib/engine/components/opal/opal-main.cpp
index 9ba1428..3f8ca8b 100644
--- a/lib/engine/components/opal/opal-main.cpp
+++ b/lib/engine/components/opal/opal-main.cpp
@@ -55,6 +55,7 @@
 #include "opal-bank.h"
 #include "opal-call-manager.h"
 #include "opal-plugins-hook.h"
+#include "opal-presence-manager.h"
 
 #include "sip-endpoint.h"
 #define SIP_KEY "/apps/" PACKAGE_NAME "/protocols/sip/"
@@ -103,7 +104,7 @@ struct OPALSpark: public Ekiga::Spark
     boost::shared_ptr<Ekiga::AudioOutputCore> audiooutput_core = core.get<Ekiga::AudioOutputCore> ("audiooutput-core");
     boost::shared_ptr<Ekiga::VideoOutputCore> videooutput_core = core.get<Ekiga::VideoOutputCore> ("videooutput-core");
     boost::shared_ptr<Ekiga::PersonalDetails> personal_details = core.get<Ekiga::PersonalDetails> ("personal-details");
-    Ekiga::ServicePtr account_store = core.get ("opal-account-store");
+    boost::shared_ptr<Bank> account_store = core.get<Bank> ("opal-account-store");
     Ekiga::ServicePtr sip_endpoint = core.get ("opal-sip-endpoint");
 
     if (contact_core && presence_core && call_core && chat_core
@@ -114,8 +115,8 @@ struct OPALSpark: public Ekiga::Spark
       hook_ekiga_plugins_to_opal (core);
 
       boost::shared_ptr<CallManager> call_manager (new CallManager (core));
-
-      boost::shared_ptr<Opal::Bank> bank (new Bank (core));
+      boost::shared_ptr<Bank> bank (new Bank (core));
+      boost::shared_ptr<PresenceManager> presence_manager (new PresenceManager (bank));
 
       account_core->add_bank (bank);
       core.add (bank);
@@ -128,6 +129,7 @@ struct OPALSpark: public Ekiga::Spark
       presence_core->add_presentity_decorator (sip_manager);
       presence_core->add_presence_fetcher (sip_manager);
       presence_core->add_presence_publisher (sip_manager);
+      presence_core->add_presence_publisher (presence_manager);
       core.add (sip_manager);
 
 #ifdef HAVE_H323
diff --git a/lib/engine/components/opal/opal-presence-manager.cpp b/lib/engine/components/opal/opal-presence-manager.cpp
new file mode 100644
index 0000000..e710e86
--- /dev/null
+++ b/lib/engine/components/opal/opal-presence-manager.cpp
@@ -0,0 +1,51 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2010 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+ *                         opal-presence-manager.cpp  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2010 by Julien Puydt
+ *   copyright            : (c) 2010 by Julien Puydt
+ *   description          : code to manage presence with opal accounts
+ *
+ */
+
+#include "opal-presence-manager.h"
+
+Opal::PresenceManager::PresenceManager (boost::shared_ptr<Opal::Bank> bank_): bank(bank_)
+{
+}
+
+void
+Opal::PresenceManager::publish (const Ekiga::PersonalDetails& details)
+{
+  for (Opal::Bank::iterator iter = bank->begin ();
+       iter != bank->end ();
+       iter++)
+    (*iter)->publish (details);
+}
diff --git a/lib/engine/components/opal/opal-presence-manager.h b/lib/engine/components/opal/opal-presence-manager.h
new file mode 100644
index 0000000..49d1007
--- /dev/null
+++ b/lib/engine/components/opal/opal-presence-manager.h
@@ -0,0 +1,61 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2010 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+ *                         opal-presence-manager.h  -  description
+ *                         ------------------------------------------
+ *   begin                : written in 2010 by Julien Puydt
+ *   copyright            : (c) 2010 by Julien Puydt
+ *   description          : code to manage presence with opal accounts
+ *
+ */
+
+#ifndef __OPAL_PRESENCE_MANAGER_H__
+#define __OPAL_PRESENCE_MANAGER_H__
+
+#include "presence-core.h"
+
+#include "opal-bank.h"
+
+namespace Opal {
+
+  class PresenceManager: public Ekiga::PresencePublisher
+  {
+  public:
+
+    PresenceManager (boost::shared_ptr<Opal::Bank> bank_);
+
+    void publish (const Ekiga::PersonalDetails& details);
+
+  private:
+
+    boost::shared_ptr<Opal::Bank> bank;
+  };
+};
+
+#endif



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