1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-09 07:17:53 +00:00

Merge pull request #398 from xcps/irc_ip2b32

irc tunnel
This commit is contained in:
orignal 2016-02-28 16:19:19 -05:00
commit 918884bd11

View File

@ -243,17 +243,17 @@ namespace client
void I2PTunnelConnectionIRC::Write (const uint8_t * buf, size_t len) void I2PTunnelConnectionIRC::Write (const uint8_t * buf, size_t len)
{ {
char *p = (char*)(buf + len);
*p = '\0';
std::string line; std::string line;
m_OutPacket.str (""); m_OutPacket.str ("");
m_InPacket.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::getline (m_InPacket, line); std::getline (m_InPacket, line);
if (line.length () == 0 && m_InPacket.eof ()) {
m_InPacket.str ("");
}
auto pos = line.find ("USER"); auto pos = line.find ("USER");
if (pos != std::string::npos && pos == 0) if (pos != std::string::npos && pos == 0)
{ {
@ -261,8 +261,6 @@ namespace client
pos++; pos++;
pos = line.find (" ", pos); pos = line.find (" ", pos);
pos++; pos++;
pos = line.find (" ", pos);
pos++;
auto nextpos = line.find (" ", pos); auto nextpos = line.find (" ", pos);
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 ());