Commit a8363245 authored by Yuwei Huang's avatar Yuwei Huang Committed by Commit Bot

[Remoting Host] Make SignalingAddress accept new LCS JID format

We have added the `chromoting_lcs_` prefix to resource of an LCS JID. The
current code in SignalingAddress doesn't recognize the new format and
will believe the the new format is of XMPP connection.

This currently doesn't cause any issue after we change the format on
server and client because:
* For reply scenario, the connection type will be determined from the
  `from-channel` field instead of the JID format.
* For outgoing messages, the IQ message format is basically the same for
  LCS and XMPP connections, so IT2ME still magically works even though
  SignalingAddress believes the connection type is XMPP.

This CL cleans up the type inferring logic in SignalingAddress so that
future developers will not misuse it.

Bug: 798902
Change-Id: I66d5d1af4c7510d2dd2775769689288a9f2333e9
Reviewed-on: https://chromium-review.googlesource.com/889984Reviewed-by: default avatarJamie Walch <jamiewalch@chromium.org>
Commit-Queue: Yuwei Huang <yuweih@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533788}
parent 2ffece22
......@@ -50,10 +50,8 @@ buzz::QName GetQNameByField(Field attr, SignalingAddress::Direction direction) {
SignalingAddress::Channel GetChannelType(std::string address) {
std::string bare_jid;
std::string resource;
std::string decoded_resource;
if (SplitJidResource(address, &bare_jid, &resource) &&
base::Base64Decode(resource, &decoded_resource) &&
decoded_resource.find("chromoting_lcs") != std::string::npos) {
resource.find("chromoting_lcs_") == 0) {
return SignalingAddress::Channel::LCS;
}
return SignalingAddress::Channel::XMPP;
......
......@@ -22,8 +22,8 @@ std::unique_ptr<buzz::XmlElement> GetEmptyJingleMessage() {
}
constexpr char kLcsAddress[] =
"user@domain.com/EhprZWx2aW4udGVzdC5nYWlhQGdtYWlsLmN"
"vbRoOY2hyb21vdGluZ19sY3MiHgoKY2hyb21vdGluZxIQaEEwZF9LZ3dvR1IwMXRJdg==";
"user@domain.com/chromoting_lcs_KkMKIDB5NldsZndLalZZamZWVTZlYmhPT1RBa2p2TUl"
"GX0lvEKT-HRhwIhB1V3QxYVkwdUptWlc3bnIxKVYHxmgZQ7i7";
} // namespace
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment