no bug - Bumping Thunderbird l10n changesets r=release a=l10n-bump DONTBUILD
ast -> 85a961d250a508f263c17cad193a1e22d2c3cda4
el -> e854408efa0e739e3c22f0d8ab9d4b627927aa0b
fr -> 110114d176859c191c39d7457f76c5c9247b6a25
it -> 3ab129cf7624f59655156d7a11dfbee4999e9359
pt-BR -> d8b467ec60373a43391d3d3f9f4f773e301076a1
pt-PT -> eb0f997231b20e39cfe263e5168f2c9f6f8aadc1
zh-CN -> 177af21d2e347c7735cc5282b0fa3d5949ff94dc
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "msgCore.h"
#include "nntpCore.h"
#include "nsNewsUtils.h"
#include "nsMsgUtils.h"
/* parses NewsMessageURI */
nsresult nsParseNewsMessageURI(const char* uri, nsCString& group,
nsMsgKey* key) {
NS_ENSURE_ARG_POINTER(uri);
NS_ENSURE_ARG_POINTER(key);
nsAutoCString uriStr(uri);
int32_t keySeparator = uriStr.FindChar('#');
if (keySeparator != -1) {
int32_t keyEndSeparator = MsgFindCharInSet(uriStr, "?&", keySeparator);
// Grab between the last '/' and the '#' for the key
group = StringHead(uriStr, keySeparator);
int32_t groupSeparator = group.RFind("/");
if (groupSeparator == -1) return NS_ERROR_FAILURE;
// Our string APIs don't let us unescape into the same buffer from earlier,
// so escape into a temporary
nsAutoCString unescapedGroup;
MsgUnescapeString(Substring(group, groupSeparator + 1), 0, unescapedGroup);
group = unescapedGroup;
nsAutoCString keyStr;
if (keyEndSeparator != -1)
keyStr = Substring(uriStr, keySeparator + 1,
keyEndSeparator - (keySeparator + 1));
else
keyStr = Substring(uriStr, keySeparator + 1);
nsresult errorCode;
*key = keyStr.ToInteger(&errorCode);
return errorCode;
}
return NS_ERROR_FAILURE;
}
nsresult nsCreateNewsBaseMessageURI(const char* baseURI,
nsCString& baseMessageURI) {
nsAutoCString tailURI(baseURI);
// chop off news:/
if (tailURI.Find(kNewsRootURI) == 0) tailURI.Cut(0, PL_strlen(kNewsRootURI));
baseMessageURI = kNewsMessageRootURI;
baseMessageURI += tailURI;
return NS_OK;
}