[ekiga] Made the loudmouth code use the kickstart scheme



commit 81fae86b6f2e3cd81e3b4fc2fb40ecbe1cf726e6
Author: Julien Puydt <jpuydt noether localdomain>
Date:   Fri Jan 16 16:06:06 2009 +0100

    Made the loudmouth code use the kickstart scheme

 lib/engine/components/loudmouth/loudmouth-main.cpp |   54 +++++++++++++------
 lib/engine/components/loudmouth/loudmouth-main.h   |    6 +--
 lib/engine/engine.cpp                              |    2 +-
 3 files changed, 40 insertions(+), 22 deletions(-)
---
diff --git a/lib/engine/components/loudmouth/loudmouth-main.cpp b/lib/engine/components/loudmouth/loudmouth-main.cpp
index f5f1479..330f2ea 100644
--- a/lib/engine/components/loudmouth/loudmouth-main.cpp
+++ b/lib/engine/components/loudmouth/loudmouth-main.cpp
@@ -44,26 +44,46 @@
 #include "loudmouth-cluster.h"
 #include "loudmouth-bank.h"
 
-bool
-loudmouth_init (Ekiga::ServiceCore &services,
-		int */*argc*/,
-		char **/*argv*/[])
+struct LOUDMOUTHSpark: public Ekiga::Spark
 {
-  bool result = false;
-  gmref_ptr<Ekiga::PresenceCore> presence (services.get ("presence-core"));
-  gmref_ptr<Ekiga::ChatCore> chat (services.get ("chat-core"));
-  gmref_ptr<Ekiga::PersonalDetails> details (services.get ("personal-details"));
+  LOUDMOUTHSpark (): result(false)
+  {}
 
-  if (presence && chat && details) {
+  bool try_initialize_more (Ekiga::ServiceCore& core,
+			    int* /*argc*/,
+			    char** /*argv*/[])
+  {
+    gmref_ptr<Ekiga::Service> service(core.get ("loudmouth-bank"));
+    gmref_ptr<Ekiga::PresenceCore> presence (core.get ("presence-core"));
+    gmref_ptr<Ekiga::ChatCore> chat (core.get ("chat-core"));
+    gmref_ptr<Ekiga::PersonalDetails> details (core.get ("personal-details"));
 
-    gmref_ptr<LM::Dialect> dialect(new LM::Dialect);
-    gmref_ptr<LM::Cluster> cluster(new LM::Cluster);
-    gmref_ptr<LM::Bank> bank (new LM::Bank (details, dialect, cluster));
-    services.add (bank);
-    chat->add_dialect (dialect);
-    presence->add_cluster (cluster);
-    result = true;
+    if ( !service && presence && chat && details) {
+
+      gmref_ptr<LM::Dialect> dialect(new LM::Dialect);
+      gmref_ptr<LM::Cluster> cluster(new LM::Cluster);
+      gmref_ptr<LM::Bank> bank (new LM::Bank (details, dialect, cluster));
+      core.add (bank);
+      chat->add_dialect (dialect);
+      presence->add_cluster (cluster);
+      result = true;
+    }
+
+    return result;
   }
 
-  return result;
+  Ekiga::Spark::state get_state () const
+  { return result?FULL:BLANK; }
+
+  const std::string get_name () const
+  { return "LOUDMOUTH"; }
+
+  bool result;
+};
+
+void
+loudmouth_init (Ekiga::KickStart& kickstart)
+{
+  gmref_ptr<Ekiga::Spark> spark(new LOUDMOUTHSpark);
+  kickstart.add_spark (spark);
 }
diff --git a/lib/engine/components/loudmouth/loudmouth-main.h b/lib/engine/components/loudmouth/loudmouth-main.h
index 0b851d3..08e73d7 100644
--- a/lib/engine/components/loudmouth/loudmouth-main.h
+++ b/lib/engine/components/loudmouth/loudmouth-main.h
@@ -38,10 +38,8 @@
 #ifndef __LOUDMOUTH_MAIN_H__
 #define __LOUDMOUTH_MAIN_H__
 
-#include "services.h"
+#include "kickstart.h"
 
-bool loudmouth_init (Ekiga::ServiceCore &services,
-		     int *argc,
-		     char **argv[]);
+void loudmouth_init (Ekiga::KickStart& kickstart);
 
 #endif
diff --git a/lib/engine/engine.cpp b/lib/engine/engine.cpp
index 7366c3e..426ddc1 100644
--- a/lib/engine/engine.cpp
+++ b/lib/engine/engine.cpp
@@ -279,7 +279,7 @@ engine_init (int argc,
   local_roster_bridge_init (kickstart);
 
 #ifdef HAVE_LOUDMOUTH
-  loudmouth_init (*service_core, &argc, &argv);
+  loudmouth_init (kickstart);
 #endif
 
   plugin_init (kickstart);



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