Lines 3180-3201
nsresult nsMsgDatabase::RowCellColumnToM
Link Here
|
3180 |
const char *nakedString = nsnull; |
3180 |
const char *nakedString = nsnull; |
3181 |
err = RowCellColumnToConstCharPtr(row, columnToken, &nakedString); |
3181 |
err = RowCellColumnToConstCharPtr(row, columnToken, &nakedString); |
3182 |
if (NS_SUCCEEDED(err) && nakedString && strlen(nakedString)) |
3182 |
if (NS_SUCCEEDED(err) && nakedString && strlen(nakedString)) |
3183 |
{ |
3183 |
{ |
3184 |
GetMimeConverter(); |
3184 |
GetMimeConverter(); |
3185 |
if (m_mimeConverter) |
3185 |
if (m_mimeConverter) |
3186 |
{ |
3186 |
{ |
3187 |
nsAutoString decodedStr; |
3187 |
nsAutoString decodedStr; |
3188 |
const char *charSet; |
3188 |
char *charSet; |
3189 |
PRBool characterSetOverride; |
3189 |
PRBool characterSetOverride; |
3190 |
m_dbFolderInfo->GetConstCharPtrCharacterSet(&charSet); |
|
|
3191 |
m_dbFolderInfo->GetCharacterSetOverride(&characterSetOverride); |
3190 |
m_dbFolderInfo->GetCharacterSetOverride(&characterSetOverride); |
3192 |
|
3191 |
err = RowCellColumnToCharPtr(row, m_messageCharSetColumnToken, &charSet); |
|
|
3192 |
if (NS_FAILED(err) || !*charSet || !PL_strcasecmp(charSet, "us-ascii") || |
3193 |
characterSetOverride) |
3194 |
{ |
3195 |
PR_Free(charSet); |
3196 |
m_dbFolderInfo->GetCharPtrCharacterSet(&charSet); |
3197 |
} |
3198 |
|
3193 |
err = m_mimeConverter->DecodeMimeHeader(nakedString, resultStr, charSet, characterSetOverride); |
3199 |
err = m_mimeConverter->DecodeMimeHeader(nakedString, resultStr, charSet, characterSetOverride); |
|
|
3200 |
PR_Free(charSet); |
3194 |
} |
3201 |
} |
3195 |
} |
3202 |
} |
3196 |
return err; |
3203 |
return err; |
3197 |
} |
3204 |
} |
3198 |
|
3205 |
|
3199 |
nsresult nsMsgDatabase::RowCellColumnToAddressCollationKey(nsIMdbRow *row, mdb_token colToken, PRUint8 **result, PRUint32 *len) |
3206 |
nsresult nsMsgDatabase::RowCellColumnToAddressCollationKey(nsIMdbRow *row, mdb_token colToken, PRUint8 **result, PRUint32 *len) |
3200 |
{ |
3207 |
{ |
3201 |
const char *cSender; |
3208 |
const char *cSender; |
Lines 3210-3228
nsresult nsMsgDatabase::RowCellColumnToA
Link Here
|
3210 |
// apply mime decode |
3217 |
// apply mime decode |
3211 |
nsIMimeConverter *converter = GetMimeConverter(); |
3218 |
nsIMimeConverter *converter = GetMimeConverter(); |
3212 |
|
3219 |
|
3213 |
if (NS_SUCCEEDED(ret) && nsnull != converter) |
3220 |
if (NS_SUCCEEDED(ret) && nsnull != converter) |
3214 |
{ |
3221 |
{ |
3215 |
char *resultStr = nsnull; |
3222 |
char *resultStr = nsnull; |
3216 |
char *charset; |
3223 |
char *charset; |
3217 |
PRBool characterSetOverride; |
3224 |
PRBool characterSetOverride; |
3218 |
m_dbFolderInfo->GetCharPtrCharacterSet(&charset); |
|
|
3219 |
m_dbFolderInfo->GetCharacterSetOverride(&characterSetOverride); |
3225 |
m_dbFolderInfo->GetCharacterSetOverride(&characterSetOverride); |
3220 |
|
3226 |
ret = RowCellColumnToCharPtr(row, m_messageCharSetColumnToken, &charset); |
|
|
3227 |
if (NS_FAILED(ret) || !*charset || !PL_strcasecmp(charset, "us-ascii") || |
3228 |
characterSetOverride) |
3229 |
{ |
3230 |
PR_Free(charset); |
3231 |
m_dbFolderInfo->GetCharPtrCharacterSet(&charset); |
3232 |
} |
3233 |
|
3221 |
ret = converter->DecodeMimeHeader(cSender, &resultStr, |
3234 |
ret = converter->DecodeMimeHeader(cSender, &resultStr, |
3222 |
charset, characterSetOverride); |
3235 |
charset, characterSetOverride); |
3223 |
if (NS_SUCCEEDED(ret) && resultStr) |
3236 |
if (NS_SUCCEEDED(ret) && resultStr) |
3224 |
{ |
3237 |
{ |
3225 |
ret = headerParser->ExtractHeaderAddressName ("UTF-8", resultStr, getter_Copies(name)); |
3238 |
ret = headerParser->ExtractHeaderAddressName ("UTF-8", resultStr, getter_Copies(name)); |
3226 |
} |
3239 |
} |
3227 |
else { |
3240 |
else { |
3228 |
ret = headerParser->ExtractHeaderAddressName ("UTF-8", cSender, getter_Copies(name)); |
3241 |
ret = headerParser->ExtractHeaderAddressName ("UTF-8", cSender, getter_Copies(name)); |
Lines 3280-3303
nsresult nsMsgDatabase::RowCellColumnToC
Link Here
|
3280 |
|
3293 |
|
3281 |
err = RowCellColumnToConstCharPtr(row, columnToken, &nakedString); |
3294 |
err = RowCellColumnToConstCharPtr(row, columnToken, &nakedString); |
3282 |
if (NS_SUCCEEDED(err)) |
3295 |
if (NS_SUCCEEDED(err)) |
3283 |
{ |
3296 |
{ |
3284 |
GetMimeConverter(); |
3297 |
GetMimeConverter(); |
3285 |
if (m_mimeConverter) |
3298 |
if (m_mimeConverter) |
3286 |
{ |
3299 |
{ |
3287 |
nsXPIDLCString decodedStr; |
3300 |
nsXPIDLCString decodedStr; |
3288 |
const char *charSet; |
3301 |
char *charSet; |
3289 |
PRBool characterSetOverride; |
3302 |
PRBool characterSetOverride; |
3290 |
m_dbFolderInfo->GetConstCharPtrCharacterSet(&charSet); |
|
|
3291 |
m_dbFolderInfo->GetCharacterSetOverride(&characterSetOverride); |
3303 |
m_dbFolderInfo->GetCharacterSetOverride(&characterSetOverride); |
|
|
3304 |
err = RowCellColumnToCharPtr(row, m_messageCharSetColumnToken, &charSet); |
3305 |
if (NS_FAILED(err) || !*charSet || !PL_strcasecmp(charSet, "us-ascii") || |
3306 |
characterSetOverride) |
3307 |
{ |
3308 |
PR_Free(charSet); |
3309 |
m_dbFolderInfo->GetCharPtrCharacterSet(&charSet); |
3310 |
} |
3292 |
|
3311 |
|
3293 |
err = m_mimeConverter->DecodeMimeHeader(nakedString, getter_Copies(decodedStr), charSet, characterSetOverride); |
3312 |
err = m_mimeConverter->DecodeMimeHeader(nakedString, getter_Copies(decodedStr), charSet, characterSetOverride); |
3294 |
if (NS_SUCCEEDED(err)) |
3313 |
if (NS_SUCCEEDED(err)) |
3295 |
err = CreateCollationKey(NS_ConvertUTF8toUCS2(decodedStr), result, len); |
3314 |
err = CreateCollationKey(NS_ConvertUTF8toUCS2(decodedStr), result, len); |
|
|
3315 |
PR_Free(charSet); |
3296 |
} |
3316 |
} |
3297 |
} |
3317 |
} |
3298 |
return err; |
3318 |
return err; |
3299 |
} |
3319 |
} |
3300 |
|
3320 |
|
3301 |
NS_IMETHODIMP |
3321 |
NS_IMETHODIMP |
3302 |
nsMsgDatabase::CompareCollationKeys(PRUint8 *key1, PRUint32 len1, PRUint8 *key2, PRUint32 len2, PRInt32 *result) |
3322 |
nsMsgDatabase::CompareCollationKeys(PRUint8 *key1, PRUint32 len1, PRUint8 *key2, PRUint32 len2, PRInt32 *result) |
3303 |
{ |
3323 |
{ |