#include "Server.ih"
// Custom includes
-#include <unistd.h>
#include <iostream>
#include <boost/algorithm/string/trim.hpp>
#include <boost/iostreams/device/file_descriptor.hpp>
{
std::string prompt (promptString());
- stream() << prompt << std::flush;
+ stream() << std::flush;
+ handle().write(prompt);
promptLen_ = prompt.size();
promptActive_ = true;
}
: out_t(boost::ref(*this)), senf::log::IOStreamTarget(out_t::member), server_ (server),
handle_ (handle), name_ (name), reader_ (new detail::SafeReadlineClientReader (*this))
{
+ executor_.autocd(true).autocomplete(true);
handle_.facet<senf::TCPSocketProtocol>().nodelay();
// route< senf::SenfLog, senf::log::NOTICE >();
}
}
}
-prefix_ void senf::console::Client::v_write(boost::posix_time::ptime timestamp,
+prefix_ void senf::console::Client::v_write(senf::log::time_type timestamp,
std::string const & stream,
std::string const & area, unsigned level,
std::string const & message)
reader_->enablePrompt();
}
+prefix_ std::ostream & senf::console::operator<<(std::ostream & os, Client const & client)
+{
+ typedef ClientSocketHandle< MakeSocketPolicy<
+ INet4AddressingPolicy,ConnectedCommunicationPolicy>::policy > V4Socket;
+ typedef ClientSocketHandle< MakeSocketPolicy<
+ INet6AddressingPolicy,ConnectedCommunicationPolicy>::policy > V6Socket;
+
+ if (check_socket_cast<V4Socket>(client.handle()))
+ os << dynamic_socket_cast<V4Socket>(client.handle()).peer();
+ else if (check_socket_cast<V6Socket>(client.handle()))
+ os << dynamic_socket_cast<V6Socket>(client.handle()).peer();
+ else
+ os << static_cast<void const *>(&client);
+
+ return os;
+}
+
+prefix_ std::ostream & senf::console::operator<<(std::ostream & os, Client * client)
+{
+ return os << *client;
+}
+
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
//#include "Server.mpp"