[ekiga] Fixed several problems with presence publication.
- From: Damien Sandras <dsandras src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [ekiga] Fixed several problems with presence publication.
- Date: Sat, 24 Oct 2009 16:38:52 +0000 (UTC)
commit c462e06c1b686e47c3a618016090bc0d7bc24bf6
Author: Damien Sandras <dsandras seconix com>
Date: Sat Oct 24 18:37:33 2009 +0200
Fixed several problems with presence publication.
We publish our status each time an account is registered, but :
- we should not publish already published presence
- we should not publish presence for accounts in the 'subscribing' state
lib/engine/components/opal/opal-account.cpp | 4 +---
lib/engine/components/opal/sip-endpoint.cpp | 13 ++++++++-----
lib/engine/components/opal/sip-endpoint.h | 2 ++
3 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/lib/engine/components/opal/opal-account.cpp b/lib/engine/components/opal/opal-account.cpp
index a3f238a..5ef1ed1 100644
--- a/lib/engine/components/opal/opal-account.cpp
+++ b/lib/engine/components/opal/opal-account.cpp
@@ -484,10 +484,8 @@ Opal::Account::handle_registration_event (RegistrationState state_,
status = _("Registered");
boost::shared_ptr<Ekiga::PresenceCore> presence_core = core.get<Ekiga::PresenceCore> ("presence-core");
boost::shared_ptr<Ekiga::PersonalDetails> personal_details = core.get<Ekiga::PersonalDetails> ("personal-details");
- if (presence_core && personal_details) {
-
+ if (presence_core && personal_details)
presence_core->publish (personal_details);
- }
state = state_;
updated ();
}
diff --git a/lib/engine/components/opal/sip-endpoint.cpp b/lib/engine/components/opal/sip-endpoint.cpp
index 2a5a897..d651c95 100644
--- a/lib/engine/components/opal/sip-endpoint.cpp
+++ b/lib/engine/components/opal/sip-endpoint.cpp
@@ -287,14 +287,14 @@ Opal::Sip::EndPoint::unfetch (const std::string uri)
void
Opal::Sip::EndPoint::publish (const Ekiga::PersonalDetails & details)
{
- std::map<std::string, PString> publishing;
+ std::map<std::string, PString> to_publish;
std::string hostname = (const char *) PIPSocket::GetHostName ();
std::string presence = ((Ekiga::PersonalDetails &) (details)).get_presence ();
std::string status = ((Ekiga::PersonalDetails &) (details)).get_status ();
for (PSafePtr<SIPHandler> handler = activeSIPHandlers.GetFirstHandler(); handler != NULL; ++handler) {
- if (handler->GetMethod() == SIP_PDU::Method_REGISTER) {
+ if (handler->GetMethod() == SIP_PDU::Method_REGISTER && handler->GetState () == SIPHandler::Subscribed) {
PString data;
std::string to = handler->GetAddressOfRecord ().AsString ().Mid (4);
@@ -331,12 +331,15 @@ Opal::Sip::EndPoint::publish (const Ekiga::PersonalDetails & details)
data += "</tuple>\r\n";
data += "</presence>\r\n";
- publishing[to]=data;
+ if (publications[to] != data) {
+ publications[to] = data;
+ to_publish[to] = data;
+ }
}
}
- for (std::map<std::string, PString>::const_iterator iter = publishing.begin ();
- iter != publishing.end ();
+ for (std::map<std::string, PString>::const_iterator iter = to_publish.begin ();
+ iter != to_publish.end ();
++iter)
Publish (iter->first, iter->second, 500); // TODO: allow to change the 500
}
diff --git a/lib/engine/components/opal/sip-endpoint.h b/lib/engine/components/opal/sip-endpoint.h
index 4edb81b..0262d6d 100644
--- a/lib/engine/components/opal/sip-endpoint.h
+++ b/lib/engine/components/opal/sip-endpoint.h
@@ -236,6 +236,8 @@ namespace Opal {
CallManager & manager;
Ekiga::ServiceCore & core;
+ std::map<std::string, PString> publications;
+
Ekiga::CallProtocolManager::Interface listen_iface;
std::string protocol_name;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]