git-svn-id: svn://db.shs.com.ru/libs@130 a8b55f48-bf90-11e4-a774-851b48703e85
This commit is contained in:
@@ -27,7 +27,7 @@ bool ExecBot::loginUser(uint id, const QString &msg) {
|
|||||||
if (msg == "/start") sessions[id] = Password;
|
if (msg == "/start") sessions[id] = Password;
|
||||||
break;
|
break;
|
||||||
case Password:
|
case Password:
|
||||||
if (msg == "a") {
|
if (msg == "shspasswd") {
|
||||||
sessions[id] = Ready;
|
sessions[id] = Ready;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -96,8 +96,8 @@ void ExecBot::cmdRead() {
|
|||||||
for (int i=0; i<run_commands.size(); i++) {
|
for (int i=0; i<run_commands.size(); i++) {
|
||||||
if (run_commands[i].cmd == p) {
|
if (run_commands[i].cmd == p) {
|
||||||
int id = run_commands[i].user;
|
int id = run_commands[i].user;
|
||||||
QTextCodec *codec = QTextCodec::codecForName("IBM 866");
|
//QTextCodec *codec = QTextCodec::codecForName("IBM 866");
|
||||||
QString s = codec->toUnicode(p->readAll());
|
QString s = QString::fromUtf8(p->readAll());//codec->toUnicode(p->readAll());
|
||||||
getAPI()->sendMessage(id, s);
|
getAPI()->sendMessage(id, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,8 +110,8 @@ void ExecBot::cmdFinish(int code) {
|
|||||||
for (int i=0; i<run_commands.size(); i++) {
|
for (int i=0; i<run_commands.size(); i++) {
|
||||||
if (run_commands[i].cmd == p) {
|
if (run_commands[i].cmd == p) {
|
||||||
int id = run_commands[i].user;
|
int id = run_commands[i].user;
|
||||||
QTextCodec *codec = QTextCodec::codecForName("IBM 866");
|
//QTextCodec *codec = QTextCodec::codecForName("IBM 866");
|
||||||
QString s = codec->toUnicode(p->readAll());
|
QString s = QString::fromUtf8(p->readAll()); //codec->toUnicode(p->readAll());
|
||||||
getAPI()->sendMessage(id, s);
|
getAPI()->sendMessage(id, s);
|
||||||
rm = i;
|
rm = i;
|
||||||
sessions[id] = Ready;
|
sessions[id] = Ready;
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include <QApplication>
|
#include "execbot.h"
|
||||||
|
#include <QCoreApplication>
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QCoreApplication a(argc, argv);
|
||||||
MainWindow w;
|
//MainWindow w;
|
||||||
w.show();
|
//w.show();
|
||||||
|
ExecBot bot;
|
||||||
|
bot.setBotToken("281218446:AAEaoS25kKZUevp98U-MKiaPGd2kS18d11g");
|
||||||
return a.exec();
|
return a.exec();
|
||||||
}
|
}
|
||||||
|
// bot.setBotToken("281218446:AAEaoS25kKZUevp98U-MKiaPGd2kS18d11g");
|
||||||
|
|||||||
Reference in New Issue
Block a user