ekiga r7361 - in branches/gnome-2-24: . src/endpoints
- From: dsandras svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r7361 - in branches/gnome-2-24: . src/endpoints
- Date: Sat, 15 Nov 2008 20:19:28 +0000 (UTC)
Author: dsandras
Date: Sat Nov 15 20:19:28 2008
New Revision: 7361
URL: http://svn.gnome.org/viewvc/ekiga?rev=7361&view=rev
Log:
Fixed various problems with the initial notifications and empty ping back
notifications.
If we receive an initial notification with no status information,
then the user is offline. If we receive a notification with an empty
body then do not update the user status to offline or unknown because
it is just a ping from the server indicating no status change.
Modified:
branches/gnome-2-24/ChangeLog
branches/gnome-2-24/src/endpoints/sip-endpoint.cpp
branches/gnome-2-24/src/endpoints/sip-endpoint.h
Modified: branches/gnome-2-24/src/endpoints/sip-endpoint.cpp
==============================================================================
--- branches/gnome-2-24/src/endpoints/sip-endpoint.cpp (original)
+++ branches/gnome-2-24/src/endpoints/sip-endpoint.cpp Sat Nov 15 20:19:28 2008
@@ -390,7 +390,7 @@
data += "</tuple>\r\n";
data += "</presence>\r\n";
- Publish (to, data, 60); // TODO: allow to change the 500
+ Publish (to, data, 500); // TODO: allow to change the 500
}
}
@@ -1083,41 +1083,49 @@
PCaselessString b = basic;
PCaselessString s = note;
- std::string status;
std::string presence = "unknown";
+ std::string status;
- if (basic.IsEmpty () && note.IsEmpty ())
- return;
-
- if (b.Find ("Open") != P_MAX_INDEX)
- presence = "online";
- else
- presence = "offline";
-
- if (s.Find ("Away") != P_MAX_INDEX)
- presence = "away";
- else if (s.Find ("On the phone") != P_MAX_INDEX
- || s.Find ("Ringing") != P_MAX_INDEX)
- presence = "inacall";
- else if (s.Find ("dnd") != P_MAX_INDEX
- || s.Find ("Do Not Disturb") != P_MAX_INDEX)
- presence = "dnd";
-
- else if (s.Find ("Free For Chat") != P_MAX_INDEX)
- presence = "freeforchat";
+ if (!basic.IsEmpty () && !note.IsEmpty ()) {
- if ((j = s.Find (" - ")) != P_MAX_INDEX)
- status = (const char *) note.Mid (j + 3);
+ if (b.Find ("Open") != P_MAX_INDEX)
+ presence = "online";
+ else
+ presence = "offline";
+
+ if (s.Find ("Away") != P_MAX_INDEX)
+ presence = "away";
+ else if (s.Find ("On the phone") != P_MAX_INDEX
+ || s.Find ("Ringing") != P_MAX_INDEX)
+ presence = "inacall";
+ else if (s.Find ("dnd") != P_MAX_INDEX
+ || s.Find ("Do Not Disturb") != P_MAX_INDEX)
+ presence = "dnd";
+
+ else if (s.Find ("Free For Chat") != P_MAX_INDEX)
+ presence = "freeforchat";
+
+ if ((j = s.Find (" - ")) != P_MAX_INDEX)
+ status = (const char *) note.Mid (j + 3);
+ }
SIPURL sip_uri = SIPURL (user);
sip_uri.Sanitise (SIPURL::ExternalURI);
std::string _uri = sip_uri.AsString ();
+ std::string old_presence = uri_presences[_uri];
+
+ // If first notification, and no information, then we are offline
+ if (presence == "unknown" && old_presence.empty ())
+ presence = "offline";
- /**
- * TODO
- * Wouldn't it be convenient to emit the signal and have the presence core listen to it ?
- */
- runtime.run_in_main (sigc::bind (sigc::ptr_fun (presence_status_in_main), this, _uri, presence, status));
+ // If presence change, then signal it to the various components
+ // If presence is unknown (notification with empty body), and it is not the
+ // first notification, and we can conclude it is a ping back from the server
+ // to indicate the presence status did not change, hence we do nothing.
+ if (presence != "unknown" && old_presence != presence) {
+ uri_presences[_uri] = presence;
+ runtime->run_in_main (sigc::bind (sigc::ptr_fun (presence_status_in_main), this, _uri, presence, status));
+ }
}
Modified: branches/gnome-2-24/src/endpoints/sip-endpoint.h
==============================================================================
--- branches/gnome-2-24/src/endpoints/sip-endpoint.h (original)
+++ branches/gnome-2-24/src/endpoints/sip-endpoint.h Sat Nov 15 20:19:28 2008
@@ -196,6 +196,8 @@
unsigned listen_port;
SIP::Dialect *dialect;
+
+ std::map<std::string, std::string> uri_presences;
};
};
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]