diff options
author | Stefan Hacker <dd0t@users.sourceforge.net> | 2011-04-02 16:41:30 +0400 |
---|---|---|
committer | Stefan Hacker <dd0t@users.sourceforge.net> | 2011-04-02 16:44:09 +0400 |
commit | a972df68de953b05099abacc9f28682274a6341e (patch) | |
tree | 58f105c24cc0f3226e20af496894d98755ba1f10 /plugins/tf2 | |
parent | 4a98c74cebc64ff83de6692d6ce6a5d918090213 (diff) |
Convert context field to json
Diffstat (limited to 'plugins/tf2')
-rw-r--r-- | plugins/tf2/tf2.cpp | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/plugins/tf2/tf2.cpp b/plugins/tf2/tf2.cpp index 9537c31a8..fb455f4f1 100644 --- a/plugins/tf2/tf2.cpp +++ b/plugins/tf2/tf2.cpp @@ -93,22 +93,16 @@ static int fetch(float *avatar_pos, float *avatar_front, float *avatar_top, floa std::string sHost; sHost.assign(chHostStr); - if (sHost.find(':')==std::string::npos) - sHost.append(":27015"); - - std::ostringstream new_context; - new_context << "<context>" - << "<game>tf2</game>" - << "<hostport>" << sHost << "</hostport>" - << "</context>"; - context = new_context.str(); - - /* TODO - std::wostringstream new_identity; - new_identity << "<identity>" - << "<name>" << "SAS" << "</name>" - << "</identity>"; - identity = new_identity.str(); */ + if (!sHost.empty()) { + if (sHost.find(':') == std::string::npos) + sHost.append(":27015"); + + std::ostringstream new_context; + new_context << "{ \"ipport\": \"" << sHost << "\"}"; + context = new_context.str(); + } + + //TODO: Implement identity // Check to see if you are in a server and spawned if (state == 0 || state == 1 || state == 3) |