if (this.firstReminder != null) { Reminder currReminder = this.firstReminder; do { buffer = "reminder " + currReminder.sender + " " + currReminder.target + " " + currReminder.timeSent + " " + currReminder.timeToArrive + " " + currReminder.notified + " " + currReminder.message + "\n"; dataFileWriter.write(buffer, 0, buffer.length()); currReminder = currReminder.next; } while (currReminder != null); }
	void writeData() {		String filename = dataFileName;		BufferedWriter dataFileWriter;		try {			dataFileWriter = new BufferedWriter(new FileWriter(new File(sephiadir, filename), false));		} catch (IOException ioe) {			logerror("Couldn't open data file " + filename + " for writing:\n" + ioe.getMessage());			return;		}		try {			String buffer;			buffer = "// This file is read on boot. Do not modify unless you know what you are doing.\n";			dataFileWriter.write(buffer, 0, buffer.length());					String userBuffer = "userdata " + vino.userName;			for (int i = 0; i < 10; i++) {				if (vino.hosts[i] != null && vino.hosts[i].length() > 0) {					//Check the array up until now for duplicate entries.					boolean foundDuplicate = false;					for (int j = 0; j < i; j++) {						if (vino.hosts[j] != null && vino.hosts[j].equals(vino.hosts[i])) {							foundDuplicate = true;							break;						}					}					if (!foundDuplicate) {						buffer = userBuffer + " host " + vino.hosts[i] + " " + vino.lastSeenTimes[i] + "\n";						dataFileWriter.write(buffer, 0, buffer.length());					}				}			}			if (this.vino.away != null) {				buffer = userBuffer;				buffer += " away " + this.vino.away + "\n";				dataFileWriter.write(buffer, 0, buffer.length());				buffer = userBuffer;				buffer += " leavetime " + this.vino.leaveTime + "\n";				dataFileWriter.write(buffer, 0, buffer.length());			}						if (vino.lastTalked > 0) {				buffer = userBuffer;				buffer += " lasttalked " + this.vino.lastTalked + "\n";				dataFileWriter.write(buffer, 0, buffer.length());			}			for (int i = 0; i < users.length; i++) {				User user = users[i];				userBuffer = "userdata " + user.userName;				for (int j = 0; j < 10; j++) {					if (user.hosts[j] != null && user.hosts[j].length() > 0) {						//Check the array up until now for duplicate entries.						boolean foundDuplicate = false;						for (int k = 0; k < j; k++) {							if (user.hosts[k].equals(user.hosts[j])) {								foundDuplicate = true;								break;							}						}						if (!foundDuplicate) {							buffer = userBuffer + " host " + user.hosts[j] + " " + user.lastSeenTimes[j] + "\n";							dataFileWriter.write(buffer, 0, buffer.length());						}					}				}				if (user.away != null) {					buffer = userBuffer;					buffer += " away " + user.away + "\n";					dataFileWriter.write(buffer, 0, buffer.length());					buffer = userBuffer;					buffer += " leavetime " + user.leaveTime + "\n";					dataFileWriter.write(buffer, 0, buffer.length());				}				if (user.lastTalked > 0) {					buffer = userBuffer;					buffer += " lasttalked " + user.lastTalked + "\n";					dataFileWriter.write(buffer, 0, buffer.length());				}			}						if (this.firstMessage != null) {				Message currMessage = this.firstMessage;				do {					//If the message is more then a week old, do not store it.					if (timeInWeeks(currMessage.time, System.currentTimeMillis()) <= 0) {						buffer = "message " + currMessage.sender + " " + currMessage.target + " " + currMessage.time + currMessage.message + "\n";						dataFileWriter.write(buffer, 0, buffer.length());					}					currMessage = currMessage.next;				} while (currMessage != null);			}		} catch (IOException ioe) {			logerror("Couldn't write to data file " + filename + ".");			return;		}				try {			dataFileWriter.close();		} catch (IOException ioe) {			logerror("Couldn't save data file " + filename + ".");			return;		}				log("Wrote data file.");	}