Commit 7cd2f57cda861577a9198b7ef890841ed83aa41f
1 parent
36f0e271
Adapt print() method to the case that no Hub has been found.
Showing
1 changed file
with
19 additions
and
16 deletions
src/vo/GVOClient.cpp
| ... | ... | @@ -281,26 +281,29 @@ std::string GVOClient::print(void) const |
| 281 | 281 | result.append("\n"+parformat("Name")+m_name); |
| 282 | 282 | |
| 283 | 283 | // Append Hub information |
| 284 | - result.append("\n"+parformat("Hub key")+m_secret); | |
| 285 | - result.append("\n"+parformat("Hub URL")+m_hub_url); | |
| 286 | - result.append("\n"+parformat("Hub host (port)")+m_hub_host+" ("+m_hub_port+")"); | |
| 287 | - result.append("\n"+parformat("SAMP protocol version")+m_version); | |
| 288 | - | |
| 289 | - // Append connection information | |
| 290 | - result.append("\n"+parformat("Hub connection")); | |
| 291 | - if (m_socket == -1) { | |
| 292 | - result.append("no"); | |
| 293 | - } | |
| 294 | - else { | |
| 295 | - if (!m_client_key.empty()) { | |
| 296 | - result.append("registered as \""+m_client_id); | |
| 297 | - result.append("\" on Hub \""+m_hub_id); | |
| 298 | - result.append("\" via socket "+str(m_socket)); | |
| 284 | + if (hashub()) { | |
| 285 | + result.append("\n"+parformat("Hub key")+m_secret); | |
| 286 | + result.append("\n"+parformat("Hub URL")+m_hub_url); | |
| 287 | + result.append("\n"+parformat("Hub host (port)")+m_hub_host+" ("+m_hub_port+")"); | |
| 288 | + result.append("\n"+parformat("SAMP protocol version")+m_version); | |
| 289 | + result.append("\n"+parformat("Hub connection")); | |
| 290 | + if (m_socket == -1) { | |
| 291 | + result.append("no"); | |
| 299 | 292 | } |
| 300 | 293 | else { |
| 301 | - result.append("established on socket "+str(m_socket)); | |
| 294 | + if (!m_client_key.empty()) { | |
| 295 | + result.append("registered as \""+m_client_id); | |
| 296 | + result.append("\" on Hub \""+m_hub_id); | |
| 297 | + result.append("\" via socket "+str(m_socket)); | |
| 298 | + } | |
| 299 | + else { | |
| 300 | + result.append("established on socket "+str(m_socket)); | |
| 301 | + } | |
| 302 | 302 | } |
| 303 | 303 | } |
| 304 | + else { | |
| 305 | + result.append("\n"+parformat("Hub key")+"No Hub has been found"); | |
| 306 | + } | |
| 304 | 307 | |
| 305 | 308 | // Return result |
| 306 | 309 | return result; | ... | ... |