From d7447cdf9e4df3c345218886ab2bae0e0cc4fc55 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Fri, 1 Jun 2012 20:51:15 +0300 Subject: Implement sign using form field protocol --- src/client.cpp | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) (limited to 'src/client.cpp') diff --git a/src/client.cpp b/src/client.cpp index 72667a528..84cae8f97 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1740,33 +1740,23 @@ void Client::interact(u8 action, const PointedThing& pointed) Send(0, data, true); } -void Client::sendSignNodeText(v3s16 p, std::string text) +void Client::sendNodemetaFields(v3s16 p, const std::string &formname, + const std::map &fields) { - /* - u16 command - v3s16 p - u16 textlen - textdata - */ std::ostringstream os(std::ios_base::binary); - u8 buf[12]; - - // Write command - writeU16(buf, TOSERVER_SIGNNODETEXT); - os.write((char*)buf, 2); - - // Write p - writeV3S16(buf, p); - os.write((char*)buf, 6); - u16 textlen = text.size(); - // Write text length - writeS16(buf, textlen); - os.write((char*)buf, 2); + writeU16(os, TOSERVER_NODEMETA_FIELDS); + writeV3S16(os, p); + os<::const_iterator + i = fields.begin(); i != fields.end(); i++){ + const std::string &name = i->first; + const std::string &value = i->second; + os< data((u8*)s.c_str(), s.size()); -- cgit v1.2.3