changeset 1218:ab5de2ed2b7e

Simplify entity_version()
author Mikael Berthe <mikael@lilotux.net>
date Tue, 08 May 2007 11:41:17 +0200
parents 21226969d59a
children 31f7ac73b82d
files mcabber/src/jab_iq.c
diffstat 1 files changed, 7 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/jab_iq.c	Tue May 08 11:04:32 2007 +0200
+++ b/mcabber/src/jab_iq.c	Tue May 08 11:41:17 2007 +0200
@@ -104,36 +104,22 @@
 
 //  entity_version()
 // Return a static version string for Entity Capabilities.
-// It should be specific to the client version, so we'll append
-// a random string if it's a dev version and there's no changeset, or
-// if it's been modified locally.
+// It should be specific to the client version, please change the id
+// if you alter mcabber's disco support (or add something to the version
+// number) so that it doesn't conflict with the official client.
 const char *entity_version(void)
 {
   static char *ver;
-  char *tver;
 
   if (ver)
     return ver;
 
 #ifdef HGCSET
-  tver = g_strdup_printf("%s-%s", PACKAGE_VERSION, HGCSET);
-  if (strlen(HGCSET) == 12)
-    ver = tver;
+  ver = g_strdup_printf("%s-%s", PACKAGE_VERSION, HGCSET);
 #else
-  tver = g_strdup(PACKAGE_VERSION);
-  if (!strcasestr(PACKAGE_VERSION, "-dev"))
-    ver = tver; // Official release
+  ver = g_strdup(PACKAGE_VERSION);
 #endif
 
-  // If this isn't an official release, or if the changeset shows the source
-  // code has been modified locally, we alter the release id.
-  if (!ver) {
-    unsigned int n;
-    srand(time(NULL));
-    n = (unsigned int)(10.0 + 6.0 * rand() / (RAND_MAX + 1.0));
-    ver = g_strdup_printf("%s~%x", tver, n);
-    g_free(tver);
-  }
   return ver;
 }
 
@@ -1316,6 +1302,8 @@
 // Add features attributes to ansquery.  If entitycaps is TRUE, assume
 // that we're answering an Entity Caps request (if not, the request was
 // a basic discovery query).
+// Please change the entity version string if you modify mcabber disco
+// source code, so that it doesn't conflict with the upstream client.
 static void disco_info_set_default(xmlnode ansquery, guint entitycaps)
 {
   xmlnode y;