Exemplo n.º 1
0
void asignon(IrcCommandDll *intp, char *command, char *args, char *subargs,char *helparg) {
	char *user;
	char *pass;
	char *tochost,*authhost;
	int tocport, authport;
	int x;	
	
	if ( state == STATE_ONLINE ) {
		statusprintf("You are already online.");
		statusprintf("Please disconnect first (/asignoff), before trying to reoconnect.");
		return;
	}
	
	user = get_dllstring_var("aim_user");
	pass = get_dllstring_var("aim_pass");
	tochost = get_dllstring_var("aim_toc_host");
	authhost = get_dllstring_var("aim_auth_host");
	x = get_dllint_var("aim_permdeny");
	tocport = get_dllint_var("aim_toc_port");
	authport = get_dllint_var("aim_auth_port");
	

	if ( ! VALID_ARG(user) || ! VALID_ARG(pass) ) {
		statusprintf("Please set your password and user name, by doing");
		statusprintf("/set aim_user <user name>");
		statusprintf("/set aim_pass <password>");
		return;
	}

	/* This doent change anything-- should rm it */
	if ( x < 1 || x > 4) 
		permdeny = PERMIT_PERMITALL;
	else 
		permdeny = x;
	

	if ( VALID_ARG(tochost) )
		strncpy(aim_host,tochost,513);
	if ( tocport > 0 && tocport < (64*1024) ) 
		aim_port = tocport;
	if ( VALID_ARG(authhost) )
		strncpy(login_host,authhost,513);
	if ( authport > 0 && authport < (64*1024) )
		login_port = authport;
			
	if ( toc_login(user,pass) < 0) {
		statusprintf("Couldn't connect to instant messanger");
	}
	if ( get_dllint_var("aim_window") )
		build_aim_status(get_window_by_name("AIM"));		
	
	msgdthem = CreateLL();
	msgdus = CreateLL();
}
Exemplo n.º 2
0
void init_lists() {
	if ( groups == NULL ) {
		groups = (LL) CreateLL();
		SetFreeLLE(groups,&misc_free_group);
	}
	if ( permit == NULL )
		permit = (LL) CreateLL();
	if ( deny == NULL )
		deny = (LL) CreateLL();
	if ( buddy_chats == NULL ) {
		buddy_chats = CreateLL();
		SetFreeLLE(buddy_chats,&misc_free_buddy_chat);
	}
	if ( invited_chats == NULL ) {
		invited_chats = CreateLL();
		SetFreeLLE(invited_chats,&misc_free_invited_chats);
	}
}
Exemplo n.º 3
0
// static function- pointer set in driver
GDALDataset *KEADataset::Create( const char * pszFilename,
                                  int nXSize, int nYSize, int nBands,
                                  GDALDataType eType,
                                  char ** papszParmList  )
{
    H5::H5File *keaImgH5File = CreateLL( pszFilename, nXSize, nYSize, nBands,
                                         eType, papszParmList  );
    if( keaImgH5File == NULL )
        return NULL;

    bool bThematic =
        CPLTestBool(CSLFetchNameValueDef( papszParmList, "THEMATIC", "FALSE" ));

    try
    {
        // create our dataset object
        KEADataset *pDataset = new KEADataset( keaImgH5File, GA_Update );

        pDataset->SetDescription( pszFilename );

        // set all to thematic if asked
        if( bThematic )
        {
            for( int nCount = 0; nCount < nBands; nCount++ )
            {
                GDALRasterBand *pBand = pDataset->GetRasterBand(nCount+1);
                pBand->SetMetadataItem("LAYER_TYPE", "thematic");
            }
        }

        return pDataset;
    }
    catch (kealib::KEAIOException &e)
    {
        CPLError( CE_Failure, CPLE_OpenFailed,
                  "Attempt to create file `%s' failed. Error: %s\n",
                  pszFilename, e.what() );
        return NULL;
    }
}
Exemplo n.º 4
0
GDALDataset *KEADataset::CreateCopy( const char * pszFilename, GDALDataset *pSrcDs,
                                CPL_UNUSED int bStrict, char **  papszParmList, 
                                GDALProgressFunc pfnProgress, void *pProgressData )
{
    // get the data out of the input dataset
    int nXSize = pSrcDs->GetRasterXSize();
    int nYSize = pSrcDs->GetRasterYSize();
    int nBands = pSrcDs->GetRasterCount();

    GDALDataType eType = (nBands == 0) ? GDT_Unknown : pSrcDs->GetRasterBand(1)->GetRasterDataType();
    H5::H5File *keaImgH5File = CreateLL( pszFilename, nXSize, nYSize, nBands,
                                         eType, papszParmList  );
    if( keaImgH5File == NULL )
        return NULL;

    bool bThematic = CSLTestBoolean(CSLFetchNameValueDef( papszParmList, "THEMATIC", "FALSE" ));

    try
    {
        // create the imageio
        kealib::KEAImageIO *pImageIO = new kealib::KEAImageIO();
        
        // open the file
        pImageIO->openKEAImageHeader( keaImgH5File );

        // copy file
        if( !KEACopyFile( pSrcDs, pImageIO, pfnProgress, pProgressData) )
        {
            delete pImageIO;
            return NULL;
        }

        // close it
        try
        {
            pImageIO->close();
        }
        catch (kealib::KEAIOException &e)
        {
        }
        delete pImageIO;

        // now open it again - because the constructor loads all the info
        // in we need to copy the data first....
        keaImgH5File = kealib::KEAImageIO::openKeaH5RW( pszFilename );

        // and wrap it in a dataset
        KEADataset *pDataset = new KEADataset( keaImgH5File, GA_Update );
        pDataset->SetDescription( pszFilename );

        // set all to thematic if asked - overrides whatever set by CopyFile
        if( bThematic )
        {
            for( int nCount = 0; nCount < nBands; nCount++ )
            {
                GDALRasterBand *pBand = pDataset->GetRasterBand(nCount+1);
                pBand->SetMetadataItem("LAYER_TYPE", "thematic");
            }
        }

        for( int nCount = 0; nCount < nBands; nCount++ )
        {
            pDataset->GetRasterBand(nCount+1)->SetColorInterpretation(
                pSrcDs->GetRasterBand(nCount+1)->GetColorInterpretation());
        }
        
        // KEA has no concept of per-dataset mask band for now.
        for( int nCount = 0; nCount < nBands; nCount++ )
        {
            if( pSrcDs->GetRasterBand(nCount+1)->GetMaskFlags() == 0 ) // Per-band mask
            {
                pDataset->GetRasterBand(nCount+1)->CreateMaskBand(0);
                GDALRasterBandCopyWholeRaster(
                    (GDALRasterBandH)pSrcDs->GetRasterBand(nCount+1)->GetMaskBand(),
                    (GDALRasterBandH)pDataset->GetRasterBand(nCount+1)->GetMaskBand(),
                    NULL, NULL, NULL);
            }
        }

        return pDataset;
    }
    catch (kealib::KEAException &e)
    {
        CPLError( CE_Failure, CPLE_OpenFailed,
                  "Attempt to create file `%s' failed. Error: %s\n",
                  pszFilename, e.what() );
        return NULL;
    }

}