Ejemplo n.º 1
0
int qSslChat::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: peerRejectedFileSend(); break;
        case 1: fsCompleted(); break;
        case 2: hostConnection(); break;
        case 3: connectToHost(); break;
        case 4: activateMsgSending(); break;
        case 5: sendMsg((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 6: receiveMessage((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 7: displayMsg(); break;
        case 8: endConnection(); break;
        case 9: sendAnticipation(); break;
        case 10: sendFile((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break;
        case 11: notifyServer(); break;
        case 12: completeFileSend(); break;
        case 13: selectSmiley(); break;
        case 14: insertSmiley((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2]))); break;
        case 15: displayCertificateInfo(); break;
        }
        _id -= 16;
    }
    return _id;
}
Ejemplo n.º 2
0
static void
reallyRemoveJob(const char* op, Job* job, const char* jobname)
{
    char line[1024];		/* call it line to use isCmd() on it */
    char* cp;
    char* tag;
    char* cmd;
    int fd;
    FILE* fp;

    fp = fopen((char*) job->qfile, "r+w");
    if (fp == NULL) {
	syslog(LOG_ERR, "%s: cannot open %s (%m)", op, job->qfile);
	sendClient("openFailed", "%s", jobname);
	return;
    }
    fd = fileno(fp);
    /*
     * First ask server to do removal.  If the job is being
     * processed, it will first be aborted.  Otherwise, do
     * the cleanup here.
     */
    cmd = (strcmp(op, "remove") == 0 ? "R" : "K");
    if (notifyServer(job->modem, "%s%s", cmd, job->qfile)) {
	sendClient("removed", "%s", jobname);
    } else if (flock(fd, LOCK_EX|LOCK_NB) == 0) {
	while (fgets(line, sizeof (line) - 1, fp)) {
	    if (line[0] == '#')
		continue;
	    if (cp = strchr(line, '\n'))
		*cp = '\0';
	    tag = strchr(line, ':');
	    if (tag)
		*tag++ = '\0';
	    while (isspace(*tag))
		tag++;
	    if (isCmd("tiff") || isCmd("!tiff") ||
		isCmd("postscript") || isCmd("!postscript")) {
		if (unlink(tag) < 0) {
		    syslog(LOG_ERR, "%s: unlink %s failed (%m)", op, tag);
		    sendClient("docUnlinkFailed", "%s", jobname);
		}
	    }
	}
	if (unlink(job->qfile) < 0) {
	    syslog(LOG_ERR, "%s: unlink %s failed (%m)", op, job->qfile);
	    sendClient("unlinkFailed", "%s", jobname);
	} else {
	    syslog(LOG_INFO, "%s %s completed", 
		strcmp(op, "remove") == 0 ? "REMOVE" : "KILL",
		job->qfile);
	    sendClient("removed", "%s", jobname);
	}
    }
    job->flags |= JOB_INVALID;
    (void) fclose(fp);			/* implicit unlock */
}
Ejemplo n.º 3
0
void Client::trust(){
	notifyServer(BP::Trust);

	if(Self->getState() == "trust")
		Bang->playAudio("untrust");
	else
		Bang->playAudio("trust");

	setStatus(NotActive);
}
Ejemplo n.º 4
0
void Client::setup(const QJsonValue &setup){
	if(socket && !socket->isConnected())
		return;

	QString setup_str = setup.toString();
	if(ServerInfo.parse(setup_str)){
		emit server_connected();
		notifyServer(BP::ToggleReady);
	}else{
		QMessageBox::warning(NULL, tr("Warning"), tr("Setup string can not be parsed: %1").arg(setup_str));
	}
}
Ejemplo n.º 5
0
void Client::signup(){
	if(replayer)
		replayer->start();
	else{
		BP::CommandType command = Config.value("EnableReconnection", false).toBool() ? BP::SignUpR : BP::SignUp;

		QJsonArray signup_arr;
		signup_arr.append(Config.UserName);
		signup_arr.append(Config.UserAvatar);
		QString password = Config.Password;
		if(!password.isEmpty()){
			password = QCryptographicHash::hash(password.toLatin1(), QCryptographicHash::Md5).toHex();
			signup_arr.append(password);
		}

		notifyServer(command, signup_arr);
	}
}
Ejemplo n.º 6
0
void
submitJob(const char* modem, char* otag)
{
    u_long tts = 0;
    time_t t = time(0);
    struct tm* now = localtime(&t);

    sprintf(qfile, "%s/q%d", FAX_SENDDIR, seqnum = getSequenceNumber());
    qfd = fopen(qfile, "w");
    if (qfd == NULL) {
	syslog(LOG_ERR, "%s: Can not create qfile: %m", qfile);
	sendError("Can not create qfile \"%s\".", qfile);
	cleanupJob();
    }
    flock(fileno(qfd), LOCK_EX);
    fprintf(qfd, "modem:%s\n", modem);
    for (;;) {
	if (!getCommandLine())
	    cleanupJob();
	if (isCmd("end") || isCmd(".")) {
	    setupData(seqnum);
	    break;
	}
	if (isCmd("sendAt")) {
	    tts = cvtTime(tag, now, "time-to-send");
	} else if (isCmd("killtime")) {
	    fprintf(qfd, "%s:%lu\n", line, cvtTime(tag, now, "kill-time"));
	} else if (isCmd("cover")) {
	    coverProtocol(atoi(tag), seqnum);
	} else
	    fprintf(qfd, "%s:%s\n", line, tag);	/* XXX check info */
    }
    fprintf(qfd, "tts:%lu\n", tts);
    fclose(qfd), qfd = NULL;
    if (!notifyServer(modem, "S%s", qfile))
	sendError("Warning, no server appears to be running.");
    sendClient("job", "%d", seqnum);
}
Ejemplo n.º 7
0
void Client::kick(const QString &to_kick){
	notifyServer(BP::Kick, to_kick);
}
Ejemplo n.º 8
0
void Client::speakToServer(const QString &text){
	if(text.isEmpty())
		return;

	notifyServer(BP::Speak, text);
}
Ejemplo n.º 9
0
void Client::arrange(const QStringList &order){
	Q_ASSERT(order.length() == 3);
	notifyServer(BP::Arrange, BP::toJsonArray(order));
}
Ejemplo n.º 10
0
void Client::fillRobots(){
	notifyServer(BP::FillRobots);
}
Ejemplo n.º 11
0
void Client::addRobot(){
	notifyServer(BP::AddRobot);
}
Ejemplo n.º 12
0
void Client::networkDelayTest(const QJsonValue &){
	notifyServer(BP::NetworkDelayTest);
}