/***************************************************************************
 *   Copyright (C) 2006 by Jens Koehler                                    *
 *   irimi_at_gmx_de                                                       *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/

#ifndef __AMAROK_CLIENT__
#define __AMAROK_CLIENT__

#include <string>

#include "Sockets.h"
#include "commands.h"
#include "amarokData.h"



class AmarokClient
{


public:
    AmarokClient();
    virtual ~AmarokClient();

    bool login (const char *user, const char *pw);
    bool connect (const char * host, int port);

protected:


    bool command(const std::string &str_cmd);
    bool command(const std::string &str_cmd, AmarokData &data);
    bool handleAnswer(AmarokData &data);
    bool isConnected() const
    {
        return b_connected;
    };

    TCPClientStream *p_stream;


private:

    void waitforAnswer (int &cmd);
    void waitforAnswer (std::string &str);
    void sendCmd (const std::string &str);
    void sendCmd(const int anws);


    bool b_connected;

};



#endif /*__AMAROK_CLIENT__*/
