Skip to content

Commit

Permalink
Force Qt4.8 serialization and do not convert from Ascii to Latin1 for…
Browse files Browse the repository at this point in the history
… Telnet characters
  • Loading branch information
nschimme committed Jan 18, 2015
1 parent 238fad9 commit 4025e94
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ else()
endif()

# Version
set(VERSION "2.3.0")
set(VERSION "2.3.1")
add_definitions(-DMMAPPER_VERSION="${VERSION}" -DWITH_SPLASH)
message(STATUS "MMapper version ${VERSION} (${CMAKE_BUILD_TYPE} distribution)")

Expand Down
7 changes: 7 additions & 0 deletions NEWS.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
=============================
MMapper 2.3.1 (January 17, 2015)
Changes:
- Telnet characters now parsed correctly (nschimme)
- Info marks load correctly (nschimme)
- Updated base map with the new zones (nschimme)

=============================
MMapper 2.3.0 (January 17, 2015)
Changes:
Expand Down
Binary file modified map/arda.mm2
Binary file not shown.
6 changes: 6 additions & 0 deletions src/mapstorage/mapstorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,11 @@ bool MapStorage::mergeData()
if ( version != 031 && version != 030 &&
version != 020 && version != 021 && version != 007 ) return false;

// We currently force serialization to Qt4.8 since Qt5 broke QDateTime serialization
// http://doc.qt.io/qt-5/sourcebreaks.html#changes-to-qdate-qtime-and-qdatetime
// http://doc.qt.io/qt-5/qdatastream.html#versioning
stream.setVersion(QDataStream::Qt_4_8);

// QtIOCompressor
if (version >= 031) {
m_compressor->open(QIODevice::ReadOnly);
Expand Down Expand Up @@ -877,6 +882,7 @@ bool MapStorage::saveData( bool baseMapOnly )
// Write a header with a "magic number" and a version
stream << (quint32)0xFFB2AF01;
stream << (qint32)031;
stream.setVersion(QDataStream::Qt_4_8);

// QtIOCompressor
m_compressor->open(QIODevice::WriteOnly);
Expand Down
30 changes: 15 additions & 15 deletions src/proxy/telnetfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void TelnetFilter::analyzeMudStream(const char * input, int length)
m_xmlModeAutoconfigured = true;
emit sendToMud((QByteArray)"brief\n");
emit sendToMud((QByteArray)"prompt all\n");
emit sendToMud((QByteArray)"cha prompt all\n");
if (Config().m_IAC_prompt_parser)
{
//send IAC-GA prompt request
Expand All @@ -127,7 +127,7 @@ void TelnetFilter::analyzeMudStream(const char * input, int length)
m_xmlModeAutoconfigured = true;
emit sendToMud((QByteArray)"brief\n");
emit sendToMud((QByteArray)"prompt all\n");
emit sendToMud((QByteArray)"cha prompt all\n");
if (Config().m_IAC_prompt_parser)
{
//send IAC-GA prompt request
Expand Down Expand Up @@ -157,7 +157,7 @@ void TelnetFilter::analyzeMudStream(const char * input, int length)
m_xmlModeAutoconfigured = true;

//emit sendToMud((QByteArray)"brief\n");
//emit sendToMud((QByteArray)"prompt all\n");
//emit sendToMud((QByteArray)"cha prompt all\n");
}
// XXX: fixed (I think) the logic in the line below. Not sure it's right.
// Alternative: ( recon && > ) || exits
Expand All @@ -166,7 +166,7 @@ void TelnetFilter::analyzeMudStream(const char * input, int length)
m_xmlMode = false;
m_xmlModeAutoconfigured = true;
//emit sendToMud((QByteArray)"brief\n");
emit sendToMud((QByteArray)"prompt all\n");
emit sendToMud((QByteArray)"cha prompt all\n");
}
}

