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 password (with console echo turned off). | 179 // Get auth token. |
180 std::string password; | 180 std::string auth_token; |
181 SetConsoleEcho(false); | 181 std::cout << "Auth Token: "; |
182 std::cout << "Password: "; | 182 getline(std::cin, auth_token); |
183 getline(std::cin, password); | |
184 SetConsoleEcho(true); | |
185 std::cout << std::endl; | |
186 | 183 |
187 // The message loop that everything runs on. | 184 // The message loop that everything runs on. |
188 MessageLoop main_loop; | 185 MessageLoop main_loop; |
189 SimpleHostEventHandler handler(&main_loop); | 186 SimpleHostEventHandler handler(&main_loop); |
190 HostConnection connection(new ProtocolDecoder(), &handler); | 187 HostConnection connection(new ProtocolDecoder(), &handler); |
191 connection.Connect(username, password, host_jid); | 188 connection.Connect(username, auth_token, host_jid); |
192 | 189 |
193 // Run the message. | 190 // Run the message. |
194 main_loop.Run(); | 191 main_loop.Run(); |
195 return 0; | 192 return 0; |
196 } | 193 } |
OLD | NEW |