#ifndef APP_H #define APP_H #include #include #include #include #include class SshClient; class QTcpSocket; class QTcpServer; class Client; class ActiveClient; class App : public QCoreApplication { Q_OBJECT public: explicit App(int &argc, char **argv); ~App(); void print(const QString& msg); void broadcast(const QString& msg, int *serverCount, int *userCount); void broadcast(const QString& msg, ActiveClient* ignoredClient = 0); void requestBroadcast(const QString& type, const QString& user, const QString& server, const QString& message); void setReplyHash(const QString& serverAddress, const QString& hash); void incrementReplyCounters(const QString& hash, int userCount, int channelCount, int playerCount, int serverCount); void activeClientsReplyCounters(int *serverCount, int *playerCount, ActiveClient* ignoreClient = 0); const QStringList& lastMessages() const; protected: void timerEvent(QTimerEvent *e); private: QTcpSocket* mySocket; QTcpServer* myServer; bool mySocketConnectedFlag; SshClient* myQWNETSshClient; QList myClients; quint32 myCurrentClient; QSettings mySettings; int myClientsFrameTimerID; //timer for mainloop QStringList myLastMessages; void loadServerList(); void saveServerList(); void cleanup(); void addMessageToHistory(const QString& msg); /* TCP Server */ bool checkPassword(const QString& password); void addClient(const QString& host, quint16 port); void removeClient(const QString& host, quint16 port); void parseAddClientCommand(const QString& args); void parseRemoveClientCommand(const QString& args); void setTeam(const QString& team); void listClients(); void setColor(const QString& args); void setNick(const QString& args); void setPing(const QString& args); void help(); bool parseCommandLine(); private slots: /* TCP server */ void onDataArrival(); void onNewConnection(); void onDisconnection(); }; #endif // APP_H