Bug 280743 Headers lack chrome - gCollapsedHeaderList has no properties

patch by mark@standard8.demon.co.uk r=neil sr=bienvenu
This commit is contained in:
timeless%mozdev.org 2005-02-07 19:09:02 +00:00
Родитель fe3012ae39
Коммит 98da147dcf
5 изменённых файлов: 34 добавлений и 17 удалений

Просмотреть файл

@ -88,7 +88,7 @@ var gShowCondensedEmailAddresses = true; // show the friendly display names for
var gPersonalAddressBookDirectory; // used for determining if we want to show just the display name in email address nodes
var msgHeaderParser = Components.classes[msgHeaderParserContractID].getService(Components.interfaces.nsIMsgHeaderParser);
var abAddressCollector = Components.classes[abAddressCollectorContractID].getService(Components.interfaces.nsIAbAddressCollecter);
var abAddressCollector = null;
// other components may listen to on start header & on end header notifications for each message we display
// to do that you need to add yourself to our gMessageListeners array with object that has two properties:
@ -386,16 +386,22 @@ var messageHeaderSink = {
if (lowerCaseHeaderName == "from")
{
if (header.value && abAddressCollector) {
if (header.value) {
if ((gCollectIncoming && !dontCollectAddress) ||
(gCollectNewsgroup && dontCollectAddress))
{
if (!abAddressCollector)
abAddressCollector = Components.classes[abAddressCollectorContractID].getService(Components.interfaces.nsIAbAddressCollecter);
gCollectAddress = header.headerValue;
// collect, and add card if doesn't exist, unknown preferred send format
gCollectAddressTimer = setTimeout('abAddressCollector.collectUnicodeAddress(gCollectAddress, true, Components.interfaces.nsIAbPreferMailFormat.unknown);', 2000);
}
else if (gCollectOutgoing)
{
if (!abAddressCollector)
abAddressCollector = Components.classes[abAddressCollectorContractID].getService(Components.interfaces.nsIAbAddressCollecter);
// collect, but only update existing cards, unknown preferred send format
gCollectAddress = header.headerValue;
gCollectAddressTimer = setTimeout('abAddressCollector.collectUnicodeAddress(gCollectAddress, false, Components.interfaces.nsIAbPreferMailFormat.unknown);', 2000);
@ -868,6 +874,9 @@ function setFromBuddyIcon(email)
// better to cache this?
var myScreenName = pref.getCharPref("aim.session.screenname");
if (!abAddressCollector)
abAddressCollector = Components.classes[abAddressCollectorContractID].getService(Components.interfaces.nsIAbAddressCollecter);
var card = abAddressCollector.getCardFromAttribute("PrimaryEmail", email);
if (myScreenName && card && card.aimScreenName) {

Просмотреть файл

@ -979,22 +979,17 @@ nsresult nsAbMDBDirectory::GetAbDatabase()
{
NS_ASSERTION(!mURI.IsEmpty(), "Not initialized?");
if (!mDatabase) {
nsresult rv;
nsresult rv = NS_OK;
if (!mDatabase) {
nsCOMPtr<nsIAddressBook> addressBook = do_GetService(NS_ADDRESSBOOK_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv,rv);
rv = addressBook->GetAbDatabaseFromURI(mURI.get(), getter_AddRefs(mDatabase));
NS_ENSURE_SUCCESS(rv,rv);
rv = mDatabase->AddListener(this);
NS_ENSURE_SUCCESS(rv, rv);
if (NS_SUCCEEDED(rv))
rv = mDatabase->AddListener(this);
}
if (!mDatabase)
return NS_ERROR_NULL_POINTER;
return NS_OK;
return rv;
}
NS_IMETHODIMP nsAbMDBDirectory::HasCardForEmailAddress(const char * aEmailAddress, PRBool * aCardExists)
@ -1004,6 +999,11 @@ NS_IMETHODIMP nsAbMDBDirectory::HasCardForEmailAddress(const char * aEmailAddres
if (!mDatabase)
rv = GetAbDatabase();
if (rv == NS_ERROR_FILE_NOT_FOUND)
{
// If file wasn't found, the card cannot exist.
return NS_OK;
}
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAbCard> card;

Просмотреть файл

@ -705,7 +705,7 @@ NS_IMETHODIMP nsAddrDatabase::OpenMDB(nsFileSpec *dbName, PRBool create)
UnixToNative(nativeFileName);
#endif
if (!dbName->Exists())
ret = NS_ERROR_FAILURE; // check: use the right error code later
ret = NS_ERROR_FILE_NOT_FOUND;
else
{
mdbOpenPolicy inOpenPolicy;

Просмотреть файл

@ -310,9 +310,8 @@ NS_IMETHODIMP nsAddressBook::GetAbDatabaseFromURI(const char *aURI, nsIAddrDatab
/* bug 66410 */
rv = addrDBFactory->Open(dbPath, PR_FALSE /* no create */, aDB, PR_TRUE);
delete dbPath;
NS_ENSURE_SUCCESS(rv,rv);
return NS_OK;
return rv;
}
nsresult nsAddressBook::GetAbDatabaseFromFile(char* pDbFile, nsIAddrDatabase **db)

Просмотреть файл

@ -76,7 +76,7 @@ var gIOService;
var gFileHandler;
var msgHeaderParser = Components.classes[msgHeaderParserContractID].getService(Components.interfaces.nsIMsgHeaderParser);
var abAddressCollector = Components.classes[abAddressCollectorContractID].getService(Components.interfaces.nsIAbAddressCollecter);
var abAddressCollector = null;
// other components may listen to on start header & on end header notifications for each message we display
// to do that you need to add yourself to our gMessageListeners array with object that has two properties:
@ -352,17 +352,23 @@ var messageHeaderSink = {
if (lowerCaseHeaderName == "from")
{
if (header.value && abAddressCollector)
if (header.value)
{
if ((gCollectIncoming && !dontCollectAddress) ||
(gCollectNewsgroup && dontCollectAddress))
{
if (!abAddressCollector)
abAddressCollector = Components.classes[abAddressCollectorContractID].getService(Components.interfaces.nsIAbAddressCollecter);
gCollectAddress = header.headerValue;
// collect, and add card if doesn't exist, unknown preferred send format
gCollectAddressTimer = setTimeout('abAddressCollector.collectUnicodeAddress(gCollectAddress, true, Components.interfaces.nsIAbPreferMailFormat.unknown);', 2000);
}
else if (gCollectOutgoing)
{
if (!abAddressCollector)
abAddressCollector = Components.classes[abAddressCollectorContractID].getService(Components.interfaces.nsIAbAddressCollecter);
// collect, but only update existing cards, unknown preferred send format
gCollectAddress = header.headerValue;
gCollectAddressTimer = setTimeout('abAddressCollector.collectUnicodeAddress(gCollectAddress, false, Components.interfaces.nsIAbPreferMailFormat.unknown);', 2000);
@ -779,6 +785,9 @@ function setFromBuddyIcon(email)
// better to cache this?
var myScreenName = pref.getCharPref("aim.session.screenname");
if (!abAddressCollector)
abAddressCollector = Components.classes[abAddressCollectorContractID].getService(Components.interfaces.nsIAbAddressCollecter);
var card = abAddressCollector.getCardFromAttribute("PrimaryEmail", email);
if (myScreenName && card && card.aimScreenName) {