All pastes #776717 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-11-16 06:51 UTC
rendered paste body
 for (int i =0; i<listOfChans.size();i++){
    	       //Something here is slow
    	       //Shockingly slow
    	       if (listOfChans.get(i).userList.remove(UserNameMatch.group(1) + "\n")){
    	        	//log the quit
    	        	toChan(listOfChans.get(i).name, getTime()+" " +UserNameMatch.group(1) +UserNameMatch.group(2)+" has quit "+ listOfChans.get(i).name +" Reason: "+matched.group(4) +"\n" );
    	        					 
    	        	//if this channel needs its userlist refilled
    	        	if (i==thisChanNum){
    	        		reFillUserListWindow(thisChanNum);
    	        		chatWin.append(getTime()+" " +UserNameMatch.group(1) + UserNameMatch.group(2)+ " has quit " + listOfChans.get(i).name +" Reason:"+matched.group(4)+ "\n");
    	        	}
    	        }
}

//########################
void toChan(String chanName, String s){
	Boolean found = false;
	int i;
	//Find this channel
	for (i = 0; i<listOfChans.size();++i){
		if (listOfChans.get(i).name.equalsIgnoreCase(chanName)){
			found = true;
			break;
		}
			
	}
	if (!found){//Channel wasnt found
		//create a new chanList
		chanLists myChanList = new chanLists();
		myChanList.name = chanName;
		//add it to the linked list
		listOfChans.add(myChanList);
		//add the message
		listOfChans.get(listOfChans.size()-1).myChan.add(s);
	}else{
		//get the chan and add to the tail of the queue
		listOfChans.get(i).myChan.add(s);
		//if the queue is too big cut it down to size
		while (listOfChans.get(i).myChan.size()>SAVEDAMOUNT)
			listOfChans.get(i).myChan.removeFirst();
	}
}