| 1242 | } |
| 1243 | |
| 1244 | void MessageParser::parseChannelCard(const Session& session, const std::string& portraitDir, const std::string& usrName, const std::string& avatar, const std::string& avatarLD, const std::string& name, TemplateValues& tv) const |
| 1245 | { |
| 1246 | bool hasImg = false; |
| 1247 | if ((m_options & SPO_IGNORE_SHARING) == 0) |
| 1248 | { |
| 1249 | hasImg = (!usrName.empty() && !avatar.empty()); |
| 1250 | } |
| 1251 | tv["%%CARDTYPE%%"] = getLocaleString("[Channel Card]"); |
| 1252 | if (!name.empty()) |
| 1253 | { |
| 1254 | if (hasImg) |
| 1255 | { |
| 1256 | tv.setName("card"); |
| 1257 | tv["%%CARDNAME%%"] = name; |
| 1258 | tv["%%CARDIMGPATH%%"] = portraitDir + "/" + usrName + ".jpg"; |
| 1259 | std::string localPortraitDir = normalizePath(portraitDir); |
| 1260 | std::string localFile = combinePath(localPortraitDir, usrName + ".jpg"); |
| 1261 | ensureDirectoryExisted(combinePath(m_outputPath, localPortraitDir)); |
| 1262 | #ifdef USING_DOWNLOADER |
| 1263 | m_downloader.addTask(avatar, combinePath(m_outputPath, localfile), 0, "card"); |
| 1264 | #else |
| 1265 | m_taskManager.download(&session, avatar, avatarLD, combinePath(m_outputPath, localFile), 0, "", "card"); |
| 1266 | #endif |
| 1267 | } |
| 1268 | else |
| 1269 | { |
| 1270 | tv.setName("msg"); |
| 1271 | tv["%%MESSAGE%%"] = formatString(getLocaleString("[Channel Card] %s"), name.c_str()); |
| 1272 | } |
| 1273 | } |
| 1274 | else |
| 1275 | { |
| 1276 | tv["%%MESSAGE%%"] = getLocaleString("[Channel Card]"); |
| 1277 | } |
| 1278 | tv["%%EXTRA_CLS%%"] = "channel-card"; |
| 1279 | } |
| 1280 | |
| 1281 | void MessageParser::parseChannels(const std::string& msgId, const XmlParser& xmlParser, xmlNodePtr parentNode, const std::string& finderFeedXPath, const Session& session, TemplateValues& tv) const |
| 1282 | { |
nothing calls this directly
no test coverage detected