git-svn-id: svn://db.shs.com.ru/libs@132 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
47
telegram_bot/execbot.h
Normal file
47
telegram_bot/execbot.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#ifndef EXECBOT_H
|
||||
#define EXECBOT_H
|
||||
|
||||
#include "telegrambotbase.h"
|
||||
#include <QProcess>
|
||||
|
||||
|
||||
class ExecBot : public TelegramBotBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ExecBot(QObject *parent = 0);
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
private:
|
||||
enum UserState {
|
||||
NotLogged,
|
||||
Password,
|
||||
Ready,
|
||||
CommandExec
|
||||
};
|
||||
struct UserCommand {
|
||||
uint user;
|
||||
QProcess * cmd;
|
||||
};
|
||||
|
||||
virtual QString loginMessage(uint id);
|
||||
virtual QString help();
|
||||
virtual bool loginUser(uint id, const QString & msg);
|
||||
virtual void messageFromUser(uint id, const QString & msg);
|
||||
void runCMD(UserCommand uc);
|
||||
|
||||
QMap<uint, UserState> sessions;
|
||||
QVector<ExecBot::UserCommand> run_commands;
|
||||
|
||||
private slots:
|
||||
void cmdRead();
|
||||
void cmdFinish(int code);
|
||||
void saveFile(TelegramBotAPI::File fl);
|
||||
|
||||
signals:
|
||||
|
||||
};
|
||||
|
||||
#endif // EXECBOT_H
|
||||
Reference in New Issue
Block a user