Bug #18591 --> turn on the address book collector for email addresses in the message pane. I needed

a collector method that would take a unicode string.
r=bienvenu
This commit is contained in:
mscott%netscape.com 2000-02-15 06:49:24 +00:00
parent b805bebf76
commit 5b2f19acd0
3 changed files with 25 additions and 2 deletions

View File

@ -27,6 +27,12 @@
interface nsIAbAddressCollecter : nsISupports {
void CollectAddress(in string address);
void collectAddress(in string address);
/* CollectUnicodeAddress is the most I18N friendly
of the two methods to call. If you just take a char * address
as used by CollectAddress then you don't know what char set
the address is in (UTF-8??).
*/
void collectUnicodeAddress(in wstring address);
};

View File

@ -60,6 +60,23 @@ nsAbAddressCollecter::~nsAbAddressCollecter()
}
}
NS_IMETHODIMP nsAbAddressCollecter::CollectUnicodeAddress(const PRUnichar * aAddress)
{
NS_ENSURE_ARG(aAddress);
nsresult rv = NS_OK;
// convert the unicode string to UTF-8...
nsAutoString unicodeString (aAddress);
char * utf8Version = unicodeString.ToNewUTF8String();
if (utf8Version)
{
rv = CollectAddress(utf8Version);
Recycle(utf8Version);
}
return rv;
}
NS_IMETHODIMP nsAbAddressCollecter::CollectAddress(const char *address)
{
nsresult rv;

View File

@ -38,7 +38,7 @@ public:
virtual ~nsAbAddressCollecter();
NS_DECL_ISUPPORTS
NS_DECL_NSIABADDRESSCOLLECTER
NS_DECL_NSIABADDRESSCOLLECTER
nsresult OpenHistoryAB(nsIAddrDatabase **aDatabase);
nsresult IsDomainExcluded(const char *address, nsIPref *pPref, PRBool *bExclude);