From be6e49798b25434b72dd91bf501772fe88c0ec20 Mon Sep 17 00:00:00 2001 From: darkeye Date: Thu, 26 Apr 2007 08:32:56 +0000 Subject: [PATCH] reverted to old shoutcast login code, fixes #21 --- darkice/trunk/src/ShoutCast.cpp | 68 ++++++++++++++------------------- 1 file changed, 29 insertions(+), 39 deletions(-) diff --git a/darkice/trunk/src/ShoutCast.cpp b/darkice/trunk/src/ShoutCast.cpp index c146147..6bcc845 100644 --- a/darkice/trunk/src/ShoutCast.cpp +++ b/darkice/trunk/src/ShoutCast.cpp @@ -7,7 +7,7 @@ File : ShoutCast.cpp Version : $Revision$ Author : $Author$ - Location : $HeadURL$ + Location : $Source$ Copyright notice: @@ -162,27 +162,6 @@ ShoutCast :: sendLogin ( void ) throw ( Exception ) sink->write( str, strlen( str)); } - if ( getGenre() ) { - str = "\nicy-genre:"; - sink->write( str, strlen( str)); - str = getGenre(); - sink->write( str, strlen( str)); - } - - str = "\nicy-pub:"; - sink->write( str, strlen( str)); - str = getIsPublic() ? "1" : "0"; - sink->write( str, strlen( str)); - - str = "\nicy-br:"; - sink->write( str, strlen( str)); - if ( log10(getBitRate()) >= (STRBUF_SIZE-2) ) { - throw Exception( __FILE__, __LINE__, - "bitrate does not fit string buffer", getBitRate()); - } - sprintf( resp, "%d", getBitRate()); - sink->write( resp, strlen( resp)); - if ( getUrl() ) { str = "\nicy-url:"; sink->write( str, strlen( str)); @@ -190,6 +169,13 @@ ShoutCast :: sendLogin ( void ) throw ( Exception ) sink->write( str, strlen( str)); } + if ( getGenre() ) { + str = "\nicy-genre:"; + sink->write( str, strlen( str)); + str = getGenre(); + sink->write( str, strlen( str)); + } + if ( getIrc() ) { str = "\nicy-irc:"; sink->write( str, strlen( str)); @@ -197,13 +183,6 @@ ShoutCast :: sendLogin ( void ) throw ( Exception ) sink->write( str, strlen( str)); } - if ( getIcq() ) { - str = "\nicy-icq:"; - sink->write( str, strlen( str)); - str = getIcq(); - sink->write( str, strlen( str)); - } - if ( getAim() ) { str = "\nicy-aim:"; sink->write( str, strlen( str)); @@ -211,20 +190,31 @@ ShoutCast :: sendLogin ( void ) throw ( Exception ) sink->write( str, strlen( str)); } + if ( getIcq() ) { + str = "\nicy-icq:"; + sink->write( str, strlen( str)); + str = getIcq(); + sink->write( str, strlen( str)); + } + + str = "\nicy-br:"; + sink->write( str, strlen( str)); + if ( log10(getBitRate()) >= (STRBUF_SIZE-2) ) { + throw Exception( __FILE__, __LINE__, + "bitrate does not fit string buffer", getBitRate()); + } + sprintf( resp, "%d", getBitRate()); + sink->write( resp, strlen( resp)); + + str = "\nicy-pub:"; + sink->write( str, strlen( str)); + str = getIsPublic() ? "1" : "0"; + sink->write( str, strlen( str)); + str = "\n\n"; sink->write( str, strlen( str)); sink->flush(); - /* suck anything that the other side has to say */ - len = source->read( resp, STRBUF_SIZE); - reportEvent(8, "server response length: ", len); - reportEvent(8, "server response: ", resp); - - while ( source->canRead( 0, 0) && - (len = source->read( resp, STRBUF_SIZE)) ) { - ; - } - return true; }