|
|
@ -275,26 +275,24 @@ namespace client |
|
|
|
|
|
|
|
|
|
|
|
void I2PTunnelConnectionIRC::Write (const uint8_t * buf, size_t len) |
|
|
|
void I2PTunnelConnectionIRC::Write (const uint8_t * buf, size_t len) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (m_NeedsWebIrc) { |
|
|
|
|
|
|
|
m_NeedsWebIrc = false; |
|
|
|
|
|
|
|
m_OutPacket.str (""); |
|
|
|
m_OutPacket.str (""); |
|
|
|
m_OutPacket << "WEBIRC " << this->m_WebircPass << " cgiirc " << context.GetAddressBook ().ToAddress (m_From->GetIdentHash ()) << " 127.0.0.1\n"; |
|
|
|
if (m_NeedsWebIrc) |
|
|
|
I2PTunnelConnection::Write ((uint8_t *)m_OutPacket.str ().c_str (), m_OutPacket.str ().length ()); |
|
|
|
{ |
|
|
|
|
|
|
|
m_NeedsWebIrc = false; |
|
|
|
|
|
|
|
m_OutPacket << "WEBIRC " << m_WebircPass << " cgiirc " << context.GetAddressBook ().ToAddress (m_From->GetIdentHash ()) << " 127.0.0.1\n"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
std::string line; |
|
|
|
|
|
|
|
m_OutPacket.str (""); |
|
|
|
|
|
|
|
m_InPacket.clear (); |
|
|
|
m_InPacket.clear (); |
|
|
|
m_InPacket.write ((const char *)buf, len); |
|
|
|
m_InPacket.write ((const char *)buf, len); |
|
|
|
|
|
|
|
|
|
|
|
while (!m_InPacket.eof () && !m_InPacket.fail ()) |
|
|
|
while (!m_InPacket.eof () && !m_InPacket.fail ()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
std::string line; |
|
|
|
std::getline (m_InPacket, line); |
|
|
|
std::getline (m_InPacket, line); |
|
|
|
if (line.length () == 0 && m_InPacket.eof ()) { |
|
|
|
if (line.length () == 0 && m_InPacket.eof ()) |
|
|
|
m_InPacket.str (""); |
|
|
|
m_InPacket.str (""); |
|
|
|
} |
|
|
|
|
|
|
|
auto pos = line.find ("USER"); |
|
|
|
auto pos = line.find ("USER"); |
|
|
|
if (pos != std::string::npos && pos == 0) |
|
|
|
if (!pos) // start of line
|
|
|
|
{ |
|
|
|
{ |
|
|
|
pos = line.find (" "); |
|
|
|
pos = line.find (" "); |
|
|
|
pos++; |
|
|
|
pos++; |
|
|
@ -304,9 +302,9 @@ namespace client |
|
|
|
m_OutPacket << line.substr (0, pos); |
|
|
|
m_OutPacket << line.substr (0, pos); |
|
|
|
m_OutPacket << context.GetAddressBook ().ToAddress (m_From->GetIdentHash ()); |
|
|
|
m_OutPacket << context.GetAddressBook ().ToAddress (m_From->GetIdentHash ()); |
|
|
|
m_OutPacket << line.substr (nextpos) << '\n'; |
|
|
|
m_OutPacket << line.substr (nextpos) << '\n'; |
|
|
|
} else { |
|
|
|
|
|
|
|
m_OutPacket << line << '\n'; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
m_OutPacket << line << '\n'; |
|
|
|
} |
|
|
|
} |
|
|
|
I2PTunnelConnection::Write ((uint8_t *)m_OutPacket.str ().c_str (), m_OutPacket.str ().length ()); |
|
|
|
I2PTunnelConnection::Write ((uint8_t *)m_OutPacket.str ().c_str (), m_OutPacket.str ().length ()); |
|
|
|
} |
|
|
|
} |
|
|
|