Esempio n. 1
0
void
Mailbox::deliver(const std::string& sender, const std::string& mess)
{
	if (!mdir)
		try {
			createOpenDir();
		} catch(const Directory::OpenError&) {
			ERROR1("could not (re)open directory: '%s'", path.c_str());
			throw DeliverError("could not (re)open directory: " + path);
		}

	std::ostringstream ostr;
	ostr << path << '/' << std::setfill('0') << std::setw(15) << static_cast<unsigned long>(std::time(0));

	std::ofstream fd(ostr.str().c_str());
	if (!fd) {
		ERROR1("error opening mail file. check permissions: '%s'", path.c_str());
		throw DeliverError("error opening mail file. check permissions: " + path);
	}

	fd << sender << std::endl << mess << std::endl;
}
void XQLocationPrivate::startUpdates()
{
    iSingleUpdate = EFalse;
    XQLocation::Error error = openConnectionToPositioner();
    if (error != XQLocation::NoError) {
        DeliverError(error);
        return;
    }
    if (ipPositionerObserver->UpdateInterval() != updateInterval) {
        error = ipPositionerObserver->SetUpdateInterval(updateInterval);
        if (error != XQLocation::NoError) {
            DeliverError(error);
            return;
        }
    }
    
    firstStatusUpdate = true;
    iPreviousPosition = TPosition();
    iPreviousSpeed = 0;
    iPreviousNumSatellitesInView = -1;
    iPreviousNumSatellitesUsed = -1;

    ipPositionServerObserver->StartListening();
}