From 8cb10e136ca182c3aaa9d17aea4f4ac308b18ca4 Mon Sep 17 00:00:00 2001 From: DarkWyrm Date: Sun, 14 May 2006 11:32:08 +0000 Subject: [PATCH] Fix build for all platforms and remove a hack git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17449 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/cdplayer/CDDBSupport.cpp | 35 +++++++++++-------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/src/apps/cdplayer/CDDBSupport.cpp b/src/apps/cdplayer/CDDBSupport.cpp index 40ca01ba22..ac0a85ff16 100644 --- a/src/apps/cdplayer/CDDBSupport.cpp +++ b/src/apps/cdplayer/CDDBSupport.cpp @@ -890,10 +890,19 @@ CDDBQuery::ReadLine(BString &buffer) status_t CDDBQuery::IdentifySelf() { - // TODO: Figure out a better way to do this for Zeta -#ifdef B_ZETA_VERSION + BString username,hostname; + + username = getenv("USER"); + hostname = getenv("HOSTNAME"); + + if(username.Length() < 1) + username = "baron"; + + if(hostname.Length() < 1) + hostname = "haiku"; + BString tmp; - tmp << "cddb hello simplyvorbis svhost SimplyVorbis v0.1\n"; + tmp << "cddb hello " << username << " " << hostname << " HaikuCDPlayer 1.0\n"; STRACE((">%s", tmp.String())); if(fSocket.Send(tmp.String(), tmp.Length())==-1) @@ -903,27 +912,7 @@ CDDBQuery::IdentifySelf() } ReadLine(tmp); -#else - char username[256]; - if (!getusername(username,256)) - strcpy(username, "unknown"); - char hostname[MAXHOSTNAMELEN + 1]; - if (gethostname(hostname, MAXHOSTNAMELEN) == -1) - strcpy(hostname, "unknown"); - - BString tmp; - tmp << "cddb hello " << username << " " << hostname << " SimplyVorbis v0.1\n"; - - STRACE((">%s", tmp.String())); - if(fSocket.Send(tmp.String(), tmp.Length())==-1) - { - Disconnect(); - return B_ERROR; - } - - ReadLine(tmp); -#endif return B_OK; }