ekiga r7322 - in trunk: lib/engine/chat/echo lib/engine/chat/skel lib/engine/presence/avahi lib/engine/presence/local-roster src/endpoints
- From: jpuydt svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r7322 - in trunk: lib/engine/chat/echo lib/engine/chat/skel lib/engine/presence/avahi lib/engine/presence/local-roster src/endpoints
- Date: Mon, 10 Nov 2008 21:35:54 +0000 (UTC)
Author: jpuydt
Date: Mon Nov 10 21:35:54 2008
New Revision: 7322
URL: http://svn.gnome.org/viewvc/ekiga?rev=7322&view=rev
Log:
Made the rest of non-gui presence-using code cope with the change
Modified:
trunk/lib/engine/chat/echo/echo-presentity.h
trunk/lib/engine/chat/echo/echo-simple.cpp
trunk/lib/engine/chat/echo/echo-simple.h
trunk/lib/engine/chat/skel/chat-multiple.h
trunk/lib/engine/chat/skel/chat-simple.h
trunk/lib/engine/presence/avahi/avahi-cluster.cpp
trunk/lib/engine/presence/avahi/avahi-cluster.h
trunk/lib/engine/presence/avahi/avahi-heap.cpp
trunk/lib/engine/presence/avahi/avahi-main.cpp
trunk/lib/engine/presence/local-roster/local-cluster.cpp
trunk/lib/engine/presence/local-roster/local-cluster.h
trunk/lib/engine/presence/local-roster/local-heap.cpp
trunk/lib/engine/presence/local-roster/local-heap.h
trunk/lib/engine/presence/local-roster/local-presentity.cpp
trunk/lib/engine/presence/local-roster/local-roster-bridge.cpp
trunk/lib/engine/presence/local-roster/local-roster-main.cpp
trunk/src/endpoints/h323-endpoint.cpp
trunk/src/endpoints/h323-endpoint.h
trunk/src/endpoints/sip-chat-simple.cpp
trunk/src/endpoints/sip-chat-simple.h
trunk/src/endpoints/sip-endpoint.cpp
trunk/src/endpoints/sip-endpoint.h
Modified: trunk/lib/engine/chat/echo/echo-presentity.h
==============================================================================
--- trunk/lib/engine/chat/echo/echo-presentity.h (original)
+++ trunk/lib/engine/chat/echo/echo-presentity.h Mon Nov 10 21:35:54 2008
@@ -36,6 +36,7 @@
#ifndef __ECHO_PRESENTITY__
#define __ECHO_PRESENTITY__
+#include "gmref.h"
#include "presentity.h"
namespace Echo
Modified: trunk/lib/engine/chat/echo/echo-simple.cpp
==============================================================================
--- trunk/lib/engine/chat/echo/echo-simple.cpp (original)
+++ trunk/lib/engine/chat/echo/echo-simple.cpp Mon Nov 10 21:35:54 2008
@@ -43,17 +43,15 @@
Echo::SimpleChat::~SimpleChat ()
{
- delete presentity;
-
#ifdef __GNUC__
std::cout << __PRETTY_FUNCTION__ << std::endl;
#endif
}
-Ekiga::Presentity&
+gmref_ptr<Ekiga::Presentity>
Echo::SimpleChat::get_presentity () const
{
- return *presentity;
+ return presentity;
}
bool
Modified: trunk/lib/engine/chat/echo/echo-simple.h
==============================================================================
--- trunk/lib/engine/chat/echo/echo-simple.h (original)
+++ trunk/lib/engine/chat/echo/echo-simple.h Mon Nov 10 21:35:54 2008
@@ -57,14 +57,14 @@
bool send_message (const std::string msg);
- Ekiga::Presentity &get_presentity () const;
+ gmref_ptr<Ekiga::Presentity> get_presentity () const;
bool populate_menu (Ekiga::MenuBuilder &builder);
private:
std::list<Ekiga::ChatObserver*> observers;
- Presentity *presentity;
+ gmref_ptr<Presentity> presentity;
};
};
Modified: trunk/lib/engine/chat/skel/chat-multiple.h
==============================================================================
--- trunk/lib/engine/chat/skel/chat-multiple.h (original)
+++ trunk/lib/engine/chat/skel/chat-multiple.h Mon Nov 10 21:35:54 2008
@@ -37,6 +37,8 @@
#ifndef __CHAT_MULTIPLE_H__
#define __CHAT_MULTIPLE_H__
+#include "gmref.h"
+
#include "chat.h"
#include "heap.h"
@@ -55,7 +57,7 @@
/** Returns the Heap associated with the MultipleChat.
* @return The MultipleChat's Heap
*/
- virtual Heap& get_heap () const = 0;
+ virtual gmref_ptr<Heap> get_heap () const = 0;
};
};
Modified: trunk/lib/engine/chat/skel/chat-simple.h
==============================================================================
--- trunk/lib/engine/chat/skel/chat-simple.h (original)
+++ trunk/lib/engine/chat/skel/chat-simple.h Mon Nov 10 21:35:54 2008
@@ -37,6 +37,8 @@
#ifndef __CHAT_SIMPLE_H__
#define __CHAT_SIMPLE_H__
+#include "gmref.h"
+
#include "chat.h"
#include "presentity.h"
@@ -55,7 +57,7 @@
/** Returns the Presentity associated with the SimpleChat.
* @return The SimpleChat's Presentity.
*/
- virtual Presentity &get_presentity () const = 0;
+ virtual gmref_ptr<Presentity> get_presentity () const = 0;
};
};
Modified: trunk/lib/engine/presence/avahi/avahi-cluster.cpp
==============================================================================
--- trunk/lib/engine/presence/avahi/avahi-cluster.cpp (original)
+++ trunk/lib/engine/presence/avahi/avahi-cluster.cpp Mon Nov 10 21:35:54 2008
@@ -43,7 +43,7 @@
heap = new Heap (core);
- add_heap (*heap);
+ add_heap (heap);
/* don't check the cast: it has been checked already by avahi-main!*/
presence_core->add_presence_fetcher (heap);
@@ -53,12 +53,6 @@
{
}
-void
-Avahi::Cluster::visit_heaps (sigc::slot<bool, Heap &> visitor)
-{
- (void)visitor (*heap);
-}
-
bool
Avahi::Cluster::populate_menu (Ekiga::MenuBuilder &/*builder*/)
{
Modified: trunk/lib/engine/presence/avahi/avahi-cluster.h
==============================================================================
--- trunk/lib/engine/presence/avahi/avahi-cluster.h (original)
+++ trunk/lib/engine/presence/avahi/avahi-cluster.h Mon Nov 10 21:35:54 2008
@@ -60,8 +60,6 @@
~Cluster ();
- void visit_heaps (sigc::slot<bool, Heap &> visitor);
-
bool populate_menu (Ekiga::MenuBuilder &builder);
/* this is a service */
@@ -75,7 +73,7 @@
private:
Ekiga::ServiceCore &core;
- Heap *heap;
+ gmref_ptr<Heap> heap;
};
/**
Modified: trunk/lib/engine/presence/avahi/avahi-heap.cpp
==============================================================================
--- trunk/lib/engine/presence/avahi/avahi-heap.cpp (original)
+++ trunk/lib/engine/presence/avahi/avahi-heap.cpp Mon Nov 10 21:35:54 2008
@@ -211,10 +211,10 @@
for (iterator iter = begin () ;
!found && iter != end ();
iter++)
- if ((*iter).get_name () == name) {
+ if ((*iter)->get_name () == name) {
found = true;
- (*iter).removed.emit ();
+ (*iter)->removed.emit ();
}
break;
case AVAHI_BROWSER_CACHE_EXHAUSTED:
@@ -254,7 +254,6 @@
std::string status;
bool already_known = false;
gchar *url = NULL;
- Ekiga::URIPresentity *presentity = NULL;
AvahiStringList *txt_tmp = NULL;
switch (event) {
@@ -288,11 +287,11 @@
iter != end ();
iter++) {
- if ((*iter).get_name () == name) {
+ if ((*iter)->get_name () == name) {
/* known contact has been updated */
- presence_received.emit ((*iter).get_uri (), presence);
- status_received.emit ((*iter).get_uri (), status);
+ presence_received.emit ((*iter)->get_uri (), presence);
+ status_received.emit ((*iter)->get_uri (), status);
already_known = true;
}
}
@@ -307,10 +306,11 @@
groups.insert (_("Neighbours"));
url = g_strdup_printf ("%s:neighbour %s:%d", broken[1], host_name, port);
- presentity = new Ekiga::URIPresentity (core, name, url, groups);
+ gmref_ptr<Ekiga::URIPresentity> presentity
+ = new Ekiga::URIPresentity (core, name, url, groups);
status_received.emit (url, status);
presence_received.emit (url, presence);
- add_presentity (*presentity);
+ add_presentity (presentity);
g_free (url);
}
g_strfreev (broken);
Modified: trunk/lib/engine/presence/avahi/avahi-main.cpp
==============================================================================
--- trunk/lib/engine/presence/avahi/avahi-main.cpp (original)
+++ trunk/lib/engine/presence/avahi/avahi-main.cpp Mon Nov 10 21:35:54 2008
@@ -51,7 +51,7 @@
gmref_ptr<Avahi::Cluster> cluster = new Avahi::Cluster (core);
core.add (cluster);
- presence_core->add_cluster (*cluster);
+ presence_core->add_cluster (cluster);
result = true;
}
Modified: trunk/lib/engine/presence/local-roster/local-cluster.cpp
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-cluster.cpp (original)
+++ trunk/lib/engine/presence/local-roster/local-cluster.cpp Mon Nov 10 21:35:54 2008
@@ -48,7 +48,7 @@
presence_core->presence_received.connect (sigc::mem_fun (this, &Local::Cluster::on_presence_received));
presence_core->status_received.connect (sigc::mem_fun (this, &Local::Cluster::on_status_received));
- add_heap (*heap);
+ add_heap (heap);
}
Local::Cluster::~Cluster ()
@@ -79,27 +79,26 @@
Local::Cluster::populate_menu (Ekiga::MenuBuilder& builder)
{
builder.add_action ("new", _("New contact"),
- sigc::bind (sigc::mem_fun (heap, &Local::Heap::new_presentity), "", ""));
+ sigc::mem_fun (this, &Local::Cluster::on_new_presentity));
+
return true;
}
void
+Local::Cluster::on_new_presentity ()
+{
+ heap->new_presentity ("", "");
+}
+
+void
Local::Cluster::on_presence_received (std::string uri,
std::string presence)
{
- for (Local::Heap::iterator iter = heap->begin ();
- iter != heap->end ();
- iter++)
- if (uri == iter->get_uri ())
- iter->set_presence (presence);
+ heap->push_presence (uri, presence);
}
void Local::Cluster::on_status_received (std::string uri,
std::string status)
{
- for (Local::Heap::iterator iter = heap->begin ();
- iter != heap->end ();
- iter++)
- if (uri == iter->get_uri ())
- iter->set_status (status);
+ heap->push_status (uri, status);
}
Modified: trunk/lib/engine/presence/local-roster/local-cluster.h
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-cluster.h (original)
+++ trunk/lib/engine/presence/local-roster/local-cluster.h Mon Nov 10 21:35:54 2008
@@ -72,13 +72,15 @@
const std::set<std::string> existing_groups () const;
- Heap &get_heap ()
- { return *heap; }
+ gmref_ptr<Heap> get_heap ()
+ { return heap; }
private:
Ekiga::ServiceCore &core;
- Heap *heap;
+ gmref_ptr<Heap> heap;
+
+ void on_new_presentity ();
void on_presence_received (std::string uri,
std::string presence);
Modified: trunk/lib/engine/presence/local-roster/local-heap.cpp
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-heap.cpp (original)
+++ trunk/lib/engine/presence/local-roster/local-heap.cpp Mon Nov 10 21:35:54 2008
@@ -129,29 +129,29 @@
bool
-Local::Heap::has_presentity_with_uri (const std::string uri) const
+Local::Heap::has_presentity_with_uri (const std::string uri)
{
bool result = false;
- for (const_iterator iter = begin ();
+ for (iterator iter = begin ();
iter != end () && result != true;
iter++)
- result = (iter->get_uri () == uri);
+ result = ((*iter)->get_uri () == uri);
return result;
}
const std::set<std::string>
-Local::Heap::existing_groups () const
+Local::Heap::existing_groups ()
{
std::set<std::string> result;
- for (const_iterator iter = begin ();
+ for (iterator iter = begin ();
iter != end ();
iter++) {
- std::set<std::string> groups = iter->get_groups ();
+ std::set<std::string> groups = (*iter)->get_groups ();
result.insert (groups.begin (), groups.end ());
}
@@ -209,17 +209,43 @@
}
+void
+Local::Heap::push_presence (const std::string uri,
+ const std::string presence)
+{
+ for (iterator iter = begin ();
+ iter != end ();
+ ++iter) {
+
+ if ((*iter)->get_uri () == uri)
+ (*iter)->set_presence (presence);
+ }
+}
+
+void
+Local::Heap::push_status (const std::string uri,
+ const std::string status)
+{
+ for (iterator iter = begin ();
+ iter != end ();
+ ++iter) {
+
+ if ((*iter)->get_uri () == uri)
+ (*iter)->set_status (status);
+ }
+}
+
+
+
/*
* Private API
*/
void
Local::Heap::add (xmlNodePtr node)
{
- Presentity *presentity = NULL;
-
- presentity = new Presentity (core, node);
+ gmref_ptr<Presentity> presentity = new Presentity (core, node);
- common_add (*presentity);
+ common_add (presentity);
}
@@ -228,21 +254,20 @@
const std::string uri,
const std::set<std::string> groups)
{
- Presentity *presentity = NULL;
xmlNodePtr root = NULL;
root = xmlDocGetRootElement (doc);
- presentity = new Presentity (core, name, uri, groups);
+ gmref_ptr<Presentity> presentity = new Presentity (core, name, uri, groups);
xmlAddChild (root, presentity->get_node ());
save ();
- common_add (*presentity);
+ common_add (presentity);
}
void
-Local::Heap::common_add (Presentity &presentity)
+Local::Heap::common_add (gmref_ptr<Presentity> presentity)
{
gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
@@ -250,10 +275,10 @@
add_presentity (presentity);
// Fetch presence
- presence_core->fetch_presence (presentity.get_uri ());
+ presence_core->fetch_presence (presentity->get_uri ());
// Connect the Local::Presentity signals.
- presentity.trigger_saving.connect (sigc::mem_fun (this, &Local::Heap::save));
+ presentity->trigger_saving.connect (sigc::mem_fun (this, &Local::Heap::save));
}
@@ -360,7 +385,7 @@
iter != end ();
++iter) {
- iter->rename_group (old_name, new_name);
+ (*iter)->rename_group (old_name, new_name);
}
}
} catch (Ekiga::Form::not_found) {
Modified: trunk/lib/engine/presence/local-roster/local-heap.h
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-heap.h (original)
+++ trunk/lib/engine/presence/local-roster/local-heap.h Mon Nov 10 21:35:54 2008
@@ -108,13 +108,13 @@
* @param: A string representing an uri.
* @return: TRUE if that uri is already present in the Heap.
*/
- bool has_presentity_with_uri (const std::string uri) const;
+ bool has_presentity_with_uri (const std::string uri);
/** Returns the list of all groups already in used in the Heap.
* @return: A list of groups.
*/
- const std::set<std::string> existing_groups () const;
+ const std::set<std::string> existing_groups ();
/** This function should be called when a new presentity has
@@ -127,6 +127,15 @@
const std::string uri);
+ /**
+ * These functions are called by the Local::Cluster to push
+ * presence&status information down.
+ */
+ void push_presence (const std::string uri,
+ const std::string presence);
+ void push_status (const std::string uri,
+ const std::string status);
+
private:
/** Build a presentity with the given name, uri
@@ -163,7 +172,7 @@
* signal it would like to trigger saving or
* removing of the Presentity from the Heap.
*/
- void common_add (Presentity &presentity);
+ void common_add (gmref_ptr<Presentity> presentity);
/** Save the XML Document in the GmConf key.
Modified: trunk/lib/engine/presence/local-roster/local-presentity.cpp
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-presentity.cpp (original)
+++ trunk/lib/engine/presence/local-roster/local-presentity.cpp Mon Nov 10 21:35:54 2008
@@ -188,7 +188,7 @@
bool populated = false;
gmref_ptr<Ekiga::PresenceCore> presence_core = core.get ("presence-core");
- populated = presence_core->populate_presentity_menu (*this, uri, builder);
+ populated = presence_core->populate_presentity_menu (this, uri, builder);
if (populated)
builder.add_separator ();
Modified: trunk/lib/engine/presence/local-roster/local-roster-bridge.cpp
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-roster-bridge.cpp (original)
+++ trunk/lib/engine/presence/local-roster/local-roster-bridge.cpp Mon Nov 10 21:35:54 2008
@@ -54,7 +54,7 @@
{
public:
- ContactDecorator (Cluster &_cluster): cluster(_cluster)
+ ContactDecorator (gmref_ptr<Cluster> _cluster): cluster(_cluster)
{}
~ContactDecorator ()
@@ -73,7 +73,7 @@
private:
- Cluster &cluster;
+ gmref_ptr<Cluster> cluster;
};
};
@@ -85,14 +85,14 @@
{
bool populated = false;
- if (cluster.is_supported_uri (uri)) {
+ if (cluster->is_supported_uri (uri)) {
- Heap& heap = cluster.get_heap ();
+ gmref_ptr<Heap> heap = cluster->get_heap ();
- if (!heap.has_presentity_with_uri (uri)) {
+ if (!heap->has_presentity_with_uri (uri)) {
builder.add_action ("add", _("Add to local roster"),
- sigc::bind (sigc::mem_fun (heap, &Local::Heap::new_presentity),
+ sigc::bind (sigc::mem_fun (&*heap, &Local::Heap::new_presentity),
contact->get_name (), uri));
populated = true;
}
@@ -116,7 +116,7 @@
if (cluster && contact_core) {
gmref_ptr<Local::ContactDecorator> decorator
- = new Local::ContactDecorator (*cluster);
+ = new Local::ContactDecorator (cluster);
core.add (decorator);
contact_core->add_contact_decorator (decorator);
result = true;
Modified: trunk/lib/engine/presence/local-roster/local-roster-main.cpp
==============================================================================
--- trunk/lib/engine/presence/local-roster/local-roster-main.cpp (original)
+++ trunk/lib/engine/presence/local-roster/local-roster-main.cpp Mon Nov 10 21:35:54 2008
@@ -51,7 +51,7 @@
gmref_ptr<Local::Cluster> cluster = new Local::Cluster (core);
core.add (cluster);
- presence_core->add_cluster (*cluster);
+ presence_core->add_cluster (cluster);
result = true;
}
Modified: trunk/src/endpoints/h323-endpoint.cpp
==============================================================================
--- trunk/src/endpoints/h323-endpoint.cpp (original)
+++ trunk/src/endpoints/h323-endpoint.cpp Mon Nov 10 21:35:54 2008
@@ -112,11 +112,11 @@
}
-bool Opal::H323::EndPoint::populate_menu (Ekiga::Presentity& presentity,
+bool Opal::H323::EndPoint::populate_menu (gmref_ptr<Ekiga::Presentity> presentity,
const std::string uri,
- Ekiga::MenuBuilder & builder)
+ Ekiga::MenuBuilder& builder)
{
- return menu_builder_add_actions (presentity.get_name (), uri, builder);
+ return menu_builder_add_actions (presentity->get_name (), uri, builder);
}
Modified: trunk/src/endpoints/h323-endpoint.h
==============================================================================
--- trunk/src/endpoints/h323-endpoint.h (original)
+++ trunk/src/endpoints/h323-endpoint.h Mon Nov 10 21:35:54 2008
@@ -69,7 +69,7 @@
const std::string uri,
Ekiga::MenuBuilder &builder);
- bool populate_menu (Ekiga::Presentity& presentity,
+ bool populate_menu (gmref_ptr<Ekiga::Presentity> presentity,
const std::string uri,
Ekiga::MenuBuilder & builder);
Modified: trunk/src/endpoints/sip-chat-simple.cpp
==============================================================================
--- trunk/src/endpoints/sip-chat-simple.cpp (original)
+++ trunk/src/endpoints/sip-chat-simple.cpp Mon Nov 10 21:35:54 2008
@@ -52,7 +52,6 @@
SIP::SimpleChat::~SimpleChat ()
{
presentity->removed.emit ();
- delete presentity;
}
const std::string
@@ -116,10 +115,10 @@
(*iter)->notice (msg);
}
-Ekiga::Presentity&
+gmref_ptr<Ekiga::Presentity>
SIP::SimpleChat::get_presentity () const
{
- return *presentity;
+ return presentity;
}
bool
Modified: trunk/src/endpoints/sip-chat-simple.h
==============================================================================
--- trunk/src/endpoints/sip-chat-simple.h (original)
+++ trunk/src/endpoints/sip-chat-simple.h Mon Nov 10 21:35:54 2008
@@ -67,7 +67,7 @@
void receive_notice (const std::string msg);
- Ekiga::Presentity &get_presentity () const;
+ gmref_ptr<Ekiga::Presentity> get_presentity () const;
bool populate_menu (Ekiga::MenuBuilder& builder);
@@ -76,7 +76,7 @@
Ekiga::ServiceCore& core;
sigc::slot<bool, std::string> sender;
std::list<Ekiga::ChatObserver*> observers;
- Ekiga::Presentity *presentity;
+ gmref_ptr<Ekiga::Presentity> presentity;
std::string uri;
};
};
Modified: trunk/src/endpoints/sip-endpoint.cpp
==============================================================================
--- trunk/src/endpoints/sip-endpoint.cpp (original)
+++ trunk/src/endpoints/sip-endpoint.cpp Mon Nov 10 21:35:54 2008
@@ -183,11 +183,11 @@
}
-bool Opal::Sip::EndPoint::populate_menu (Ekiga::Presentity& presentity,
+bool Opal::Sip::EndPoint::populate_menu (gmref_ptr<Ekiga::Presentity> presentity,
const std::string uri,
- Ekiga::MenuBuilder & builder)
+ Ekiga::MenuBuilder& builder)
{
- return menu_builder_add_actions (presentity.get_name (), uri, builder);
+ return menu_builder_add_actions (presentity->get_name (), uri, builder);
}
Modified: trunk/src/endpoints/sip-endpoint.h
==============================================================================
--- trunk/src/endpoints/sip-endpoint.h (original)
+++ trunk/src/endpoints/sip-endpoint.h Mon Nov 10 21:35:54 2008
@@ -81,7 +81,7 @@
const std::string uri,
Ekiga::MenuBuilder &builder);
- bool populate_menu (Ekiga::Presentity& presentity,
+ bool populate_menu (gmref_ptr<Ekiga::Presentity> presentity,
const std::string uri,
Ekiga::MenuBuilder & builder);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]