Skip to content
This repository has been archived by the owner on Aug 26, 2020. It is now read-only.

Commit

Permalink
v0.9.7 - Windows log following fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
3vi1 committed Oct 23, 2017
1 parent 3c0348a commit 5a74909
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 23 deletions.
29 changes: 18 additions & 11 deletions docs/RELEASES
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
0.9.7 - Switched to SFML/OpenAL for the audio engine. WAV,
OGG/Vorbis and FLAC sounds are currently supported. MP3
is not yet supported due to licensing issues with the
underlying library, but I expect it to be implemented in
the near future now that the patents have expired.
0.9.7 - Changed log watching logic to further work around the
post-Vista behavior where NTFS does not update file
modification times until the handle is closed. Hopefully
this fixes the problems where updates would not be seen
if additional characters were logged on/off or if IMP
were left open for extended periods.

Updated Qt libraries in Windows build to v5.9.2.

0.9.6.1 - Switched to SFML/OpenAL for the audio engine. WAV,
OGG/Vorbis and FLAC sounds are currently supported. MP3
is not yet supported due to licensing issues with the
underlying library, but I expect it to be implemented in
the near future now that the patents have expired.



Expand Down Expand Up @@ -391,18 +400,16 @@
Coming soon:

- right-click to copy system name.
- kos msg for red by last should show person and corp.
- Rework KOS Checking: kos msg for red by last should show person and corp.
- fix display of messages with backslashes.
- better pilot cache/cleanup.
- if at war, and going hisec, play a "bad idea" sound.
- if at war (determine from corp/alliance message), and going hisec, play a "bad idea" sound.
- TTS support
- Maybe an option to auto-change region?
- Bubble icons
- Bubble indicators
- Make mini militia faction count (RBL npc corps)?
- Add some intelligence to handle dumb names like R3 Clear
- Add option to autobuild jumpbridge list from dotlan instead of files.
- Break follow transistion mode on screen reposition.
- Don't cache every potential sound.
- Add queue-play option to queue sounds.
- Reload internal list when rules updated.
- Doublecheck windows file update hook
- Laugh at people reporting themselves
4 changes: 2 additions & 2 deletions src/imp.pro
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#-------------------------------------------------
d#-------------------------------------------------
#
# Project created by QtCreator 2016-09-06T09:06:05
#
Expand All @@ -13,7 +13,7 @@ QT += xml xmlpatterns svg widgets
TARGET = imp
TEMPLATE = app

VERSION = 0.9.6.1
VERSION = 0.9.7
QMAKE_TARGET_COMPANY = EternalDusk
QMAKE_TARGET_DESCRIPTION = Eve Online Intelligence Management Program
QMAKE_TARGET_COPYRIGHT = (c) Copyright 2016-2017 Jesse Litton
Expand Down
54 changes: 47 additions & 7 deletions src/logcatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,43 @@ void LogCatcher::fallbackPoller()
}
}

int LogCatcher::compareLastFileSize(QFileInfo fileInfo, QFileInfoList oldList)
{
foreach(QFileInfo oldInfo, oldList)
{
if(oldInfo.absoluteFilePath() == fileInfo.absoluteFilePath())
{
// Return the number of bytes different in file size
return fileInfo.size() - oldInfo.size();
}
}

// Files are the same, or file was not found in old list.
return 0;
}

void LogCatcher::findCurrentLogs(const QString& dirName)
{
#ifdef USE_FALLBACK_POLLER
//fallbackPollTimer->stop();
rebuilding = true;
#endif

// TOFIX: On Windows, timestamps don't change until the file is flushed. So, if
// someone logs on a second character which has the same open channels,
// that characters channel files will start to get used. Then, if they
// log that character off, it still has the newer timestamps and IMP
// will look at the non-changing file rather than go back to looking
// at the one from the first character.
//
// Solution: Cache the timestamp, size, and line position of the files
// on Windows. Use newest file where size has changed.

QFileInfoList lastInfoList;
if(infoList.count() > 0)
{
lastInfoList = infoList;
infoList.clear();
}

QRegExp logNameRegEx("(.*)_[0-9]+_[0-9]+\\.txt$");

Expand All @@ -126,10 +154,17 @@ void LogCatcher::findCurrentLogs(const QString& dirName)
continue;
}

if (fileInfo.lastModified() > (QDateTime::currentDateTime().addDays(-1))) {
// All files that have changed since last pass or were created in the last day.
if (fileInfo.lastModified() > (QDateTime::currentDateTime().addDays(-1))
|| (lastInfoList.count() > 0 && compareLastFileSize(fileInfo, lastInfoList) > 0))
{

// We only put non-local channels in the list once, no matter how many pilots
// are in them.
//
// The exception is when the older file is growing and the newer one is
// not - which means they logged on a second character, creating a newer
// file, then logged that character out.

QString channelName = logNameRegEx.cap(1);
if(!localChannels.contains(channelName))
Expand All @@ -138,23 +173,28 @@ void LogCatcher::findCurrentLogs(const QString& dirName)
while (i.hasNext()) {
QString iFileName = i.next().fileName();
QString iChanName = iFileName.left(iFileName.length() - 20);
if (iChanName == channelName) {
if (i.value().lastModified() < fileInfo.lastModified()) {
qDebug() << "LogCatcher::findCurrentLogs: Found newer log for " << iChanName;
if (iChanName == channelName)
{
// If file has changed and file is newer than what we already
// have in list, remove what we previously put in list.
if ((lastInfoList.size() == 0 ||
compareLastFileSize(fileInfo, lastInfoList)) &&
(i.value().lastModified() < fileInfo.lastModified()))
{
qDebug() << "LogCatcher::findCurrentLogs: Found newer or changed log for " << iChanName;
qDebug() << " ignoring " << iFileName;
qDebug() << " in favor of " << fileInfo.fileName();
i.remove();
}
}
}
}

infoList.append(fileInfo);
}
}
}

#ifdef USE_FALLBACK_POLLER
//fallbackPollTimer->start(pollerInterval);
rebuilding = false;
#else

Expand Down
2 changes: 2 additions & 0 deletions src/logcatcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public slots:
int pollerInterval = 1000;
bool rebuilding = false;
bool firstPass = true;

int compareLastFileSize(QFileInfo fileInfo, QFileInfoList oldList);
};

#endif // LOGCATCHER_H
3 changes: 2 additions & 1 deletion src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,8 @@ QString Map::getSystemByAbbreviation(const QString& word)
}

// Still no match? Maybe they mispelled it, like people do with 9-F0B2 (9-fob)
if(upperWord.contains('-') && upperWord.contains('O'))
// if(upperWord.contains('-') && upperWord.contains('O'))
if(upperWord.contains('O'))
{
upperWord.replace('O', '0');
return getSystemByAbbreviation(upperWord);
Expand Down
4 changes: 2 additions & 2 deletions src/meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ static const struct Version
{
Version(){}

QString release = "0.9.6.1"; //VERSION;
QString name = "SFML OpenAL FML";
QString release = "0.9.7"; //VERSION;
QString name = "Black Exoplanet";

QString styleHeader1 = "<span style=\" color:#0000ff;\">";
QString styleFooter1 = "</span>";
Expand Down

0 comments on commit 5a74909

Please sign in to comment.