OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // A simple client implements a minimalize Chromoting client and shows | 5 // A simple client implements a minimalize Chromoting client and shows |
6 // network traffic for debugging. | 6 // network traffic for debugging. |
7 | 7 |
8 #include <iostream> | 8 #include <iostream> |
9 #include <list> | 9 #include <list> |
10 | 10 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 std::cout << "JID [" << default_username << "]: "; | 169 std::cout << "JID [" << default_username << "]: "; |
170 getline(std::cin, username); | 170 getline(std::cin, username); |
171 if (username.length() == 0) { | 171 if (username.length() == 0) { |
172 username = default_username; | 172 username = default_username; |
173 } | 173 } |
174 if (username.length() == 0) { | 174 if (username.length() == 0) { |
175 std::cerr << "Error: Expected valid JID username" << std::endl; | 175 std::cerr << "Error: Expected valid JID username" << std::endl; |
176 return 1; | 176 return 1; |
177 } | 177 } |
178 | 178 |
179 // Get auth token. | 179 // Get password (with console echo turned off). |
180 std::string auth_token; | 180 std::string password; |
181 std::cout << "Auth Token: "; | 181 SetConsoleEcho(false); |
182 getline(std::cin, auth_token); | 182 std::cout << "Password: "; |
| 183 getline(std::cin, password); |
| 184 SetConsoleEcho(true); |
| 185 std::cout << std::endl; |
183 | 186 |
184 // The message loop that everything runs on. | 187 // The message loop that everything runs on. |
185 MessageLoop main_loop; | 188 MessageLoop main_loop; |
186 SimpleHostEventHandler handler(&main_loop); | 189 SimpleHostEventHandler handler(&main_loop); |
187 HostConnection connection(new ProtocolDecoder(), &handler); | 190 HostConnection connection(new ProtocolDecoder(), &handler); |
188 connection.Connect(username, auth_token, host_jid); | 191 connection.Connect(username, password, host_jid); |
189 | 192 |
190 // Run the message. | 193 // Run the message. |
191 main_loop.Run(); | 194 main_loop.Run(); |
192 return 0; | 195 return 0; |
193 } | 196 } |
OLD | NEW |