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
* local-heap.h - description
29
* ------------------------------------------
30
* begin : written in 2007 by Julien Puydt
31
* copyright : (c) 2007 by Julien Puydt
32
* description : declaration of the heap for the local roster
37
#ifndef __LOCAL_HEAP_H__
38
#define __LOCAL_HEAP_H__
40
#include <libxml/tree.h>
42
#include "heap-impl.h"
43
#include "local-presentity.h"
49
* @addtogroup presence
55
* This class implements an Ekiga::Heap.
57
* The Heap is internally represented by an XML document with all
58
* presentities, and the groups they belong to.
60
* The parent class is responsible of emitting the appropriate
61
* signals defined in heap.h through the use of global implementations
62
* coded in heap-imp.h.
64
* When required, the Heap content is being saved in a GmConf entry.
65
* Alternatively, it could be saved elsewhere.
67
class Heap : public Ekiga::HeapImpl<Presentity>
72
* @param: The Ekiga::ServiceCore to use to trigger operations on other
75
Heap (Ekiga::ServiceCore &_core);
83
/** Return the name of the Heap. Inherits from Ekiga::Heap.
84
* @return: The name of the Heap.
86
const std::string get_name () const;
89
/** Populates the given Ekiga::MenuBuilder with the actions.
90
* Inherited from Ekiga::Heap.
91
* @param: A MenuBuilder.
92
* @return: A populated menu.
94
bool populate_menu (Ekiga::MenuBuilder &);
97
/** Populates the given Ekiga::MenuBuilder with the actions.
98
* Inherited from Ekiga::Heap.
99
* @param: The name of the group on which to act.
100
* @param: A MenuBuilder.
101
* @return: A populated menu.
103
bool populate_menu_for_group (const std::string name,
104
Ekiga::MenuBuilder& builder);
107
/** Determines if the given uri is already present in the Heap.
108
* @param: A string representing an uri.
109
* @return: TRUE if that uri is already present in the Heap.
111
bool has_presentity_with_uri (const std::string uri) const;
114
/** Returns the list of all groups already in used in the Heap.
115
* @return: A list of groups.
117
const std::set<std::string> existing_groups () const;
120
/** This function should be called when a new presentity has
121
* to be added to the Heap. It uses a form with the known
122
* fields already filled in.
123
* @param: The name and uri of the presentity.
124
* @return: TRUE if that uri is already present in the Heap.
126
void new_presentity (const std::string name,
127
const std::string uri);
132
/** Build a presentity with the given name, uri
133
* and groups, add it to the internal XML document
134
* and calls common_add for that presentity.
136
void add (const std::string name,
137
const std::string uri,
138
const std::set<std::string> groups);
141
/** Build a presentity pointed by the xmlNodePtr
142
* to the internal XML document and calls common_add.
143
* The internal XML document is supposed to be up
146
void add (xmlNodePtr node);
149
/** Add the Presentity to the Ekiga::Heap.
151
* This will trigger the 'presentity_added' signal,
152
* and connect it to the public Ekiga::Heap 'removed'
153
* and 'updated' signals.
155
* It will also ask the PresenceCore to fetch presence
156
* information for the newly added presentity.
158
* It will also connect the GmConf::Presentity
159
* 'save' and 'remove' signals which are specific to the
160
* GmConf::Presentity to the save and remove methods.
162
* Those signals can be used by a GmConf::Presentity to
163
* signal it would like to trigger saving or
164
* removing of the Presentity from the Heap.
166
void common_add (Presentity &presentity);
169
/** Save the XML Document in the GmConf key.
174
/** This should be triggered when a new Presentity form
175
* built with new_presentity has been submitted.
177
* It does error checking and adds the Presentity to the
178
* Heap if everything is valid.
180
void new_presentity_form_submitted (Ekiga::Form &form);
182
/** Triggered when the user decides to rename a group.
183
* @param The group name
185
void on_rename_group (std::string name);
189
void rename_group_form_submitted (std::string old_name,
190
Ekiga::Form& result);
192
Ekiga::ServiceCore &core;
193
Ekiga::PresenceCore *presence_core;