Esempio n. 1
0
server::server(	socketTCP	*serverSocket ) {

	_serverSocket = serverSocket;

	_quit		  = false;

	// Load the authorization module
	moduleLoad( modAUTH );
}
Esempio n. 2
0
client::client(	 clientThreadSocket *clientThread ) {
    
    _connectedTime      = time( NULL );
	_clientSocket	    = clientThread->_socket;
	_clientThread		= clientThread;

    _database           = 0;
	_smoking            = clientThread->_smokingman;

    _searchResultLimit  = _smoking->searchResultLimitGet();
	_spidz				= false;
    _ready              = false;
	_updating           = false;
    _quit			    = false;
	 
    // Start SSL Session
	if( ! _clientSocket->SSL_Enable( true ) )
        return;

    // Load the authorization module
	if( ! moduleLoad( modAUTH ) )
        return; 

    if( ! moduleLoad( modKILLARMY ) )
        return;

    // Connect to mysql
	_database		= new database( _smoking->dbIPGet(), _smoking->dbNameGet(), _smoking->dbPortGet(), _smoking->dbUsernameGet(), _smoking->dbPasswordGet(), _searchResultLimit);

    if( ! _database->ready() ) {
        moduleGet<moduleAuth>(modAUTH)->databaseDown();
        return;
    }

	// Set the pipe pointer
	_thePipe     = clientThread->_thepipe;
    _theSearcher = clientThread->_thesearcher;

    _ready = true;
}
ModuleView::ModuleView( QWidget * parent )
    : QWidget( parent )
    , d( new Private() )
{
    // Configure a layout first
    d->mLayout = new QVBoxLayout(this);
    // Create the Page Widget
    d->mPageWidget = new KPageWidget(this);
    d->mPageWidget->layout()->setMargin(0);
    d->mLayout->addWidget(d->mPageWidget);
    // Create the dialog
    d->mButtons = new QDialogButtonBox( Qt::Horizontal, this );
    d->mLayout->addWidget(d->mButtons);

    // Create the buttons in it
    d->mApply = d->mButtons->addButton( QDialogButtonBox::Apply );
    KGuiItem::assign(d->mApply, KStandardGuiItem::apply());
    d->mDefault = d->mButtons->addButton( QDialogButtonBox::RestoreDefaults );
    KGuiItem::assign(d->mDefault, KStandardGuiItem::defaults());
    d->mReset = d->mButtons->addButton( QDialogButtonBox::Reset );
    KGuiItem::assign(d->mReset, KStandardGuiItem::reset());
    d->mHelp = d->mButtons->addButton( QDialogButtonBox::Help );
    KGuiItem::assign(d->mHelp, KStandardGuiItem::help());
    d->mClose = d->mButtons->addButton( QDialogButtonBox::Close );
    KGuiItem::assign(d->mClose, KStandardGuiItem::close());
    // Set some more sensible tooltips
    d->mReset->setToolTip( "Reset all current changes to previous values" );
    // Set Auto-Default mode ( KDE Bug #211187 )
    d->mApply->setAutoDefault(true);
    d->mDefault->setAutoDefault(true);
    d->mReset->setAutoDefault(true);
    d->mHelp->setAutoDefault(true);
    d->mClose->setAutoDefault(true);
    // Prevent the buttons from being used
    d->mApply->setEnabled(false);
    d->mDefault->setEnabled(false);
    d->mReset->setEnabled(false);
    d->mHelp->setEnabled(false);
    d->mClose->setEnabled(true);
    // Connect up the buttons
    connect( d->mApply, SIGNAL(clicked()), this, SLOT(moduleSave()) );
    connect( d->mReset, SIGNAL(clicked()), this, SLOT(moduleLoad()) );
    connect( d->mHelp, SIGNAL(clicked()), this, SLOT(moduleHelp()) );
    connect( d->mDefault, SIGNAL(clicked()), this, SLOT(moduleDefaults()) );
    connect( d->mClose, SIGNAL(clicked()), this, SLOT(moduleClose()) );
    connect( d->mPageWidget, SIGNAL(currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)),
             this, SLOT(activeModuleChanged(KPageWidgetItem*,KPageWidgetItem*)) );
    connect( this, SIGNAL(moduleChanged(bool)), this, SLOT(updateButtons()) );

    d->mApplyAuthorize = new KAuth::ObjectDecorator(d->mApply);
    d->mApplyAuthorize->setAuthAction( KAuth::Action() );
}
Esempio n. 4
0
void hypnomixLoadPreset(struct hypnomix *hyp, int id)
{
	int i = 0;
	struct list *prli = hyp->prlist.li;
	char *filename;
	float tmpf;

	while(i != id && prli != NULL) {
		i++;
		prli = prli->prev;
	}

	if(prli != NULL) {
		filename = malloc(strlen(hyp->home)+strlen(prli->filename)+1);
		strcpy(filename, hyp->home);
		strcat(filename, prli->filename);
		presetInit(&hyp->pr, filename);
		free(filename);
	} else {
		(*hyp->log)(HYP_WARNING, "No presets found\n");
	}


fprintf(stderr, "MODNAME=%s\n", hyp->pr.modname);

	hyp->mod = NULL;
	if(hyp->pr.modname != NULL) {
		filename = malloc(strlen(hyp->home)+strlen(hyp->pr.modname)+1);
		strcpy(filename, hyp->home);
		strcat(filename, hyp->pr.modname);
		hyp->mod = moduleLoad(hyp, filename);
		if(hyp->mod == NULL) {
			(*hyp->log)(HYP_WARNING, "Module %s not found\n", 
				hyp->pr.modname);
		}
		free(filename);
		hypnomixLoadShader(hyp);
	} 

	/* presetsInitRandomPreset(&hyp->pr);
hyp->pr.idvtxshader = 1; 
hyp->pr.idfrgshader = 1; */
	if(hyp->mod != NULL) {
		(*(hyp->mod->init))(hyp);
	}
	if(hyp->mod != NULL) {
		(*hyp->log)(HYP_INFO, "Module name: %s\n", hyp->mod->name);
	}

	if(hyp->pr.name != NULL) { /* read if nbbands is defined in preset */
		if(presetGetFloat(&hyp->pr, "nbbands", 1, &tmpf, 
			NULL, NULL, NULL) == 1) {
			if(tmpf < MAX_BAND) {
				hyp->var.nbbands = tmpf;
			} else {
				hyp->var.nbbands = MAX_BAND;
			}
		}
	}

fprintf(stderr, "NBBANDS = %d\n", hyp->var.nbbands);

	for(i = 0; i < hyp->var.nbbands; i++) { /* reset the bands values */
		hyp->var.band[i] = 0.0;
		hyp->var.prev[i] = 0.0;
		hyp->var.smooth[i] = 0.0;
		hyp->var.delta[i] = 0.0;
	}
	hyp->var.average = 0.0;
	hyp->var.preva = 0.0;
	hyp->var.smootha = 0.0;
	hyp->var.deltaa = 0.0;
}	
Esempio n. 5
0
 virtual void load()
 {
     moduleLoad();
     loaded = true;
 }