Expand Down Expand Up @@ -225,7 +225,7 @@ void TelnetFilter::dispatchTelnetStream(QByteArray& stream, IncomingData &m_inco
switch (val1)
{
case ASCII_DEL:
m_incomingData.line.append(QChar::fromLatin1((char)ASCII_DEL));
m_incomingData.line.append((char)ASCII_DEL);

if(m_incomingData.type != TDT_TELNET)
{
Expand All @@ -252,7 +252,7 @@ void TelnetFilter::dispatchTelnetStream(QByteArray& stream, IncomingData &m_inco
}
//start incoming telnet command
m_incomingData.type = TDT_TELNET;
m_incomingData.line.append(QChar::fromLatin1((char)val1));
m_incomingData.line.append((char)val1);
index++;
break;

Expand All @@ -270,7 +270,7 @@ void TelnetFilter::dispatchTelnetStream(QByteArray& stream, IncomingData &m_inco
if (m_incomingData.type == TDT_TELNET)
{
//end incoming telnet command
m_incomingData.line.append(QChar::fromLatin1((char)val1));
m_incomingData.line.append((char)val1);
que.enqueue(m_incomingData);
m_incomingData.line.clear();
// if (val1 == TC_GA && Config().m_IAC_prompt_parser)
Expand All @@ -291,7 +291,7 @@ void TelnetFilter::dispatchTelnetStream(QByteArray& stream, IncomingData &m_inco
switch (val2)
{
case ASCII_LF:
m_incomingData.line.append(QChar::fromLatin1((char)ASCII_CR));
m_incomingData.line.append((char)ASCII_CR);
m_incomingData.type = TDT_LFCR;
{
que.enqueue(m_incomingData);
Expand All @@ -302,14 +302,14 @@ void TelnetFilter::dispatchTelnetStream(QByteArray& stream, IncomingData &m_inco
break;

default:
m_incomingData.line.append(QChar::fromLatin1((char)ASCII_CR));
m_incomingData.line.append((char)ASCII_CR);
index++;
break;
}
}
else
{
m_incomingData.line.append(QChar::fromLatin1((char)ASCII_CR));
m_incomingData.line.append((char)ASCII_CR);
index++;
break;
}
Expand All @@ -323,7 +323,7 @@ void TelnetFilter::dispatchTelnetStream(QByteArray& stream, IncomingData &m_inco
switch (val2)
{
case ASCII_CR:
m_incomingData.line.append(QChar::fromLatin1((char)ASCII_LF));
m_incomingData.line.append((char)ASCII_LF);
m_incomingData.type = TDT_CRLF;
{
que.enqueue(m_incomingData);
Expand All @@ -334,14 +334,14 @@ void TelnetFilter::dispatchTelnetStream(QByteArray& stream, IncomingData &m_inco
break;

default:
m_incomingData.line.append(QChar::fromLatin1((char)ASCII_LF));
m_incomingData.line.append((char)ASCII_LF);
index++;
break;
}
}
else
{
m_incomingData.line.append(QChar::fromLatin1((char)ASCII_LF));
m_incomingData.line.append((char)ASCII_LF);
index++;
break;
}
Expand All @@ -360,7 +360,7 @@ void TelnetFilter::dispatchTelnetStream(QByteArray& stream, IncomingData &m_inco
case TC_WONT:
case TC_WILL:
//end incoming telnet command
m_incomingData.line.append(QChar::fromLatin1((char)val1));
m_incomingData.line.append((char)val1);
{
que.enqueue(m_incomingData);
}
Expand All @@ -386,7 +386,7 @@ void TelnetFilter::dispatchTelnetStream(QByteArray& stream, IncomingData &m_inco
m_incomingData.type = TDT_SPLIT;
}

m_incomingData.line.append(QChar::fromLatin1((char)val1));
m_incomingData.line.append((char)val1);
index++;
break;
}
Expand Down

0 comments on commit 4025e94

Please sign in to comment.