~ubuntu-branches/ubuntu/karmic/ekiga/karmic

1.1.9 by Ken VanDine
Import upstream version 3.2.0
1
/* Ekiga -- A VoIP and Video-Conferencing application
2
 * Copyright (C) 2000-2009 Damien Sandras <dsandras@seconix.com>
3
 *
4
 * This program is free software; you can redistribute it and/or modify
5
 * it under the terms of the GNU General Public License as published by
6
 * the Free Software Foundation; either version 2 of the License, or
7
 * (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software Foundation,
16
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
17
 *
18
 *
19
 * Ekiga is licensed under the GPL license and as a special exception,
20
 * you have permission to link or otherwise combine this program with the
21
 * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
22
 * without applying the requirements of the GNU GPL to the OPAL, OpenH323
23
 * and PWLIB programs, as long as you do follow the requirements of the
24
 * GNU GPL for all the rest of the software thus combined.
25
 */
26
27
28
/*
29
 *                         avahi-main.cpp  -  description
30
 *                         ------------------------------------------
31
 *   begin                : written in 2007 by Julien Puydt
32
 *   copyright            : (c) 2007 by Julien Puydt
33
 *   description          : code to hook avahi into the main program
34
 *
35
 */
36
37
#include "avahi-main.h"
38
#include "presence-core.h"
39
#include "avahi-cluster.h"
40
41
struct AVAHISpark: public Ekiga::Spark
42
{
43
  AVAHISpark (): result(false)
44
  {}
45
46
  bool try_initialize_more (Ekiga::ServiceCore& core,
47
			    int* /*argc*/,
48
			    char** /*argv*/[])
49
  {
50
    gmref_ptr<Ekiga::Service> service = core.get ("avahi-core");
51
    gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
52
53
    if ( !service && presence_core) {
54
55
      gmref_ptr<Avahi::Cluster> cluster (new Avahi::Cluster (core));
56
      core.add (cluster);
57
      presence_core->add_cluster (cluster);
58
      result = true;
59
    }
60
61
    return result;
62
  }
63
64
  Ekiga::Spark::state get_state () const
65
  { return result?FULL:BLANK; }
66
67
  const std::string get_name () const
68
  { return "AVAHI"; }
69
70
  bool result;
71
};
72
73
void
74
avahi_init (Ekiga::KickStart& kickstart)
75
{
76
  gmref_ptr<Ekiga::Spark> spark(new AVAHISpark);
77
  kickstart.add_spark (spark);
78
}
79