Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/netconnection.cc')
-rw-r--r--src/core/netconnection.cc33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/core/netconnection.cc b/src/core/netconnection.cc
index fc2b6bf..dfb86f7 100644
--- a/src/core/netconnection.cc
+++ b/src/core/netconnection.cc
@@ -410,6 +410,16 @@ void NetConnection::send_ping_reply(unsigned long timestamp)
this->send_raw(msg.str());
}
+// send an info record request
+void NetConnection::send_info_request(Info *info)
+{
+ std::ostringstream msg;
+ msg << "inf " << '"' << info->label() << '"' << '\n';
+ this->send_raw(msg.str());
+
+ info->set_timestamp(application()->timestamp());
+}
+
// parse incoming client messages
/**
* The following incoming messages are parsed;
@@ -674,7 +684,28 @@ void NetConnection::parse_incoming_message(const std::string & message)
return;
}
}
-
+ } else if (command == "inf") {
+
+ // incoming info record
+ std::string label;
+ char c;
+
+ while ( (msgstream.get(c)) && (c != '"'));
+ while ( (msgstream.get(c)) && (c != '"'))
+ label += c;
+
+ if (label.size()) {
+ Info *info = Info::find(label);
+ if (!info) {
+ info = new Info(label);
+ Info::add(info);
+ }
+
+ info->receive_server_update(msgstream);
+ info->clear_timestamp();
+ } else {
+ con_warn << "Received empty information record!" << std::endl;
+ }
} else if (command == "sup") {
if (connection_state == Connected)
{