From b1f97cc2b2d60e9088e745983fe4960d12301ab3 Mon Sep 17 00:00:00 2001 From: mdb Date: Mon, 23 Oct 2000 07:37:43 +0000 Subject: [PATCH] Fixed up the version number reporting. git-svn-id: https://samskivert.googlecode.com/svn/trunk@6 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- .../java/com/samskivert/net/cddb/CDDB.java | 28 +++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/projects/samskivert/src/java/com/samskivert/net/cddb/CDDB.java b/projects/samskivert/src/java/com/samskivert/net/cddb/CDDB.java index d213b8b4..8c54ec12 100644 --- a/projects/samskivert/src/java/com/samskivert/net/cddb/CDDB.java +++ b/projects/samskivert/src/java/com/samskivert/net/cddb/CDDB.java @@ -1,5 +1,5 @@ // -// $Id: CDDB.java,v 1.2 2000/10/23 07:32:12 mdb Exp $ +// $Id: CDDB.java,v 1.3 2000/10/23 07:37:43 mdb Exp $ package com.samskivert.net.cddb; @@ -8,6 +8,7 @@ import java.net.InetAddress; import java.net.Socket; import java.net.SocketException; import java.util.ArrayList; +import java.util.StringTokenizer; /** * The CDDB class provides access to the information provided by servers @@ -23,10 +24,14 @@ public class CDDB public static final int STANDARD_PORT = 888; /** - * The client name and version reported to the CDDB server. + * The client name reported to the CDDB server. */ - public static final String CLIENT_NAME_AND_VERSION = - "TSP/CDDB_client $Revision: 1.2 $"; + public static final String CLIENT_NAME = "TSP/CDDB_client"; + + /** + * The client version reported to the CDDB server. + */ + public static String CLIENT_VERSION; // assigned during static init public class Entry { @@ -138,7 +143,8 @@ public class CDDB StringBuffer req = new StringBuffer("cddb hello "); req.append(username).append(" "); req.append(localhost).append(" "); - req.append(CLIENT_NAME_AND_VERSION); + req.append(CLIENT_NAME).append(" "); + req.append(CLIENT_VERSION); Response rsp = request(req.toString()); @@ -466,6 +472,18 @@ public class CDDB return rsp; } + /** + * The client version number is extracted from the version control + * revision of this file from a string that is managed by the version + * control system. + */ + static + { + StringTokenizer tok = new StringTokenizer("$Revision: 1.3 $"); + tok.nextToken(); + CLIENT_VERSION = tok.nextToken(); + } + protected Socket _sock; protected DataInputStream _in; protected PrintStream _out;