234 { |
234 { |
235 if (filter._comparatorType == QMessageFilterPrivate::Equality) { |
235 if (filter._comparatorType == QMessageFilterPrivate::Equality) { |
236 QMessageDataComparator::EqualityComparator cmp(static_cast<QMessageDataComparator::EqualityComparator>(filter._comparatorValue)); |
236 QMessageDataComparator::EqualityComparator cmp(static_cast<QMessageDataComparator::EqualityComparator>(filter._comparatorValue)); |
237 if (cmp == QMessageDataComparator::Equal) { |
237 if (cmp == QMessageDataComparator::Equal) { |
238 if (filter._value.toString().length() > 0) { |
238 if (filter._value.toString().length() > 0) { |
239 if (message.from().recipient().compare(filter._value.toString(),caseSensitivity) == 0) { |
239 if (message.from().addressee().compare(filter._value.toString(),caseSensitivity) == 0) { |
240 return true; |
240 return true; |
241 } |
241 } |
242 } |
242 } |
243 } else { // NotEqual |
243 } else { // NotEqual |
244 if (filter._value.toString().length() > 0) { |
244 if (filter._value.toString().length() > 0) { |
245 if (message.from().recipient().compare(filter._value.toString(),caseSensitivity) != 0) { |
245 if (message.from().addressee().compare(filter._value.toString(),caseSensitivity) != 0) { |
246 return true; |
246 return true; |
247 } |
247 } |
248 } else { |
248 } else { |
249 return true; |
249 return true; |
250 } |
250 } |
251 } |
251 } |
252 } else if (filter._comparatorType == QMessageFilterPrivate::Inclusion) { |
252 } else if (filter._comparatorType == QMessageFilterPrivate::Inclusion) { |
253 QMessageDataComparator::InclusionComparator cmp(static_cast<QMessageDataComparator::InclusionComparator>(filter._comparatorValue)); |
253 QMessageDataComparator::InclusionComparator cmp(static_cast<QMessageDataComparator::InclusionComparator>(filter._comparatorValue)); |
254 if (cmp == QMessageDataComparator::Includes) { |
254 if (cmp == QMessageDataComparator::Includes) { |
255 if (message.from().recipient().contains(filter._value.toString(),caseSensitivity)) { |
255 if (message.from().addressee().contains(filter._value.toString(),caseSensitivity)) { |
256 return true; |
256 return true; |
257 } |
257 } |
258 } else { // Excludes |
258 } else { // Excludes |
259 if (!message.from().recipient().contains(filter._value.toString(),caseSensitivity)) { |
259 if (!message.from().addressee().contains(filter._value.toString(),caseSensitivity)) { |
260 return true; |
260 return true; |
261 } |
261 } |
262 } |
262 } |
263 } |
263 } |
264 break; |
264 break; |
269 QMessageDataComparator::InclusionComparator cmp(static_cast<QMessageDataComparator::InclusionComparator>(filter._comparatorValue)); |
269 QMessageDataComparator::InclusionComparator cmp(static_cast<QMessageDataComparator::InclusionComparator>(filter._comparatorValue)); |
270 bool includes = false; |
270 bool includes = false; |
271 // Check to addresses |
271 // Check to addresses |
272 QMessageAddressList addrList = message.to(); |
272 QMessageAddressList addrList = message.to(); |
273 for (int i=0; i < addrList.count(); i++) { |
273 for (int i=0; i < addrList.count(); i++) { |
274 if (addrList[i].recipient().contains(filter._value.toString(),caseSensitivity)) { |
274 if (addrList[i].addressee().contains(filter._value.toString(),caseSensitivity)) { |
275 includes = true; |
275 includes = true; |
276 break; |
276 break; |
277 } |
277 } |
278 } |
278 } |
279 if (!includes) { |
279 if (!includes) { |
280 // Check cc addresses |
280 // Check cc addresses |
281 addrList = message.cc(); |
281 addrList = message.cc(); |
282 for (int i=0; i < addrList.count(); i++) { |
282 for (int i=0; i < addrList.count(); i++) { |
283 if (addrList[i].recipient().contains(filter._value.toString(),caseSensitivity)) { |
283 if (addrList[i].addressee().contains(filter._value.toString(),caseSensitivity)) { |
284 includes = true; |
284 includes = true; |
285 break; |
285 break; |
286 } |
286 } |
287 } |
287 } |
288 } |
288 } |
289 if (!includes) { |
289 if (!includes) { |
290 // Check bcc addresses |
290 // Check bcc addresses |
291 addrList = message.bcc(); |
291 addrList = message.bcc(); |
292 for (int i=0; i < addrList.count(); i++) { |
292 for (int i=0; i < addrList.count(); i++) { |
293 if (addrList[i].recipient().contains(filter._value.toString(),caseSensitivity)) { |
293 if (addrList[i].addressee().contains(filter._value.toString(),caseSensitivity)) { |
294 includes = true; |
294 includes = true; |
295 break; |
295 break; |
296 } |
296 } |
297 } |
297 } |
298 } |
298 } |