mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 15:39:27 -05:00
FeedReader:
- Remove "sid=" from link Moved stringToUpperCase and stringToLowerCase from rsinit.cc to util/rsstring.cc git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6029 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
e66a9117e2
commit
0f26b85a88
@ -201,28 +201,6 @@ bool RsInitConfig::udpListenerOnly;
|
|||||||
static bool getAvailableAccounts(std::list<accountId> &ids,int& failing_accounts,std::map<std::string,std::vector<std::string> >& unsupported_keys);
|
static bool getAvailableAccounts(std::list<accountId> &ids,int& failing_accounts,std::map<std::string,std::vector<std::string> >& unsupported_keys);
|
||||||
static bool checkAccount(std::string accountdir, accountId &id,std::map<std::string,std::vector<std::string> >& unsupported_keys);
|
static bool checkAccount(std::string accountdir, accountId &id,std::map<std::string,std::vector<std::string> >& unsupported_keys);
|
||||||
|
|
||||||
static std::string toUpperCase(const std::string& s)
|
|
||||||
{
|
|
||||||
std::string res(s) ;
|
|
||||||
|
|
||||||
for(uint32_t i=0;i<res.size();++i)
|
|
||||||
if(res[i] > 96 && res[i] < 123)
|
|
||||||
res[i] -= 97-65 ;
|
|
||||||
|
|
||||||
return res ;
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::string toLowerCase(const std::string& s)
|
|
||||||
{
|
|
||||||
std::string res(s) ;
|
|
||||||
|
|
||||||
for(uint32_t i=0;i<res.size();++i)
|
|
||||||
if(res[i] > 64 && res[i] < 91)
|
|
||||||
res[i] += 97-65 ;
|
|
||||||
|
|
||||||
return res ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RsInit::InitRsConfig()
|
void RsInit::InitRsConfig()
|
||||||
{
|
{
|
||||||
#ifndef WINDOWS_SYS
|
#ifndef WINDOWS_SYS
|
||||||
@ -655,8 +633,10 @@ int RsInit::InitRetroShare(int argcIgnored, char **argvIgnored, bool strictCheck
|
|||||||
|
|
||||||
// if a different user id has been passed to cmd line check for that instead
|
// if a different user id has been passed to cmd line check for that instead
|
||||||
|
|
||||||
std::string lower_case_user_string = toLowerCase(prefUserString) ;
|
std::string lower_case_user_string;
|
||||||
std::string upper_case_user_string = toUpperCase(prefUserString) ;
|
stringToLowerCase(prefUserString, lower_case_user_string) ;
|
||||||
|
std::string upper_case_user_string;
|
||||||
|
stringToUpperCase(prefUserString, upper_case_user_string) ;
|
||||||
|
|
||||||
bool pgpNameFound = false;
|
bool pgpNameFound = false;
|
||||||
if(prefUserString != "")
|
if(prefUserString != "")
|
||||||
|
@ -269,3 +269,21 @@ int rs_sprintf_append(std::string &str, const char *fmt, ...)
|
|||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void stringToUpperCase(const std::string& s, std::string &upper)
|
||||||
|
{
|
||||||
|
upper = s ;
|
||||||
|
|
||||||
|
for(uint32_t i=0;i<upper.size();++i)
|
||||||
|
if(upper[i] > 96 && upper[i] < 123)
|
||||||
|
upper[i] -= 97-65 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void stringToLowerCase(const std::string& s, std::string &lower)
|
||||||
|
{
|
||||||
|
lower = s ;
|
||||||
|
|
||||||
|
for(uint32_t i=0;i<lower.size();++i)
|
||||||
|
if(lower[i] > 64 && lower[i] < 91)
|
||||||
|
lower[i] += 97-65 ;
|
||||||
|
}
|
||||||
|
@ -42,4 +42,7 @@ bool ConvertUtf16ToUtf8(const std::wstring& source, std::string& dest);
|
|||||||
int rs_sprintf(std::string &str, const char *fmt, ...);
|
int rs_sprintf(std::string &str, const char *fmt, ...);
|
||||||
int rs_sprintf_append(std::string &str, const char *fmt, ...);
|
int rs_sprintf_append(std::string &str, const char *fmt, ...);
|
||||||
|
|
||||||
|
void stringToUpperCase(const std::string& s, std::string &upper);
|
||||||
|
void stringToLowerCase(const std::string& s, std::string &lower);
|
||||||
|
|
||||||
#endif // RSSTRING_H_
|
#endif // RSSTRING_H_
|
||||||
|
@ -863,29 +863,28 @@ RsFeedReaderErrorState p3FeedReaderThread::process(const RsFeedReaderFeed &feed,
|
|||||||
xml.getChildText(node, "link", item->link);
|
xml.getChildText(node, "link", item->link);
|
||||||
}
|
}
|
||||||
|
|
||||||
long todo; // remove sid
|
// remove sid=
|
||||||
// // remove sid=
|
std::string linkUpper;
|
||||||
// CString sLinkUpper = sLink;
|
stringToUpperCase(item->link, linkUpper);
|
||||||
// sLinkUpper.MakeUpper ();
|
std::string::size_type sidStart = linkUpper.find("SID=");
|
||||||
// int nSIDStart = sLinkUpper.Find (TEXT("SID="));
|
if (sidStart != std::string::npos) {
|
||||||
// if (nSIDStart != -1) {
|
std::string::size_type sidEnd1 = linkUpper.find(";", sidStart);
|
||||||
// int nSIDEnd1 = sLinkUpper.Find (TEXT(";"), nSIDStart);
|
std::string::size_type sidEnd2 = linkUpper.find("#", sidStart);
|
||||||
// int nSIDEnd2 = sLinkUpper.Find (TEXT("#"), nSIDStart);
|
|
||||||
|
|
||||||
// if (nSIDEnd1 == -1) {
|
if (sidEnd1 == std::string::npos) {
|
||||||
// nSIDEnd1 = sLinkUpper.GetLength ();
|
sidEnd1 = linkUpper.size();
|
||||||
// }
|
}
|
||||||
// if (nSIDEnd2 == -1) {
|
if (sidEnd2 == std::string::npos) {
|
||||||
// nSIDEnd2 = sLinkUpper.GetLength ();
|
sidEnd2 = linkUpper.size();
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (nSIDStart > 0 && sLinkUpper [nSIDStart - 1] == '&') {
|
if (sidStart > 0 && linkUpper[sidStart - 1] == '&') {
|
||||||
// nSIDStart--;
|
sidStart--;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// int nSIDEnd = min (nSIDEnd1, nSIDEnd2);
|
std::string::size_type sidEnd = std::min(sidEnd1, sidEnd2);
|
||||||
// sLink.Delete (nSIDStart, nSIDEnd - nSIDStart);
|
item->link.erase(sidStart, sidEnd - sidStart);
|
||||||
// }
|
}
|
||||||
|
|
||||||
xml.getChildText(node, "author", item->author);
|
xml.getChildText(node, "author", item->author);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user