Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(525)

Unified Diff: remoting/signaling/jid_util.cc

Issue 1131653002: Use lower-case JIDs when generating signatures for messages sent to CRD bot. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/signaling/jid_util.h ('k') | remoting/signaling/jid_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/signaling/jid_util.cc
diff --git a/remoting/signaling/jid_util.cc b/remoting/signaling/jid_util.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8e8e12bb8788da5d03eb93f8046d190907c03caf
--- /dev/null
+++ b/remoting/signaling/jid_util.cc
@@ -0,0 +1,23 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/signaling/jid_util.h"
+
+#include "base/strings/string_util.h"
+
+namespace remoting {
+
+std::string NormalizeJid(const std::string& jid) {
+ size_t slash_pos = jid.find('/');
+
+ // In case there the jid doesn't have resource id covert the whole value to
+ // lower-case.
+ if (slash_pos == std::string::npos)
+ return base::StringToLowerASCII(jid);
+
+ return base::StringToLowerASCII(jid.substr(0, slash_pos)) +
+ jid.substr(slash_pos);
+}
+
+} // namespace remoting
« no previous file with comments | « remoting/signaling/jid_util.h ('k') | remoting/signaling/jid_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698