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});
|
Attachment::stringsToUpdate ({KAZ_PLAIN_START, "\""+CID});
|
||||||
|
|
||||||
// ================================================================================
|
// ================================================================================
|
||||||
const string MainAttachment::templatePlainAddLink (" - "+TMPL_DOWNLOAD+" "+TMPL_FILENAME+"\n");
|
const string MainAttachment::templatePlainAddLink (" - "+TMPL_DOWNLOAD+" "+TMPL_FILENAME+"\r\n");
|
||||||
const string MainAttachment::templatePlainAllLink ("\n"+KAZ_PLAIN_DOWLOAD_ALL+"\n * "+TMPL_DOWNLOAD+"\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"
|
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\">"
|
"<div class=\"kaz\">"
|
||||||
@ -207,10 +207,10 @@ MainAttachment::getDisclaim (string &plain, string &html) const {
|
|||||||
return;
|
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;
|
html = templateHtmlHeader+htmlNewLinks;
|
||||||
if (previousLinks.size ()) {
|
if (previousLinks.size ()) {
|
||||||
plain += KAZ_PLAIN_DOWLOAD_OTHER+"\n"+plainOldLinks;
|
plain += KAZ_PLAIN_DOWLOAD_OTHER+"\r\n"+plainOldLinks;
|
||||||
html += templateHtmlOtherLink+htmlOldLinks;
|
html += templateHtmlOtherLink+htmlOldLinks;
|
||||||
}
|
}
|
||||||
if (linkCount > 1 && archiveDownloadURL.length ()) {
|
if (linkCount > 1 && archiveDownloadURL.length ()) {
|
||||||
@ -223,7 +223,7 @@ MainAttachment::getDisclaim (string &plain, string &html) const {
|
|||||||
html += allLinks;
|
html += allLinks;
|
||||||
}
|
}
|
||||||
html += templateHtmlFooter;
|
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
|
// & => & done
|
||||||
LOG ("plain: " << plain);
|
LOG ("plain: " << plain);
|
||||||
LOG ("html: " << html);
|
LOG ("html: " << html);
|
||||||
@ -252,16 +252,25 @@ MainAttachment::extractLinks (const string &extractedPlainKAZ) {
|
|||||||
++stopPos;
|
++stopPos;
|
||||||
const string href (extractedPlainKAZ.substr (startPos, stopPos-startPos));
|
const string href (extractedPlainKAZ.substr (startPos, stopPos-startPos));
|
||||||
LOG ("plain href: " << href);
|
LOG ("plain href: " << href);
|
||||||
|
|
||||||
if (extractedPlainKAZ [stopPos] && extractedPlainKAZ [stopPos] != '\n')
|
if (extractedPlainKAZ [stopPos] && extractedPlainKAZ [stopPos] != '\n')
|
||||||
++stopPos;
|
++stopPos;
|
||||||
startPos = stopPos;
|
startPos = stopPos;
|
||||||
// get all href but KAZ_WEB_SITE
|
// 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)
|
if (href == KAZ_WEB_SITE)
|
||||||
continue;
|
continue;
|
||||||
while (extractedPlainKAZ [stopPos] && extractedPlainKAZ [stopPos] != '\n')
|
|
||||||
++stopPos;
|
string::size_type nextPos = extractedPlainKAZ.find ("http", startPos);
|
||||||
const string name (extractedPlainKAZ.substr (startPos, stopPos-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);
|
LOG ("plain name: " << name);
|
||||||
addPrevious (href, name);
|
addPrevious (href, name);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user