void DatabaseLoginPanel::onItemClicked(QModelIndex const &oModelIndex)
{
	if(!oModelIndex.isValid())
		return;

	DatabaseLogin login;
	bool active;
	if(!mGUI->mLoginListView->selectionModel()->isRowSelected(oModelIndex.row(), QModelIndex()))
	{
		mCurrent = -1;
		clear();
		active = false;
	}
	else
	{
		mCurrent = oModelIndex.row();
		QVariant v = mModel->data(oModelIndex, Qt::UserRole);
		login = v.value<DatabaseLogin>();
		setLogin(login);
		active = true;
	}

	LoginEvent event(this, login, active);
	notifyLoginListeners(event);
}
Exemple #2
0
void dispatchEvent(Message* msg) {
	printMessage(msg);
	if (strcmp(msg->resource, "login") == 0) {
		if (strcmp(msg->method, "success") == 0) {
			setLogin(msg->body);
		} else if (strcmp(msg->method, "error") == 0) {
			printf("%s\n", msg->body);
		}
	} else if (strcmp(msg->resource, "register") == 0) {
		if (strcmp(msg->method, "success") == 0) {
			printf("User Registered Successfully, proceed to Log In\n");
		} else if (strcmp(msg->method, "error") == 0) {
			printf("%s\n", msg->body);
		}
	} else if (strcmp(msg->resource, "client") == 0) {
		if (strcmp(msg->method, "success") == 0) {
			clientRegistered();
		}
	}else if(strcmp(msg->resource, "mail") == 0){
		if(strcmp(msg->method, "receive") == 0){
			recieveEmails(atoi(msg->body));
		}else if(strcmp(msg->method, "success") == 0){
			printf("%s\n", msg->body);
		}else if(strcmp(msg->method, "error") == 0){
			printf("%s\n", msg->body);
		}else if(strcmp(msg->method, "continue") == 0){
			printf("Continue with message\n");
		}
	}else if(strcmp(msg->resource, "user") == 0){
		if(strcmp(msg->method, "fee") == 0){
			printf("Tarifacion: %s\n", msg->body);
		}
	}
}
void NetworkAccount::readConfig(/*const*/ KConfig/*Base*/ & config)
{
    KMAccount::readConfig(config);

    setLogin(config.readEntry("login"));

    if(config.readNumEntry("store-passwd", false))        // ### s/Num/Bool/
    {
        mStorePasswd = true;
        QString encpasswd = config.readEntry("pass");
        if(encpasswd.isEmpty())
        {
            encpasswd = config.readEntry("passwd");
            if(!encpasswd.isEmpty()) encpasswd = importPassword(encpasswd);
        }

        if(!encpasswd.isEmpty())
        {
            setPasswd(decryptStr(encpasswd), true);
            // migrate to KWallet if available
            if(Wallet::isEnabled())
            {
                config.deleteEntry("pass");
                config.deleteEntry("passwd");
                mPasswdDirty = true;
                mStorePasswdInConfig = false;
            }
            else
            {
                mPasswdDirty = false; // set by setPasswd() on first read
                mStorePasswdInConfig = true;
            }
        }
        else
        {
            // read password if wallet is already open, otherwise defer to on-demand loading
            if(Wallet::isOpen(Wallet::NetworkWallet()))
                readPassword();
        }

    }
    else
    {
        setPasswd("", false);
    }

    setHost(config.readEntry("host"));

    unsigned int port = config.readUnsignedNumEntry("port", defaultPort());
    if(port > USHRT_MAX) port = defaultPort();
    setPort(port);

    setAuth(config.readEntry("auth", "*"));
    setUseSSL(config.readBoolEntry("use-ssl", false));
    setUseTLS(config.readBoolEntry("use-tls", false));

    mSieveConfig.readConfig(config);
}
Exemple #4
0
BOT_INFO::BOT_INFO()
{
	setLogin("Bobo the Bot", "+++++", "");
	setZone(resolveHostname("127.0.0.1"), 2000);
	setArena("0", SHIP_Spectator, 1024, 768, false);
	resetSystemInfo();
	setReg("Catid.bot", "*****@*****.**", "CatVille", "CatState", SEX_Male, 17, true, true, true);
	setDatabase(NULL, 3);
	setSpawn("default.dll");
}
Exemple #5
0
void BOT_INFO::set(BOT_INFO &a)
{
	setLogin(a.name, a.password, a.staffpw);
	setZone(a.ip, a.port);
	setArena(a.initialArena, a.initialShip, a.xres, a.yres, a.allowAudio);
	setBan(a.machineID, a.timeZoneBias, a.permissionID, a.processor, a.regName, a.regOrg);
	setReg(a.realName, a.email, a.city, a.state, a.sex, a.age, a.playAtHome, a.playAtWork, a.playAtSchool);
	setDatabase(a.db, a.maxSpawns);
	setSpawn(a.dllName);
}
void NetworkAccount::pseudoAssign(const KMAccount *a)
{
    KMAccount::pseudoAssign(a);

    const NetworkAccount *n = dynamic_cast<const NetworkAccount *>(a);
    if(!n) return;

    setLogin(n->login());
    setPasswd(n->passwd(), n->storePasswd());
    setHost(n->host());
    setPort(n->port());
    setAuth(n->auth());
    setUseSSL(n->useSSL());
    setUseTLS(n->useTLS());
    setSieveConfig(n->sieveConfig());
}
bool DatabaseLoginPanel::select(DatabaseLogin const &oLogin, bool bNotify)
{
	int i = find(oLogin);
	if(i == -1)
		return false;

	QModelIndex ind = mModel->index(i, 0);
	mCurrent = i;
	mGUI->mLoginListView->setCurrentIndex(ind);
	DatabaseLogin l = getLogin(i);
	setLogin(l);
	if(bNotify)
		onItemClicked(ind);

	return true;
}
bool EmployeeTableModel::setData(const QModelIndex& index, const QVariant& data, int role)
{
    QString key = record(index.row()).field(EMPLOYEE_COLUMN_LOGIN).value().toString();

    bool ok = false;
    switch (role)
    {
    case Qt::CheckStateRole:
        switch (index.column())
        {
        case EMPLOYEE_COLUMN_LOGIN:
            ok = setActive(key, data.toBool());
            break;
        default:
            logInvalidEdit(role, index, data);
        }
        break;
    case Qt::EditRole:
        switch (index.column())
        {
        case EMPLOYEE_COLUMN_LOGIN:
            ok = setLogin(key, data.toString());
            if (ok)
            {
                _editableLogin = -1;
            }
            break;
        case EMPLOYEE_COLUMN_PASSWORD:
            ok = setPassword(key, data.toString());
            break;
        case EMPLOYEE_COLUMN_NAME:
            ok = setName(key, data.toString());
            break;
        default:
            logInvalidEdit(role, index, data);
        }
        break;
    }

    if (ok)
    {
        refresh();
    }

    return ok;
}
Exemple #9
0
Client::Client(QObject *parent) :
    Vreen::Client(parent)
{
    connect(this, SIGNAL(onlineStateChanged(bool)), this,
            SLOT(onOnlineStateChanged(bool)));

    QSettings settings;
    settings.beginGroup("connection");
    setLogin(settings.value("login").toString());
    setPassword(settings.value("password").toString());
    settings.endGroup();

    auto manager = new QNetworkConfigurationManager(this);
    connect(manager, SIGNAL(onlineStateChanged(bool)), this, SLOT(setOnline(bool)));

    connect(longPoll(), SIGNAL(messageAdded(Vreen::Message)), SLOT(onMessageAdded(Vreen::Message)));
    connect(this, SIGNAL(replyCreated(Vreen::Reply*)), SLOT(onReplyCreated(Vreen::Reply*)));
    connect(this, SIGNAL(error(Vreen::Client::Error)), SLOT(onReplyError(Vreen::Client::Error)));
}
void MyProxyEngine::createDialog(qint16 cmd, QString param)
{
    MyDialog *m_dialog=new MyDialog(this);
    connect(m_server, SIGNAL(receiveMessage(MyPacket &)),
            m_dialog, SLOT  (receiveMessage(MyPacket &)));
    connect(m_dialog, SIGNAL(Exit(MyDialog *,qint16,qint16)),
            this,     SLOT  (DialogAnswer(MyDialog *,qint16,qint16)));
    connect(m_dialog, SIGNAL(sendMessage(MyPacket &)),
            m_server, SLOT  (sendMessage(MyPacket &)));
    connect(m_dialog, SIGNAL(Logon(QString, QString, qint32)),
            m_config, SLOT  (setLogin(QString, QString, qint32)));
    connect(m_dialog, SIGNAL(SessionID(qint32)),
            m_server, SLOT  (setSessionID(qint32)));

    m_dialog->execute(cmd,
                      m_config->getSessionID(),
                      param,
                      m_config->getClientRSApublic());
}
Exemple #11
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{

    isBot=false;
    started = false;

    ui->setupUi(this);

    displayText("Start");

    // Load sounds
    bullet = new QSound("/sounds/bullet.wav");

    networkThread = new QThread();
    networkManager = new NetworkManager();

    networkManager->moveToThread(networkThread);
    networkThread->start();
    //connect(networkThread, SIGNAL(started()), networkManager, SLOT(network_init()));

    connect(ui->connectButton,SIGNAL(clicked()),this,SLOT(connect_clicked()));
    connect(networkManager, SIGNAL(writeText(QString)), this, SLOT(displayText(QString)));
    connect(ui->disconnectButton, SIGNAL(released()), this, SLOT(stopPlay()));
    connect(this, SIGNAL(sendKeyEvent(QKeyEvent*,int)), networkManager, SLOT(process_key(QKeyEvent*,int)));
    connect(networkManager, SIGNAL(newPlayerScore(int)), ui->playerScore, SLOT(setNum(int)));
    connect(networkManager, SIGNAL(newHealthPoints(int)), ui->healthPoints, SLOT(setValue(int)));
    connect(networkManager, SIGNAL(newPlayerId(int)), ui->playerIdLabel, SLOT(setNum(int)));
    connect(networkManager, SIGNAL(newTeamId(int)),ui->equipe, SLOT(setNum(int)));
    connect(networkManager, SIGNAL(newIdInTeam(int)), this, SLOT(setSprite(int)));
    connect(ui->checkBoxBot, SIGNAL(stateChanged(int)), this, SLOT(setBot(int)));
    connect(ui->nameEdit, SIGNAL(textChanged(QString)), networkManager, SLOT(setLogin(QString)));
    connect(ui->disconnectButton, SIGNAL(released()), networkManager, SLOT(disconnectClient()));
    connect(this, SIGNAL(setIP(QString,int)), networkManager, SLOT(setIP(QString,int)));
    connect(this, SIGNAL(setRequestedTeam(int)), networkManager, SLOT(setRequestedTeam(int)));
    connect(networkManager, SIGNAL(disconnected()), this, SLOT(stopPlay()));
    connect(this, SIGNAL(startNetworkManager()), networkManager, SLOT(network_init()));

    readSettings();
}
Exemple #12
0
Context::Context(const Context &src)
{
    m = new ContextData(src.m->configDir());
    setLogin(src.getUsername(), src.getPassword());
}