3
* Ekiga -- A VoIP and Video-Conferencing application
4
* Copyright (C) 2000-2007 Damien Sandras
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or (at
9
* your option) any later version. This program is distributed in the hope
10
* that it will be useful, but WITHOUT ANY WARRANTY; without even the
11
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
* See the GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License along
15
* with this program; if not, write to the Free Software Foundation, Inc.,
16
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
18
* Ekiga is licensed under the GPL license and as a special exception, you
19
* have permission to link or otherwise combine this program with the
20
* programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
21
* applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
22
* programs, as long as you do follow the requirements of the GNU GPL for all
23
* the rest of the software thus combined.
28
* contact-core.cpp - description
29
* ------------------------------------------
30
* begin : written in 2007 by Julien Puydt
31
* copyright : (c) 2007 by Julien Puydt
32
* description : implementation of the main contact managing object
40
#include "contact-core.h"
45
std::cout << "Search not implemented yet" << std::endl;
48
Ekiga::ContactCore::~ContactCore ()
53
Ekiga::ContactCore::populate_menu (MenuBuilder &builder)
55
bool populated = false;
57
builder.add_action ("search", _("_Find"), sigc::ptr_fun (on_search));
60
for (std::set<Source *>::const_iterator iter = sources.begin ();
61
iter != sources.end ();
65
builder.add_separator ();
66
populated = (*iter)->populate_menu (builder);
73
Ekiga::ContactCore::add_source (Source &source)
75
sources.insert (&source);
76
source_added.emit (source);
77
source.book_added.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::ContactCore::on_book_added), &source));
78
source.book_removed.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::ContactCore::on_book_removed), &source));
79
source.book_updated.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::ContactCore::on_book_updated), &source));
80
source.contact_added.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::ContactCore::on_contact_added), &source));
81
source.contact_removed.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::ContactCore::on_contact_removed), &source));
82
source.contact_updated.connect (sigc::bind (sigc::mem_fun (this, &Ekiga::ContactCore::on_contact_updated), &source));
83
source.questions.add_handler (questions.make_slot ());
87
Ekiga::ContactCore::visit_sources (sigc::slot<bool, Source &> visitor)
91
for (std::set<Source *>::iterator iter = sources.begin ();
92
iter != sources.end () && go_on;
94
go_on = visitor (*(*iter));
99
Ekiga::ContactCore::on_book_added (Book &book,
102
book_added.emit (*source, book);
107
Ekiga::ContactCore::on_book_removed (Book &book,
110
book_removed.emit (*source, book);
115
Ekiga::ContactCore::on_book_updated (Book &book,
118
book_updated.emit (*source, book);
123
Ekiga::ContactCore::on_contact_added (Book &book,
127
contact_added.emit (*source, book, contact);
132
Ekiga::ContactCore::on_contact_removed (Book &book,
136
contact_removed.emit (*source, book, contact);
141
Ekiga::ContactCore::on_contact_updated (Book &book,
145
contact_updated.emit (*source, book, contact);
150
Ekiga::ContactCore::add_contact_decorator (ContactDecorator &decorator)
152
contact_decorators.push_back (&decorator);
157
Ekiga::ContactCore::populate_contact_menu (Contact &contact,
158
const std::string uri,
159
MenuBuilder &builder)
161
bool populated = false;
163
for (std::list<ContactDecorator *>::const_iterator iter
164
= contact_decorators.begin ();
165
iter != contact_decorators.end ();
168
populated = (*iter)->populate_menu (contact, uri, builder) || populated;