예제 #1
0
void netcoupler::start(QString s){
    if(!p){                                                     //indicates first start
        p=new QProcess(this);
        p->setProcessChannelMode(QProcess::MergedChannels);
        connect(volume, SIGNAL(valueChanged (int)),&singleton<sound_handler>(), SLOT(volumechange(int)));
        connect(&users, SIGNAL(sigbuddyarrived()),&singleton<balloon_handler>(), SLOT(buddyarrived()));
        connect(&users, SIGNAL(sigbuddyleft()),&singleton<balloon_handler>(), SLOT(buddyleft()));
        connect(this,SIGNAL(sigconnected()),&singleton<balloon_handler>(),SLOT(connected()));
        connect(this,SIGNAL(sigdisconnected()),&singleton<balloon_handler>(),SLOT(disconnected()));
        connect(p, SIGNAL(readyRead()),this, SLOT(readprocess()));

        connect(this, SIGNAL(sigsettingswindowchanged()),this, SLOT(initSoundAndStartWho()));
        connect(this, SIGNAL(sigsettingswindowchanged()),&users, SLOT(usesettingswindow()));
    }
예제 #2
0
netcoupler::netcoupler(QString s, QObject *parent) :
        QObject(parent), nick(s) {

    connect(volume, SIGNAL(valueChanged (int)),&singleton<sound_handler>(), SLOT(volumechange(int)));

    irc = new ircnet(nick, this);
    connect(irc, SIGNAL(sigusergarbage(const QString&,const QString&)),this, SIGNAL(sigusergarbage(const QString&,const QString&)));
    connect(irc, SIGNAL(sigusergarbagejoin(const QString&,const QString&)),this, SIGNAL(sigusergarbagejoin(const QString&,const QString&)));
    connect(irc, SIGNAL(sigusergarbagepart(const QString&,const QString&)),this, SIGNAL(sigusergarbagepart(const QString&,const QString&)));
    connect(irc, SIGNAL(sigusergarbagequit(const QString&,const QString&)),this, SIGNAL(sigusergarbagequit(const QString&,const QString&)));
    connect(irc,SIGNAL(sigconnected()),this,SLOT(ircconnected()));
    connect(irc,SIGNAL(sigdisconnected()),this,SLOT(ircdiconnected()));
    http = new snoppanet(this);
    connect(http, SIGNAL(sigchannelscheme(QString,QString)),this, SLOT(getscheme(QString,QString)));
    connect(irc, SIGNAL(siggetlist(QStringList)),this, SLOT(getchannellist(QStringList)));
    connect(irc, SIGNAL(sigmsg(const QString&,const QString&,const QString&)),this, SLOT(getmsg(const QString&,const QString&,const QString&)));
    connect(irc, SIGNAL(signotice(const QString&,const QString&,const QString&)),this, SLOT(getnotice(const QString&,const QString&,const QString&)));
    connect(irc, SIGNAL(siggotidletime(const QString&, int)),this, SIGNAL(siggotidletime(const QString&, int)));
    connect(irc, SIGNAL(signosuchnick(const QString&)),this, SIGNAL(signosuchnick(const QString&)));
    connect(http, SIGNAL(sighostlist(QList<hoststruct>,QString)),this, SLOT(gethostlist(QList<hoststruct>,QString)));
    connect(&users, SIGNAL(sigbuddyarrived()),&singleton<balloon_handler>(), SLOT(buddyarrived()));
    connect(&users, SIGNAL(sigbuddyleft()),&singleton<balloon_handler>(), SLOT(buddyleft()));
    connect(this,SIGNAL(sigconnected()),&singleton<balloon_handler>(),SLOT(connected()));
    connect(this,SIGNAL(sigdisconnected()),&singleton<balloon_handler>(),SLOT(disconnected()));
    QStringList sl = inihandler.stringlistfromini("[irc ip]");
    if (sl.isEmpty()) {
        connect(http, SIGNAL(sigircip(QString)),this, SLOT(getircip(QString)));
        http->start();
    } else {
        ircip = sl.first();
        irc->setip(ircip);
        irc->start();
        usesettingswindow("sbwhorepead");
    }
    connect(QApplication::instance(), SIGNAL(aboutToQuit()),this, SLOT(sendquit()));
    p->setProcessChannelMode(QProcess::MergedChannels);
    connect(p, SIGNAL(finished (int , QProcess::ExitStatus)),this, SLOT(processfinished(int , QProcess::ExitStatus)));
    connect(p, SIGNAL(readyRead()),this, SLOT(readprocess()));
    isaway = 0;
    usesettingswindow("cbsetawaywhilegaming");
    usesettingswindow("leawaystring");

    mutedusers = singleton<snpsettings>().map["mutedusers"].toStringList();
    connect(this, SIGNAL(sigsettingswindowchanged()),this, SLOT(usesettingswindow()));
    connect(this, SIGNAL(sigsettingswindowchanged()),&users, SLOT(usesettingswindow()));
}
예제 #3
0
파일: main.c 프로젝트: robm123/Indexer
// recursively calls itself if the pointer reaches another directory
void subDirectory(char* sub, char* fullPath, SortedListPtr list)
{
	char subdirectory[999];
	char current[999];
	
	struct dirent* pD;
	DIR* dir2;
	
	strcpy(subdirectory, sub);
	strcpy(current, fullPath);
	strcat((strcat(current,"/")),subdirectory); 
	dir2 = opendir(current);

	if(dir2 == NULL)
		printf("*****\n\nCould not open directory:   \n%s\n", current);

	pD = readdir(dir2);
	
	while(pD != NULL)
	{	
		if(pD->d_type == DT_REG)
		{
			char fn2[9999];	
			strcpy(fn2, current);
			strcat(strcat(fn2,"/"),pD->d_name);		
	
			
			char *sv = fn2; 
			strcpy(charptr[i], sv);
			printf("About to open file: %s\n",charptr[i]);				
			readprocess(charptr[i], list);			
			i++;			
		}
	    if(pD->d_type == DT_DIR && strcmp(pD->d_name, ".") != 0  && strcmp(pD->d_name, "..") != 0 )
		{														  												             
			subDirectory(pD->d_name, current, list);
		}
		
		pD = readdir(dir2);	
	}
	closedir(dir2);
	return;
}
예제 #4
0
파일: main.c 프로젝트: robm123/Indexer
int main(int argc, char **argv)  
{
  
	char *outputFile = argv[1]; 
	char *pathName = argv[2];	
	char ans[0];
	char strp[999];		 
	struct stat status;
	struct dirent *pDirent;
	//struct dirent *ini;
	DIR* dir;
	SortedListPtr list = SLCreate(compareStrings);	
	int st = 0;

	if(argc != 3)
	{
		printf("Incorrect amount of arguments");
		return 0;
	}

	FILE *ofp;
	ofp = fopen(outputFile, "w");
	if(!ofp)
	{
		perror("Cannot open output file");
		exit(EXIT_FAILURE);
	}
	
	st = stat(pathName,&status);	
	if(st != 0)
	{
		printf("Error");
		return 1;
	}
	
	if(S_ISREG(status.st_mode))
	{		
		readprocess(pathName, list);
		outputAll(list, ofp, pathName);
		fclose(ofp);						
		return 1;
	}

	dir = opendir(pathName); //returns pointer to stream
	
	if(dir == NULL)
		printf("Could not open directory: %s\n", pathName);
	else
		printf("\nWe are inside:  %s \n", pathName);
			
	char *currentPath = malloc(strlen(pathName)+1);	
	currentPath = pathName;

	pDirent = readdir(dir);
	 
	while(pDirent != NULL)
	{	
		if(pDirent->d_type == DT_REG)
		{
			char thePath[9999];
			strcpy(thePath, currentPath);
			strcat(strcat(thePath,"/"),pDirent->d_name);

			char *sv = thePath; 
			strcpy(charptr[i], sv);
			readprocess(charptr[i], list);			
			i++;
		}
		if(pDirent->d_type == DT_DIR && strcmp(pDirent->d_name, ".") != 0  && strcmp(pDirent->d_name, "..") != 0 )
		{															  	
			//printf("%s\n\n", pDirent->d_name);													
			subDirectory(pDirent->d_name, currentPath, list);
	
		}

		pDirent = readdir(dir);	
	}
	//closes parent directory
	closedir(dir);
	
//-=-=-=-=--=-==-=-=-==-THIS WILL OUTPUT TO FILE-=-=--=-==-=-=-==-==--=-=	

	//pass the list and print it 
	outputAll(list, ofp, pathName);
	fclose(ofp);
	printf("Goodbye\n");
//-=-=-=-=-=-=--=-==-=-=-=-=-=-=--=-==-=-=-==-==--=-=-===-==-=-=-=-==-=-=-	
	return 0;
}