summaryrefslogtreecommitdiff
path: root/cpp/demo/Glacier2/chat/Client.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2005-04-06 04:41:19 +0000
committerMatthew Newhook <matthew@zeroc.com>2005-04-06 04:41:19 +0000
commitb53c71eeee1b25030a1a0dd45c9d1ebcfec5b2e0 (patch)
treee3c4647c0a469a6a3330ce9cac5dc62b189529a5 /cpp/demo/Glacier2/chat/Client.cpp
parentfix for bug 204 (diff)
downloadice-b53c71eeee1b25030a1a0dd45c9d1ebcfec5b2e0.tar.bz2
ice-b53c71eeee1b25030a1a0dd45c9d1ebcfec5b2e0.tar.xz
ice-b53c71eeee1b25030a1a0dd45c9d1ebcfec5b2e0.zip
merge with 2.1 branch.
Diffstat (limited to 'cpp/demo/Glacier2/chat/Client.cpp')
-rwxr-xr-xcpp/demo/Glacier2/chat/Client.cpp49
1 files changed, 22 insertions, 27 deletions
diff --git a/cpp/demo/Glacier2/chat/Client.cpp b/cpp/demo/Glacier2/chat/Client.cpp
index 786d3bfcf3c..22c7cacd390 100755
--- a/cpp/demo/Glacier2/chat/Client.cpp
+++ b/cpp/demo/Glacier2/chat/Client.cpp
@@ -20,7 +20,7 @@ class ChatCallbackI : public ChatCallback
public:
virtual void
- message(const string& data, const Ice::Current&)
+ message(const string& data, const Current&)
{
cout << data << endl;
}
@@ -56,12 +56,12 @@ public:
string id;
cout << "user id: " << flush;
- std::getline(cin, id);
+ getline(cin, id);
id = trim(id);
string pw;
cout << "password: " << flush;
- std::getline(cin, pw);
+ getline(cin, pw);
pw = trim(pw);
try
@@ -88,42 +88,39 @@ public:
session->setCallback(callback);
menu();
- do
+
+ try
{
- try
+ do
{
string s;
cout << "==> ";
- std::getline(cin, s);
+ getline(cin, s);
s = trim(s);
- if(s.empty())
- {
- continue;
- }
- if(s[0] == '/')
+ if(!s.empty())
{
- if(s == "/quit")
+ if(s[0] == '/')
{
- session->destroy();
- break;
+ if(s == "/quit")
+ {
+ break;
+ }
+ menu();
}
else
{
- menu();
+ session->say(s);
}
}
- else
- {
- session->say(s);
- }
- }
- catch(const Exception& ex)
- {
- cerr << ex << endl;
- return EXIT_FAILURE;
}
+ while(cin.good());
+ router->destroySession();
+ }
+ catch(const Exception& ex)
+ {
+ cerr << ex << endl;
+ return EXIT_FAILURE;
}
- while(cin.good());
return EXIT_SUCCESS;
}
@@ -155,5 +152,3 @@ main(int argc, char* argv[])
ChatClient app;
return app.main(argc, argv, "config");
}
-
-