Changeset View
Changeset View
Standalone View
Standalone View
messagecomposer/autotests/replystrategytest.cpp
Show All 33 Lines | |||||
34 | 34 | | |||
35 | const auto defaultAddress {QStringLiteral("default@example.org")}; | 35 | const auto defaultAddress {QStringLiteral("default@example.org")}; | ||
36 | const auto nondefaultAddress {QStringLiteral("nondefault@example.com")}; | 36 | const auto nondefaultAddress {QStringLiteral("nondefault@example.com")}; | ||
37 | const auto friend1Address {QStringLiteral("friend1@example.net")}; | 37 | const auto friend1Address {QStringLiteral("friend1@example.net")}; | ||
38 | const auto friend2Address {QStringLiteral("friend2@example.net")}; | 38 | const auto friend2Address {QStringLiteral("friend2@example.net")}; | ||
39 | const auto replyAddress {QStringLiteral("reply@example.com")}; | 39 | const auto replyAddress {QStringLiteral("reply@example.com")}; | ||
40 | const auto followupAddress {QStringLiteral("followup@example.org")}; | 40 | const auto followupAddress {QStringLiteral("followup@example.org")}; | ||
41 | const auto listAddress {QStringLiteral("list@example.com")}; | 41 | const auto listAddress {QStringLiteral("list@example.com")}; | ||
42 | const auto mailReplyAddress {QStringLiteral("mailreply@example.com")}; | ||||
42 | const QStringList nobody {}; | 43 | const QStringList nobody {}; | ||
43 | 44 | | |||
44 | static inline const QStringList only(const QString &address) | 45 | static inline const QStringList only(const QString &address) | ||
45 | { | 46 | { | ||
46 | return QStringList {address}; | 47 | return QStringList {address}; | ||
47 | } | 48 | } | ||
48 | 49 | | |||
49 | static inline const QStringList both(const QString &address1, const QString &address2) | 50 | static inline const QStringList both(const QString &address1, const QString &address2) | ||
▲ Show 20 Lines • Show All 97 Lines • ▼ Show 20 Line(s) | |||||
147 | void ReplyStrategyTest::testReply_data() | 148 | void ReplyStrategyTest::testReply_data() | ||
148 | { | 149 | { | ||
149 | QTest::addColumn<QString>("oFrom"); // Original message's From address. | 150 | QTest::addColumn<QString>("oFrom"); // Original message's From address. | ||
150 | QTest::addColumn<QStringList>("oTo"); // Original message's To addresses. | 151 | QTest::addColumn<QStringList>("oTo"); // Original message's To addresses. | ||
151 | QTest::addColumn<QStringList>("oCc"); // Original message's CC addresses. | 152 | QTest::addColumn<QStringList>("oCc"); // Original message's CC addresses. | ||
152 | QTest::addColumn<QStringList>("oRT"); // Original message's Reply-To addresses. | 153 | QTest::addColumn<QStringList>("oRT"); // Original message's Reply-To addresses. | ||
153 | QTest::addColumn<QStringList>("oMFT"); // Original message's Mail-Followup-To addresses. | 154 | QTest::addColumn<QStringList>("oMFT"); // Original message's Mail-Followup-To addresses. | ||
154 | QTest::addColumn<QString>("oLP"); // Original message's List-Post address. | 155 | QTest::addColumn<QString>("oLP"); // Original message's List-Post address. | ||
156 | QTest::addColumn<QStringList>("oMRT"); // Original message's Mail-Reply-To addresses. | ||||
155 | QTest::addColumn<int>("strategy"); // ReplyStrategy (passed as an int). | 157 | QTest::addColumn<int>("strategy"); // ReplyStrategy (passed as an int). | ||
156 | QTest::addColumn<QString>("rFrom"); // Reply's expected From address. | 158 | QTest::addColumn<QString>("rFrom"); // Reply's expected From address. | ||
157 | QTest::addColumn<QStringList>("rTo"); // Reply's expected To addresses. | 159 | QTest::addColumn<QStringList>("rTo"); // Reply's expected To addresses. | ||
158 | QTest::addColumn<QStringList>("rCc"); // Reply's expected CC addresses. | 160 | QTest::addColumn<QStringList>("rCc"); // Reply's expected CC addresses. | ||
159 | 161 | | |||
160 | // Smart Replies | 162 | // Smart Replies | ||
161 | // ------------- | 163 | // ------------- | ||
162 | // Smart Reply does not set CC headers. (Compare ReplyAll.) | 164 | // Smart Reply does not set CC headers. (Compare ReplyAll.) | ||
165 | // ReplySmart uses Mail-Reply-To, Reply-To, or From (in that order) | ||||
166 | // for the original's author's address, if List-Post is absent. | ||||
163 | QTest::newRow("ReplySmart, from someone to default identity") | 167 | QTest::newRow("ReplySmart, from someone to default identity") | ||
164 | << friend1Address << only(defaultAddress) << only(friend2Address) | 168 | << friend1Address << only(defaultAddress) << only(friend2Address) | ||
165 | << nobody << nobody << QString() | 169 | << nobody << nobody << QString() << nobody | ||
166 | << (int)ReplySmart << defaultAddress << only(friend1Address) << nobody; | 170 | << (int)ReplySmart << defaultAddress << only(friend1Address) << nobody; | ||
167 | QTest::newRow("ReplySmart, from someone to non-default identity") | 171 | QTest::newRow("ReplySmart, from someone to non-default identity") | ||
168 | << friend1Address << both(friend2Address, nondefaultAddress) << only(defaultAddress) | 172 | << friend1Address << both(friend2Address, nondefaultAddress) << only(defaultAddress) | ||
169 | << nobody << nobody << QString() | 173 | << nobody << nobody << QString() << nobody | ||
170 | << (int)ReplySmart << nondefaultAddress << only(friend1Address) << nobody; | 174 | << (int)ReplySmart << nondefaultAddress << only(friend1Address) << nobody; | ||
171 | QTest::newRow("ReplySmart, from someone with Reply-To") | 175 | QTest::newRow("ReplySmart, from someone with Reply-To") | ||
172 | << friend1Address << only(defaultAddress) << only(friend2Address) | 176 | << friend1Address << only(defaultAddress) << only(friend2Address) | ||
173 | << both(replyAddress, friend2Address) << nobody << QString() | 177 | << both(replyAddress, friend2Address) << nobody << QString() << nobody | ||
174 | << (int)ReplySmart << defaultAddress << both(friend2Address, replyAddress) << nobody; | 178 | << (int)ReplySmart << defaultAddress << both(friend2Address, replyAddress) << nobody; | ||
179 | QTest::newRow("ReplySmart, from someone with Mail-Reply-To") | ||||
180 | << friend1Address << only(defaultAddress) << only(friend2Address) | ||||
181 | << only(replyAddress) << nobody << QString() << only(mailReplyAddress) | ||||
182 | << (int)ReplySmart << defaultAddress << only(mailReplyAddress) << nobody; | ||||
175 | 183 | | |||
176 | // If the original message was _from_ the user _to_ another person (the | 184 | // If the original message was _from_ the user _to_ another person (the | ||
177 | // reverse of the usual direction), a smart reply goes to the other person. | 185 | // reverse of the usual direction), a smart reply goes to the other person. | ||
186 | // Therefore Mail-Reply-To and Reply-To are ignored. | ||||
178 | // The reply is assumed to add to the original message. | 187 | // The reply is assumed to add to the original message. | ||
179 | QTest::newRow("ReplySmart, from default identity to someone") | 188 | QTest::newRow("ReplySmart, from default identity to someone") | ||
180 | << defaultAddress << only(friend1Address) << only(friend2Address) | 189 | << defaultAddress << only(friend1Address) << only(friend2Address) | ||
181 | << nobody << nobody << QString() | 190 | << nobody << nobody << QString() << nobody | ||
182 | << (int)ReplySmart << defaultAddress << only(friend1Address) << nobody; | 191 | << (int)ReplySmart << defaultAddress << only(friend1Address) << nobody; | ||
183 | QTest::newRow("ReplySmart, from default identity with Reply-To to someone") | 192 | QTest::newRow("ReplySmart, from default identity with Reply-To to someone") | ||
184 | << defaultAddress << only(friend1Address) << only(friend2Address) | 193 | << defaultAddress << only(friend1Address) << only(friend2Address) | ||
185 | << only(replyAddress) << nobody << QString() | 194 | << only(replyAddress) << nobody << QString() << only(mailReplyAddress) | ||
186 | << (int)ReplySmart << defaultAddress << only(friend1Address) << nobody; | 195 | << (int)ReplySmart << defaultAddress << only(friend1Address) << nobody; | ||
187 | 196 | | |||
188 | // If the original message was from one of the user's identities to another | 197 | // If the original message was from one of the user's identities to another | ||
189 | // identity (i.e., between two of the user's mail accounts), a smart reply | 198 | // identity (i.e., between two of the user's mail accounts), a smart reply | ||
190 | // goes back to the sending identity. | 199 | // goes back to the sending identity. | ||
191 | QTest::newRow("ReplySmart, between identities") | 200 | QTest::newRow("ReplySmart, between identities") | ||
192 | << defaultAddress << only(nondefaultAddress) << only(friend2Address) | 201 | << defaultAddress << only(nondefaultAddress) << only(friend2Address) | ||
193 | << nobody << nobody << QString() | 202 | << nobody << nobody << QString() << nobody | ||
194 | << (int)ReplySmart << nondefaultAddress << only(defaultAddress) << nobody; | 203 | << (int)ReplySmart << nondefaultAddress << only(defaultAddress) << nobody; | ||
195 | 204 | | |||
196 | // If the original message appears to be from a mailing list, smart replies | 205 | // If the original message appears to be from a mailing list, smart replies | ||
197 | // go to the Mail-Followup-To, Reply-To, or List-Post addresses, in that | 206 | // go to the Mail-Followup-To, Reply-To, or List-Post addresses, in that | ||
198 | // order of preference. | 207 | // order of preference. | ||
199 | QTest::newRow("ReplySmart, from list with Mail-Followup-To") | 208 | QTest::newRow("ReplySmart, from list with Mail-Followup-To") | ||
200 | << friend1Address << only(defaultAddress) << only(friend2Address) | 209 | << friend1Address << only(defaultAddress) << only(friend2Address) | ||
201 | << only(replyAddress) << only(followupAddress) << listAddress | 210 | << only(replyAddress) << only(followupAddress) << listAddress << nobody | ||
202 | << (int)ReplySmart << defaultAddress << only(followupAddress) << nobody; | 211 | << (int)ReplySmart << defaultAddress << only(followupAddress) << nobody; | ||
203 | QTest::newRow("ReplySmart, from list with Reply-To") | 212 | QTest::newRow("ReplySmart, from list with Reply-To") | ||
204 | << friend1Address << only(defaultAddress) << only(friend2Address) | 213 | << friend1Address << only(defaultAddress) << only(friend2Address) | ||
205 | << only(replyAddress) << nobody << listAddress | 214 | << only(replyAddress) << nobody << listAddress << nobody | ||
206 | << (int)ReplySmart << defaultAddress << only(replyAddress) << nobody; | 215 | << (int)ReplySmart << defaultAddress << only(replyAddress) << nobody; | ||
207 | QTest::newRow("ReplySmart, from list with List-Post") | 216 | QTest::newRow("ReplySmart, from list with List-Post") | ||
208 | << friend1Address << only(nondefaultAddress) << only(friend2Address) | 217 | << friend1Address << only(nondefaultAddress) << only(friend2Address) | ||
209 | << nobody << nobody << listAddress | 218 | << nobody << nobody << listAddress << only(mailReplyAddress) | ||
210 | << (int)ReplySmart << nondefaultAddress << only(listAddress) << nobody; | 219 | << (int)ReplySmart << nondefaultAddress << only(listAddress) << nobody; | ||
211 | 220 | | |||
212 | // Replies to Mailing Lists | 221 | // Replies to Mailing Lists | ||
213 | // ------------------------ | 222 | // ------------------------ | ||
214 | // If the original message has a Mail-Followup-To header, replies to the list | 223 | // If the original message has a Mail-Followup-To header, replies to the list | ||
215 | // go to the followup address, in preference to List-Post and Reply-To. | 224 | // go to the followup address, in preference to List-Post and Reply-To. | ||
225 | // Cc and Mail-Reply-To are ignored. | ||||
216 | QTest::newRow("ReplyList, from list with Mail-Followup-To") | 226 | QTest::newRow("ReplyList, from list with Mail-Followup-To") | ||
217 | << friend1Address << only(defaultAddress) << nobody | 227 | << friend1Address << only(defaultAddress) << only(friend2Address) | ||
218 | << only(replyAddress) << only(followupAddress) << listAddress | 228 | << only(replyAddress) << only(followupAddress) << listAddress << only(mailReplyAddress) | ||
219 | << (int)ReplyList << defaultAddress << only(followupAddress) << nobody; | 229 | << (int)ReplyList << defaultAddress << only(followupAddress) << nobody; | ||
220 | 230 | | |||
221 | // If the original message has a List-Post header, replies to the list | 231 | // If the original message has a List-Post header, replies to the list | ||
222 | // go to that address, in preference to Reply-To. | 232 | // go to that address, in preference to Reply-To. | ||
223 | QTest::newRow("ReplyList, from list with List-Post") | 233 | QTest::newRow("ReplyList, from list with List-Post") | ||
224 | << friend1Address << only(defaultAddress) << nobody | 234 | << friend1Address << only(defaultAddress) << nobody | ||
225 | << only(replyAddress) << nobody << listAddress | 235 | << only(replyAddress) << nobody << listAddress << nobody | ||
226 | << (int)ReplyList << defaultAddress << only(listAddress) << nobody; | 236 | << (int)ReplyList << defaultAddress << only(listAddress) << nobody; | ||
227 | 237 | | |||
228 | // If the original message has just a Reply-To header, assume the list | 238 | // If the original message has just a Reply-To header, assume the list | ||
229 | // [munges Reply-To](https://www.gnu.org/software/mailman/mailman-admin/node11.html) | 239 | // [munges Reply-To](https://www.gnu.org/software/mailman/mailman-admin/node11.html) | ||
230 | /// and send the reply to that address. | 240 | /// and send the reply to that address. | ||
231 | QTest::newRow("ReplyList, from list with Reply-To") | 241 | QTest::newRow("ReplyList, from list with Reply-To") | ||
232 | << friend1Address << only(defaultAddress) << nobody | 242 | << friend1Address << only(defaultAddress) << nobody | ||
233 | << only(replyAddress) << nobody << QString() | 243 | << only(replyAddress) << nobody << QString() << nobody | ||
234 | << (int)ReplyList << defaultAddress << only(replyAddress) << nobody; | 244 | << (int)ReplyList << defaultAddress << only(replyAddress) << nobody; | ||
235 | 245 | | |||
236 | // If the original message has neither Mail-Followup-To, List-Post, nor | 246 | // If the original message has neither Mail-Followup-To, List-Post, nor | ||
237 | // Reply-To headers, replies to the list do not choose a To address. | 247 | // Reply-To headers, replies to the list do not choose a To address. | ||
238 | QTest::newRow("ReplyList, from list with no headers") | 248 | QTest::newRow("ReplyList, from list with no headers") | ||
239 | << friend1Address << only(defaultAddress) << nobody | 249 | << friend1Address << only(defaultAddress) << nobody | ||
240 | << nobody << nobody << QString() | 250 | << nobody << nobody << QString() << nobody | ||
241 | << (int)ReplyList << defaultAddress << nobody << nobody; | 251 | << (int)ReplyList << defaultAddress << nobody << nobody; | ||
242 | 252 | | |||
243 | // Replies to All | 253 | // Replies to All | ||
244 | // -------------- | 254 | // -------------- | ||
245 | // ReplyAll adds CC addresses to the reply for the original's recipients, | 255 | // ReplyAll adds CC addresses to the reply for the original's recipients, | ||
246 | // except for the user's identities. | 256 | // except for the user's identities. | ||
247 | QTest::newRow("ReplyAll, with Cc in original") | 257 | QTest::newRow("ReplyAll, with Cc in original") | ||
248 | << friend1Address << only(defaultAddress) << both(friend2Address, nondefaultAddress) | 258 | << friend1Address << only(defaultAddress) << both(friend2Address, nondefaultAddress) | ||
249 | << nobody << nobody << QString() | 259 | << nobody << nobody << QString() << nobody | ||
250 | << (int)ReplyAll << defaultAddress << only(friend1Address) << only(friend2Address); | 260 | << (int)ReplyAll << defaultAddress << only(friend1Address) << only(friend2Address); | ||
251 | QTest::newRow("ReplyAll, with multiple To addresses in original") | 261 | QTest::newRow("ReplyAll, with multiple To addresses in original") | ||
252 | << friend1Address << both(friend2Address, nondefaultAddress) << only(defaultAddress) | 262 | << friend1Address << both(friend2Address, nondefaultAddress) << only(defaultAddress) | ||
253 | << nobody << nobody << QString() | 263 | << nobody << nobody << QString() << nobody | ||
254 | << (int)ReplyAll << nondefaultAddress << only(friend1Address) << only(friend2Address); | 264 | << (int)ReplyAll << nondefaultAddress << only(friend1Address) << only(friend2Address); | ||
255 | | ||||
256 | QTest::newRow("ReplyAll, with Reply-To in original") | 265 | QTest::newRow("ReplyAll, with Reply-To in original") | ||
257 | << friend1Address << only(defaultAddress) << only(friend2Address) | 266 | << friend1Address << only(defaultAddress) << only(friend2Address) | ||
258 | << only(replyAddress) << nobody << QString() | 267 | << only(replyAddress) << nobody << QString() << nobody | ||
259 | << (int)ReplyAll << defaultAddress << only(replyAddress) << only(friend2Address); | 268 | << (int)ReplyAll << defaultAddress << only(replyAddress) << only(friend2Address); | ||
260 | 269 | | |||
261 | // If the original message was _from_ the user _to_ another person (the | 270 | // If the original passed through a mailing list, ReplyAll replies to the | ||
262 | // reverse of the usual direction), reply to all goes to the other person. | 271 | // list, preferring Mail-Followup-To over List-Post as the list address. | ||
263 | // The reply is assumed to add to the original message. | 272 | // It CCs the author, using Mail-Reply-To, Reply-To, or From (in that order). | ||
264 | QTest::newRow("ReplyAll, from default identity to someone") | | |||
265 | << defaultAddress << only(friend1Address) << only(friend2Address) | | |||
266 | << nobody << nobody << QString() | | |||
267 | << (int)ReplyAll << defaultAddress << only(friend1Address) << only(friend2Address); | | |||
268 | | ||||
269 | // Reply to all prefers List-Post to From. | | |||
270 | QTest::newRow("ReplyAll, from list with List-Post") | 273 | QTest::newRow("ReplyAll, from list with List-Post") | ||
271 | << friend1Address << only(nondefaultAddress) << only(friend2Address) | 274 | << friend1Address << only(nondefaultAddress) << only(friend2Address) | ||
272 | << nobody << nobody << listAddress | 275 | << nobody << nobody << listAddress << nobody | ||
273 | << (int)ReplyAll << nondefaultAddress << only(listAddress) << both(friend1Address, friend2Address); | 276 | << (int)ReplyAll << nondefaultAddress << only(listAddress) << both(friend1Address, friend2Address); | ||
274 | 277 | | |||
278 | // If Reply-To is the same as List-Post, ReplyAll ignores it and uses | ||||
279 | // From, because the mailing list munged Reply-To. | ||||
280 | QTest::newRow("ReplyAll, from list that munges Reply-To") | ||||
281 | << friend1Address << only(defaultAddress) << nobody | ||||
282 | << only(listAddress) << nobody << listAddress << nobody | ||||
283 | << (int)ReplyAll << defaultAddress << only(listAddress) << only(friend1Address); | ||||
284 | | ||||
275 | // Reply to Author | 285 | // Reply to Author | ||
276 | // --------------- | 286 | // --------------- | ||
277 | // ReplyAuthor ignores Cc, and replies to the From address in the absence | 287 | // ReplyAuthor ignores Cc, and replies to the Mail-Reply-To, Reply-To, or | ||
278 | // of other headers. | 288 | // From addresses, in that order of preference, if List-Post is absent. | ||
279 | QTest::newRow("ReplyAuthor, no special headers") | 289 | QTest::newRow("ReplyAuthor, no special headers") | ||
280 | << friend1Address << only(defaultAddress) << only(friend2Address) | 290 | << friend1Address << only(defaultAddress) << only(friend2Address) | ||
281 | << nobody << nobody << QString() | 291 | << nobody << nobody << QString() << nobody | ||
282 | << (int)ReplyAuthor << defaultAddress << only(friend1Address) << nobody; | 292 | << (int)ReplyAuthor << defaultAddress << only(friend1Address) << nobody; | ||
283 | | ||||
284 | // ReplyAuthor prefers Reply-To to From in the absence of List-Post. | | |||
285 | QTest::newRow("ReplyAuthor, from someone with Reply-To") | 293 | QTest::newRow("ReplyAuthor, from someone with Reply-To") | ||
286 | << friend1Address << only(defaultAddress) << only(friend2Address) | 294 | << friend1Address << only(defaultAddress) << only(friend2Address) | ||
287 | << only(replyAddress) << nobody << QString() | 295 | << only(replyAddress) << nobody << QString() << nobody | ||
288 | << (int)ReplyAuthor << defaultAddress << only(replyAddress) << nobody; | 296 | << (int)ReplyAuthor << defaultAddress << only(replyAddress) << nobody; | ||
297 | QTest::newRow("ReplyAuthor, from someone with Mail-Reply-To") | ||||
298 | << friend1Address << only(defaultAddress) << only(friend2Address) | ||||
299 | << only(replyAddress) << nobody << QString() << only(mailReplyAddress) | ||||
300 | << (int)ReplyAuthor << defaultAddress << only(mailReplyAddress) << nobody; | ||||
289 | 301 | | |||
290 | // If Reply-To is the same as List-Post, ReplyAuthor ignores it and uses | 302 | // If Reply-To is the same as List-Post, ReplyAuthor ignores it and uses | ||
291 | // From, because the mailing list munged Reply-To. | 303 | // From, because the mailing list munged Reply-To. | ||
292 | QTest::newRow("ReplyAuthor, from list that munges Reply-To") | 304 | QTest::newRow("ReplyAuthor, from list that munges Reply-To") | ||
293 | << friend1Address << only(defaultAddress) << only(friend2Address) | 305 | << friend1Address << only(defaultAddress) << only(friend2Address) | ||
294 | << only(listAddress) << nobody << listAddress | 306 | << only(listAddress) << nobody << listAddress << nobody | ||
295 | << (int)ReplyAuthor << defaultAddress << only(friend1Address) << nobody; | 307 | << (int)ReplyAuthor << defaultAddress << only(friend1Address) << nobody; | ||
296 | 308 | | |||
297 | // If Reply-To contains List-Post, ReplyAuthor uses the other reply | 309 | // If Reply-To contains List-Post, ReplyAuthor uses the other reply | ||
298 | // addresses, because the mailing list didn't completely munge Reply-To. | 310 | // addresses, because the mailing list didn't completely munge Reply-To. | ||
299 | QTest::newRow("ReplyAuthor, from list that lightly munges Reply-To") | 311 | QTest::newRow("ReplyAuthor, from list that lightly munges Reply-To") | ||
300 | << friend1Address << only(defaultAddress) << only(friend2Address) | 312 | << friend1Address << only(defaultAddress) << only(friend2Address) | ||
301 | << both(listAddress, replyAddress) << nobody << listAddress | 313 | << both(listAddress, replyAddress) << nobody << listAddress << nobody | ||
302 | << (int)ReplyAuthor << defaultAddress << only(replyAddress) << nobody; | 314 | << (int)ReplyAuthor << defaultAddress << only(replyAddress) << nobody; | ||
303 | 315 | | |||
304 | // Reply to None | 316 | // Reply to None | ||
305 | // ------------- | 317 | // ------------- | ||
306 | // ReplyNone ignores all possible headers and does not choose a To address. | 318 | // ReplyNone ignores all possible headers and does not choose a To address. | ||
307 | QTest::newRow("ReplyNone") | 319 | QTest::newRow("ReplyNone") | ||
308 | << friend1Address << only(defaultAddress) << only(friend2Address) | 320 | << friend1Address << only(defaultAddress) << only(friend2Address) | ||
309 | << only(replyAddress) << only(followupAddress) << listAddress | 321 | << only(replyAddress) << only(followupAddress) << listAddress << only(mailReplyAddress) | ||
310 | << (int)ReplyNone << defaultAddress << nobody << nobody; | 322 | << (int)ReplyNone << defaultAddress << nobody << nobody; | ||
311 | } | 323 | } | ||
312 | 324 | | |||
313 | void ReplyStrategyTest::testReply() | 325 | void ReplyStrategyTest::testReply() | ||
314 | { | 326 | { | ||
315 | QFETCH(const QString, oFrom); | 327 | QFETCH(const QString, oFrom); | ||
316 | QFETCH(const QStringList, oTo); | 328 | QFETCH(const QStringList, oTo); | ||
317 | QFETCH(const QStringList, oCc); | 329 | QFETCH(const QStringList, oCc); | ||
318 | QFETCH(const QStringList, oRT); | 330 | QFETCH(const QStringList, oRT); | ||
319 | QFETCH(const QStringList, oMFT); | 331 | QFETCH(const QStringList, oMFT); | ||
320 | QFETCH(const QString, oLP); | 332 | QFETCH(const QString, oLP); | ||
333 | QFETCH(const QStringList, oMRT); | ||||
321 | QFETCH(const int, strategy); | 334 | QFETCH(const int, strategy); | ||
322 | QFETCH(const QString, rFrom); | 335 | QFETCH(const QString, rFrom); | ||
323 | QFETCH(const QStringList, rTo); | 336 | QFETCH(const QStringList, rTo); | ||
324 | QFETCH(const QStringList, rCc); | 337 | QFETCH(const QStringList, rCc); | ||
325 | 338 | | |||
326 | auto original {basicMessage(oFrom, oTo)}; | 339 | auto original {basicMessage(oFrom, oTo)}; | ||
327 | if (!oCc.isEmpty()) { | 340 | if (!oCc.isEmpty()) { | ||
328 | auto cc {new KMime::Headers::Cc}; | 341 | auto cc {new KMime::Headers::Cc}; | ||
Show All 14 Lines | 354 | if (!oMFT.isEmpty()) { | |||
343 | mailFollowupTo->from7BitString(oMFT.join(QLatin1Char(',')).toLatin1()); | 356 | mailFollowupTo->from7BitString(oMFT.join(QLatin1Char(',')).toLatin1()); | ||
344 | original->setHeader(mailFollowupTo); | 357 | original->setHeader(mailFollowupTo); | ||
345 | } | 358 | } | ||
346 | if (!oLP.isEmpty()) { | 359 | if (!oLP.isEmpty()) { | ||
347 | auto listPost = new KMime::Headers::Generic("List-Post"); | 360 | auto listPost = new KMime::Headers::Generic("List-Post"); | ||
348 | listPost->from7BitString("<mailto:" + oLP.toLatin1() + ">"); | 361 | listPost->from7BitString("<mailto:" + oLP.toLatin1() + ">"); | ||
349 | original->setHeader(listPost); | 362 | original->setHeader(listPost); | ||
350 | } | 363 | } | ||
364 | if (!oMRT.isEmpty()) { | ||||
365 | auto mailReplyTo = new KMime::Headers::Generic("Mail-Reply-To"); | ||||
366 | mailReplyTo->from7BitString(oMRT.join(QLatin1Char(',')).toLatin1()); | ||||
367 | original->setHeader(mailReplyTo); | ||||
368 | } | ||||
351 | 369 | | |||
352 | if (auto reply = makeReply(original, (ReplyStrategy)strategy)) { | 370 | if (auto reply = makeReply(original, (ReplyStrategy)strategy)) { | ||
353 | COMPARE_ADDRESSES(reply->from(), only(rFrom)); | 371 | COMPARE_ADDRESSES(reply->from(), only(rFrom)); | ||
354 | COMPARE_ADDRESSES(reply->to(), rTo); | 372 | COMPARE_ADDRESSES(reply->to(), rTo); | ||
355 | COMPARE_ADDRESSES(reply->cc(), rCc); | 373 | COMPARE_ADDRESSES(reply->cc(), rCc); | ||
356 | } | 374 | } | ||
357 | } | 375 | } | ||
358 | 376 | | |||
359 | QTEST_MAIN(ReplyStrategyTest) | 377 | QTEST_MAIN(ReplyStrategyTest) |