Fix bug : answer lost attach name
This commit is contained in:
parent
64f3e49c37
commit
7e536fe229
@ -93,8 +93,8 @@ vector <string>
|
||||
Attachment::stringsToUpdate ({KAZ_PLAIN_START, "\""+CID});
|
||||
|
||||
// ================================================================================
|
||||
const string MainAttachment::templatePlainAddLink (" - "+TMPL_DOWNLOAD+" "+TMPL_FILENAME+"\n");
|
||||
const string MainAttachment::templatePlainAllLink ("\n"+KAZ_PLAIN_DOWLOAD_ALL+"\n * "+TMPL_DOWNLOAD+"\n");
|
||||
const string MainAttachment::templatePlainAddLink (" - "+TMPL_DOWNLOAD+" "+TMPL_FILENAME+"\r\n");
|
||||
const string MainAttachment::templatePlainAllLink ("\r\n"+KAZ_PLAIN_DOWLOAD_ALL+"\r\n * "+TMPL_DOWNLOAD+"\r\n");
|
||||
|
||||
const string MainAttachment::templateHtmlHeader (KAZ_HTML_START+"<p style=\"clear: left; padding: 1pc 0 0 0; font-size:10px; color:#969696;\">"+KAZ_PLAIN_START+"</p><hr>\n"
|
||||
"<div class=\"kaz\">"
|
||||
@ -207,10 +207,10 @@ MainAttachment::getDisclaim (string &plain, string &html) const {
|
||||
return;
|
||||
}
|
||||
|
||||
plain = "\n"+KAZ_PLAIN_START+"\n"+KAZ_PLAIN_HR+"\n"+KAZ_PLAIN_DONT_TOUCH+"\n\n"+KAZ_PLAIN_WARNING+"\n\n"+KAZ_PLAIN_DOWLOAD_ONE+"\n"+plainNewLinks;
|
||||
plain = "\r\n"+KAZ_PLAIN_START+"\r\n"+KAZ_PLAIN_HR+"\r\n"+KAZ_PLAIN_DONT_TOUCH+"\r\n\r\n"+KAZ_PLAIN_WARNING+"\r\n\r\n"+KAZ_PLAIN_DOWLOAD_ONE+"\r\n"+plainNewLinks;
|
||||
html = templateHtmlHeader+htmlNewLinks;
|
||||
if (previousLinks.size ()) {
|
||||
plain += KAZ_PLAIN_DOWLOAD_OTHER+"\n"+plainOldLinks;
|
||||
plain += KAZ_PLAIN_DOWLOAD_OTHER+"\r\n"+plainOldLinks;
|
||||
html += templateHtmlOtherLink+htmlOldLinks;
|
||||
}
|
||||
if (linkCount > 1 && archiveDownloadURL.length ()) {
|
||||
@ -223,7 +223,7 @@ MainAttachment::getDisclaim (string &plain, string &html) const {
|
||||
html += allLinks;
|
||||
}
|
||||
html += templateHtmlFooter;
|
||||
plain += "\n\n"+KAZ_WEB_SITE+"\n"+KAZ_PLAIN_HR+"\n"+KAZ_PLAIN_STOP+"\n";
|
||||
plain += "\r\n\r\n"+KAZ_WEB_SITE+"\r\n"+KAZ_PLAIN_HR+"\r\n"+KAZ_PLAIN_STOP+"\r\n";
|
||||
// & => & done
|
||||
LOG ("plain: " << plain);
|
||||
LOG ("html: " << html);
|
||||
@ -252,16 +252,25 @@ MainAttachment::extractLinks (const string &extractedPlainKAZ) {
|
||||
++stopPos;
|
||||
const string href (extractedPlainKAZ.substr (startPos, stopPos-startPos));
|
||||
LOG ("plain href: " << href);
|
||||
|
||||
if (extractedPlainKAZ [stopPos] && extractedPlainKAZ [stopPos] != '\n')
|
||||
++stopPos;
|
||||
startPos = stopPos;
|
||||
// get all href but KAZ_WEB_SITE
|
||||
// the archive link while be skip by filter.sh
|
||||
// the archive link will be skip by filter.sh
|
||||
if (href == KAZ_WEB_SITE)
|
||||
continue;
|
||||
while (extractedPlainKAZ [stopPos] && extractedPlainKAZ [stopPos] != '\n')
|
||||
++stopPos;
|
||||
const string name (extractedPlainKAZ.substr (startPos, stopPos-startPos));
|
||||
|
||||
string::size_type nextPos = extractedPlainKAZ.find ("http", startPos);
|
||||
string name (extractedPlainKAZ, startPos, (nextPos == string::npos ? extractedPlainKAZ.length () : nextPos) - startPos);
|
||||
// skip [> \r\n\t]
|
||||
nextPos = name.find_first_not_of ("[> \t\r\n]");
|
||||
if (nextPos != string::npos)
|
||||
name.erase (0, nextPos);
|
||||
// stop before [>\r\n\t]
|
||||
nextPos = name.find_first_of ("[>\t\r\n]");
|
||||
if (nextPos != string::npos)
|
||||
name.erase (nextPos);
|
||||
LOG ("plain name: " << name);
|
||||
addPrevious (href, name);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user