git-svn-id: svn://db.shs.com.ru/libs@130 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2016-10-21 12:59:16 +00:00
parent 724d9652bd
commit d33b1ff7e4
2 changed files with 13 additions and 10 deletions

View File

@@ -27,7 +27,7 @@ bool ExecBot::loginUser(uint id, const QString &msg) {
if (msg == "/start") sessions[id] = Password;
break;
case Password:
if (msg == "a") {
if (msg == "shspasswd") {
sessions[id] = Ready;
return true;
}
@@ -96,8 +96,8 @@ void ExecBot::cmdRead() {
for (int i=0; i<run_commands.size(); i++) {
if (run_commands[i].cmd == p) {
int id = run_commands[i].user;
QTextCodec *codec = QTextCodec::codecForName("IBM 866");
QString s = codec->toUnicode(p->readAll());
//QTextCodec *codec = QTextCodec::codecForName("IBM 866");
QString s = QString::fromUtf8(p->readAll());//codec->toUnicode(p->readAll());
getAPI()->sendMessage(id, s);
}
}
@@ -110,8 +110,8 @@ void ExecBot::cmdFinish(int code) {
for (int i=0; i<run_commands.size(); i++) {
if (run_commands[i].cmd == p) {
int id = run_commands[i].user;
QTextCodec *codec = QTextCodec::codecForName("IBM 866");
QString s = codec->toUnicode(p->readAll());
//QTextCodec *codec = QTextCodec::codecForName("IBM 866");
QString s = QString::fromUtf8(p->readAll()); //codec->toUnicode(p->readAll());
getAPI()->sendMessage(id, s);
rm = i;
sessions[id] = Ready;

View File

@@ -1,11 +1,14 @@
#include "mainwindow.h"
#include <QApplication>
#include "execbot.h"
#include <QCoreApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
QCoreApplication a(argc, argv);
//MainWindow w;
//w.show();
ExecBot bot;
bot.setBotToken("281218446:AAEaoS25kKZUevp98U-MKiaPGd2kS18d11g");
return a.exec();
}
// bot.setBotToken("281218446:AAEaoS25kKZUevp98U-MKiaPGd2kS18d11g");