Skip to content
/ i2pd Public
forked from PurpleI2P/i2pd

Commit

Permalink
change part for replace
Browse files Browse the repository at this point in the history
  • Loading branch information
xcps committed Feb 28, 2016
1 parent 7b39a12 commit 8799f90
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions I2PTunnel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,26 +243,24 @@ namespace client

void I2PTunnelConnectionIRC::Write (const uint8_t * buf, size_t len)
{
char *p = (char*)(buf + len);
*p = '\0';
std::string line;
m_OutPacket.str ("");
m_InPacket.str ("");
m_InPacket.clear ();
m_InPacket.write ((const char *)buf, len);

while (!m_InPacket.eof () && !m_InPacket.fail ())
{
std::getline (m_InPacket, line);
if (line.length () == 0 && m_InPacket.eof ()) {
m_InPacket.str ("");
}
auto pos = line.find ("USER");
if (pos != std::string::npos && pos == 0)
{
pos = line.find (" ");
pos++;
pos = line.find (" ", pos);
pos++;
pos = line.find (" ", pos);
pos++;
auto nextpos = line.find (" ", pos);
m_OutPacket << line.substr (0, pos);
m_OutPacket << context.GetAddressBook ().ToAddress (m_From->GetIdentHash ());
Expand Down

0 comments on commit 8799f90

Please sign in to comment.