本文整理汇总了C++中IMPORT_LOG0函数的典型用法代码示例。如果您正苦于以下问题:C++ IMPORT_LOG0函数的具体用法?C++ IMPORT_LOG0怎么用?C++ IMPORT_LOG0使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IMPORT_LOG0函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IMPORT_LOG0
/*
This is where the real work happens!
Go through the field map and set the data in a new database row
*/
nsresult nsTextAddress::ProcessLine(const nsAString &aLine, nsString &errors) {
if (!m_fieldMap) {
IMPORT_LOG0("*** Error, text import needs a field map\n");
return NS_ERROR_FAILURE;
}
nsresult rv;
// Wait until we get our first non-empty field, then create a new row,
// fill in the data, then add the row to the database.
nsCOMPtr<nsIMdbRow> newRow;
nsAutoString fieldVal;
int32_t fieldNum;
int32_t numFields = 0;
bool active;
rv = m_fieldMap->GetMapSize(&numFields);
for (int32_t i = 0; (i < numFields) && NS_SUCCEEDED(rv); i++) {
active = false;
rv = m_fieldMap->GetFieldMap(i, &fieldNum);
if (NS_SUCCEEDED(rv)) rv = m_fieldMap->GetFieldActive(i, &active);
if (NS_SUCCEEDED(rv) && active) {
if (GetField(aLine, i, fieldVal, m_delim)) {
if (!fieldVal.IsEmpty()) {
if (!newRow) {
rv = m_database->GetNewRow(getter_AddRefs(newRow));
if (NS_FAILED(rv)) {
IMPORT_LOG0("*** Error getting new address database row\n");
}
}
if (newRow) {
rv = m_fieldMap->SetFieldValue(m_database, newRow, fieldNum,
fieldVal.get());
}
}
} else
break;
} else if (active) {
IMPORT_LOG1("*** Error getting field map for index %ld\n", (long)i);
}
}
if (NS_SUCCEEDED(rv) && newRow) rv = m_database->AddCardRowToDB(newRow);
return rv;
}
示例2: NS_NewLocalFileInputStream
nsresult nsTextAddress::ReadRecordNumber(nsIFile *aSrc, nsAString &aLine,
int32_t rNum) {
nsCOMPtr<nsIInputStream> inputStream;
nsresult rv = NS_NewLocalFileInputStream(getter_AddRefs(inputStream), aSrc);
if (NS_FAILED(rv)) {
IMPORT_LOG0("*** Error opening address file for reading\n");
return rv;
}
int32_t rIndex = 0;
uint64_t bytesLeft = 0;
rv = inputStream->Available(&bytesLeft);
if (NS_FAILED(rv)) {
IMPORT_LOG0("*** Error checking address file for eof\n");
inputStream->Close();
return rv;
}
nsCOMPtr<nsIUnicharLineInputStream> lineStream;
rv = GetUnicharLineStreamForFile(aSrc, inputStream,
getter_AddRefs(lineStream));
if (NS_FAILED(rv)) {
IMPORT_LOG0("*** Error opening converter stream for importer\n");
return rv;
}
bool more = true;
while (more && (rIndex <= rNum)) {
rv = ReadRecord(lineStream, aLine, &more);
if (NS_FAILED(rv)) {
inputStream->Close();
return rv;
}
if (rIndex == rNum) {
inputStream->Close();
return NS_OK;
}
rIndex++;
}
return NS_ERROR_FAILURE;
}
示例3: PR_NewLogModule
nsTextImport::nsTextImport()
{
// Init logging module.
if (!TEXTIMPORTLOGMODULE)
TEXTIMPORTLOGMODULE = PR_NewLogModule("IMPORT");
IMPORT_LOG0( "nsTextImport Module Created\n");
nsTextStringBundle::GetStringBundle();
}
示例4: NS_CopyUnicodeToNative
bool OutlookSettings::DoIMAPServer(nsIMsgAccountManager *aMgr,
nsIWindowsRegKey *aKey,
const nsString &aServerName,
nsIMsgAccount **aAccount) {
nsAutoString userName;
nsresult rv;
rv = aKey->ReadStringValue(NS_LITERAL_STRING("IMAP User Name"), userName);
if (NS_FAILED(rv)) return false;
bool result = false;
// I now have a user name/server name pair, find out if it already exists?
nsAutoCString nativeUserName;
NS_CopyUnicodeToNative(userName, nativeUserName);
nsAutoCString nativeServerName;
NS_CopyUnicodeToNative(aServerName, nativeServerName);
nsCOMPtr<nsIMsgIncomingServer> in;
rv = aMgr->FindServer(nativeUserName, nativeServerName,
NS_LITERAL_CSTRING("imap"), getter_AddRefs(in));
if (NS_FAILED(rv) || (in == nullptr)) {
// Create the incoming server and an account for it?
rv = aMgr->CreateIncomingServer(nativeUserName, nativeServerName,
NS_LITERAL_CSTRING("imap"),
getter_AddRefs(in));
if (NS_SUCCEEDED(rv) && in) {
rv = in->SetType(NS_LITERAL_CSTRING("imap"));
// TODO SSL, auth method
IMPORT_LOG2("Created IMAP server named: %s, userName: %s\n",
nativeServerName.get(), nativeUserName.get());
nsAutoString prettyName;
if (NS_SUCCEEDED(GetAccountName(aKey, aServerName, prettyName)))
rv = in->SetPrettyName(prettyName);
// We have a server, create an account.
nsCOMPtr<nsIMsgAccount> account;
rv = aMgr->CreateAccount(getter_AddRefs(account));
if (NS_SUCCEEDED(rv) && account) {
rv = account->SetIncomingServer(in);
IMPORT_LOG0(
"Created an account and set the IMAP server as the incoming "
"server\n");
// Fiddle with the identities
SetIdentities(aMgr, account, aKey);
result = true;
if (aAccount) account.forget(aAccount);
}
}
} else
result = true;
return result;
}
示例5: IMPORT_LOG0
void WMSettings::SetIdentities(nsIMsgAccountManager *pMgr, nsIMsgAccount *pAcc,
nsIDOMDocument *xmlDoc, nsAutoString &inUserName,
int32_t authMethodIncoming, bool isNNTP)
{
// Get the relevant information for an identity
// BUG 470587. Don't set this: id->SetIdentityName(fullName);
nsresult rv;
nsAutoString value;
nsCOMPtr<nsIMsgIdentity> id;
rv = pMgr->CreateIdentity(getter_AddRefs(id));
if (id) {
IMPORT_LOG0("Created identity and added to the account\n");
if (NS_SUCCEEDED(nsWMUtils::GetValueForTag(xmlDoc,
isNNTP ?
"NNTP_Display_Name" :
"SMTP_Display_Name",
value))) {
id->SetFullName(value);
IMPORT_LOG1("\tname: %S\n", value.get());
}
if (NS_SUCCEEDED(nsWMUtils::GetValueForTag(xmlDoc,
isNNTP ?
"NNTP_Organization_Name" :
"SMTP_Organization_Name",
value))) {
id->SetOrganization(value);
}
if (NS_SUCCEEDED(nsWMUtils::GetValueForTag(xmlDoc,
isNNTP ?
"NNTP_Email_Address" :
"SMTP_Email_Address",
value))) {
id->SetEmail(NS_ConvertUTF16toUTF8(value));
IMPORT_LOG1("\temail: %S\n", value.get());
}
if (NS_SUCCEEDED(nsWMUtils::GetValueForTag(xmlDoc,
isNNTP ?
"NNTP_Reply_To_Email_Address" :
"SMTP_Reply_To_Email_Address",
value))) {
id->SetReplyTo(NS_ConvertUTF16toUTF8(value));
}
// Windows users are used to top style quoting.
id->SetReplyOnTop(isNNTP ? 0 : 1);
pAcc->AddIdentity(id);
}
if (!isNNTP) // NNTP does not use SMTP in OE or TB
SetSmtpServer(xmlDoc, id, inUserName, authMethodIncoming);
}
示例6: return
PRBool nsOE5File::ReadIndex( nsIInputStream *pInputStream, PRUint32 **ppIndex, PRUint32 *pSize)
{
*ppIndex = nsnull;
*pSize = 0;
char signature[4];
if (!ReadBytes( pInputStream, signature, 0, 4))
return( PR_FALSE);
for (int i = 0; i < 4; i++) {
if (signature[i] != gSig[i]) {
IMPORT_LOG0( "*** Outlook 5.0 dbx file signature doesn't match\n");
return( PR_FALSE);
}
}
PRUint32 offset = 0x00e4;
PRUint32 indexStart = 0;
if (!ReadBytes( pInputStream, &indexStart, offset, 4)) {
IMPORT_LOG0( "*** Unable to read offset to index start\n");
return( PR_FALSE);
}
PRUint32Array array;
array.count = 0;
array.alloc = kIndexGrowBy;
array.pIndex = new PRUint32[kIndexGrowBy];
PRUint32 next = ReadMsgIndex( pInputStream, indexStart, &array);
while (next) {
next = ReadMsgIndex( pInputStream, next, &array);
}
if (array.count) {
*pSize = array.count;
*ppIndex = array.pIndex;
return( PR_TRUE);
}
delete [] array.pIndex;
return( PR_FALSE);
}
示例7: GetServerAndUserName
PRBool nsEudoraWin32::BuildIMAPAccount( nsIMsgAccountManager *accMgr, const char *pSection, const char *pIni, nsIMsgAccount **ppAccount)
{
char valBuff[kIniValueSize];
nsCString serverName;
nsCString userName;
GetServerAndUserName( pSection, pIni, serverName, userName, valBuff);
if (serverName.IsEmpty() || userName.IsEmpty())
return( PR_FALSE);
PRBool result = PR_FALSE;
nsCOMPtr<nsIMsgIncomingServer> in;
nsresult rv = accMgr->FindServer( userName, serverName, NS_LITERAL_CSTRING("imap"), getter_AddRefs(in));
if (NS_FAILED( rv) || (in == nsnull))
{
// Create the incoming server and an account for it?
rv = accMgr->CreateIncomingServer( userName, serverName, NS_LITERAL_CSTRING("imap"), getter_AddRefs(in));
if (NS_SUCCEEDED( rv) && in)
{
rv = in->SetType(NS_LITERAL_CSTRING("imap"));
// rv = in->SetHostName( serverName);
// rv = in->SetUsername( userName);
IMPORT_LOG2( "Created IMAP server named: %s, userName: %s\n", serverName.get(), userName.get());
nsString prettyName;
GetAccountName( pSection, prettyName);
IMPORT_LOG1( "\tSet pretty name to: %S\n", prettyName.get());
rv = in->SetPrettyName(prettyName);
// We have a server, create an account.
nsCOMPtr<nsIMsgAccount> account;
rv = accMgr->CreateAccount( getter_AddRefs( account));
if (NS_SUCCEEDED( rv) && account)
{
rv = account->SetIncomingServer(in);
IMPORT_LOG0( "Created an account and set the IMAP server as the incoming server\n");
// Fiddle with the identities
SetIdentities(accMgr, account, pSection, pIni, userName.get(), serverName.get(), valBuff);
result = PR_TRUE;
if (ppAccount)
account->QueryInterface( NS_GET_IID(nsIMsgAccount), (void **)ppAccount);
}
}
}
else
result = PR_TRUE;
return( result);
}
示例8: NS_ENSURE_ARG_POINTER
NS_IMETHODIMP nsEudoraFilters::Import(char16_t **aError, bool *_retval)
{
NS_ENSURE_ARG_POINTER(aError);
NS_ENSURE_ARG_POINTER(_retval);
nsresult rv;
*_retval = false;
*aError = nullptr;
// Get the settings file if it doesn't exist
if (!m_pLocation)
{
m_pLocation = do_CreateInstance (NS_LOCAL_FILE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
#if defined(XP_WIN)
if (!nsEudoraWin32::FindFiltersFile(getter_AddRefs(m_pLocation)))
m_pLocation = nullptr;
#endif
#ifdef XP_MACOSX
if (!nsEudoraMac::FindFiltersFile(getter_AddRefs(m_pLocation)))
m_pLocation = nullptr;
#endif
}
if (!m_pLocation)
{
IMPORT_LOG0("*** Error, unable to locate filters file for import.\n");
return NS_ERROR_FAILURE;
}
// Now perform actual importing task
*_retval = RealImport();
*aError = ToNewUnicode(m_errorLog);
if (*_retval)
IMPORT_LOG0("Successful import of eudora filters\n");
else
IMPORT_LOG0("*** Error, Unsuccessful import of eudora filters\n");
return NS_OK;
}
示例9: NS_NewISupportsArray
PRBool nsOEScanBoxes::GetMailboxList( nsIFile * root, nsISupportsArray **pArray)
{
nsresult rv = NS_NewISupportsArray( pArray);
if (NS_FAILED( rv)) {
IMPORT_LOG0( "FAILED to allocate the nsISupportsArray\n");
return( PR_FALSE);
}
BuildMailboxList( nsnull, root, 1, *pArray);
return( PR_TRUE);
}
示例10: PR_NewLogModule
nsAppleMailImportModule::nsAppleMailImportModule()
{
// Init logging module.
if (!APPLEMAILLOGMODULE)
APPLEMAILLOGMODULE = PR_NewLogModule("APPLEMAILIMPORTLOG");
IMPORT_LOG0("nsAppleMailImportModule Created");
nsCOMPtr<nsIStringBundleService> bundleService(do_GetService(NS_STRINGBUNDLE_CONTRACTID));
if (bundleService)
bundleService->CreateBundle(APPLEMAIL_MSGS_URL, getter_AddRefs(mBundle));
}
示例11: NS_NewLocalFileInputStream
nsresult nsTextAddress::ReadRecordNumber(nsIFile *aSrc, nsCString &aLine, PRInt32 rNum)
{
nsCOMPtr<nsIInputStream> inputStream;
nsresult rv = NS_NewLocalFileInputStream(getter_AddRefs(inputStream), aSrc);
if (NS_FAILED(rv)) {
IMPORT_LOG0( "*** Error opening address file for reading\n");
return rv;
}
PRInt32 rIndex = 0;
PRUint32 bytesLeft = 0;
rv = inputStream->Available(&bytesLeft);
if (NS_FAILED(rv)) {
IMPORT_LOG0( "*** Error checking address file for eof\n");
inputStream->Close();
return rv;
}
nsCOMPtr<nsILineInputStream> lineStream(do_QueryInterface(inputStream, &rv));
NS_ENSURE_SUCCESS(rv, rv);
bool more = true;
while (more && (rIndex <= rNum)) {
rv = ReadRecord(lineStream, aLine, &more);
if (NS_FAILED(rv)) {
inputStream->Close();
return rv;
}
if (rIndex == rNum) {
inputStream->Close();
return NS_OK;
}
rIndex++;
}
return NS_ERROR_FAILURE;
}
示例12: getter_AddRefs
void nsImportGenericAddressBooks::GetDefaultBooks(void)
{
if (!m_pInterface || m_Books)
return;
if (!m_pLocation && !m_autoFind)
return;
nsresult rv = m_pInterface->FindAddressBooks(m_pLocation, getter_AddRefs(m_Books));
if (NS_FAILED(rv)) {
IMPORT_LOG0("*** Error: FindAddressBooks failed\n");
}
}
示例13: PR_NewLogModule
nsAppleMailImportModule::nsAppleMailImportModule()
{
// Init logging module.
if (!APPLEMAILLOGMODULE)
APPLEMAILLOGMODULE = PR_NewLogModule("APPLEMAILIMPORTLOG");
IMPORT_LOG0("nsAppleMailImportModule Created");
nsCOMPtr<nsIStringBundleService> bundleService =
mozilla::services::GetStringBundleService();
if (bundleService)
bundleService->CreateBundle(APPLEMAIL_MSGS_URL, getter_AddRefs(mBundle));
}
示例14: IMPORT_LOG0
nsresult
nsWMUtils::GetRootFolder(nsIFile **aRootFolder)
{
nsCOMPtr<nsIWindowsRegKey> key;
if (NS_FAILED(nsWMUtils::FindWMKey(getter_AddRefs(key)))) {
IMPORT_LOG0("*** Error finding Windows Live Mail registry account keys\n");
return NS_ERROR_NOT_AVAILABLE;
}
// This is essential to proceed; it is the location on disk of xml-type account files;
// it is in reg_expand_sz so it will need expanding to absolute path.
nsString storeRoot;
nsresult rv = key->ReadStringValue(NS_LITERAL_STRING("Store Root"), storeRoot);
key->Close(); // Finished with windows registry key. We do not want to return before this closing
if (NS_FAILED(rv) || storeRoot.IsEmpty()) {
IMPORT_LOG0("*** Error finding Windows Live Mail Store Root\n");
return rv;
}
uint32_t size = ::ExpandEnvironmentStringsW((LPCWSTR)storeRoot.get(), nullptr, 0);
nsString expandedStoreRoot;
expandedStoreRoot.SetLength(size - 1);
if (expandedStoreRoot.Length() != size - 1)
return false;
::ExpandEnvironmentStringsW((LPCWSTR)storeRoot.get(),
(LPWSTR)expandedStoreRoot.BeginWriting(),
size);
storeRoot = expandedStoreRoot;
nsCOMPtr<nsIFile> rootFolder(do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv, rv);
rv = rootFolder->InitWithPath(storeRoot);
NS_ENSURE_SUCCESS(rv, rv);
rootFolder.forget(aRootFolder);
return NS_OK;
}
示例15: while
nsresult nsEudoraCompose::ReadHeaders( ReadFileState *pState, SimpleBufferTonyRCopiedOnce& copy, SimpleBufferTonyRCopiedOnce& header)
{
// This should be the headers...
header.m_writeOffset = 0;
nsresult rv;
PRInt32 lineLen;
PRInt32 endLen = -1;
PRInt8 endBuffer = 0;
while ((endLen = IsEndHeaders( copy)) == -1) {
while ((lineLen = FindNextEndLine( copy)) == -1) {
copy.m_writeOffset = copy.m_bytesInBuf;
if (!header.Write( copy.m_pBuffer, copy.m_writeOffset)) {
IMPORT_LOG0( "*** ERROR, writing headers\n");
return( NS_ERROR_FAILURE);
}
if (NS_FAILED( rv = FillMailBuffer( pState, copy))) {
IMPORT_LOG0( "*** Error reading message headers\n");
return( rv);
}
if (!copy.m_bytesInBuf) {
IMPORT_LOG0( "*** Error, end of file while reading headers\n");
return( NS_ERROR_FAILURE);
}
}
copy.m_writeOffset += lineLen;
if ((copy.m_writeOffset + 4) >= copy.m_bytesInBuf) {
if (!header.Write( copy.m_pBuffer, copy.m_writeOffset)) {
IMPORT_LOG0( "*** ERROR, writing headers 2\n");
return( NS_ERROR_FAILURE);
}
if (NS_FAILED( rv = FillMailBuffer( pState, copy))) {
IMPORT_LOG0( "*** Error reading message headers 2\n");
return( rv);
}
}
}
if (!header.Write( copy.m_pBuffer, copy.m_writeOffset)) {
IMPORT_LOG0( "*** Error writing final headers\n");
return( NS_ERROR_FAILURE);
}
if (!header.Write( (const char *)&endBuffer, 1)) {
IMPORT_LOG0( "*** Error writing header trailing null\n");
return( NS_ERROR_FAILURE);
}
copy.m_writeOffset += endLen;
return( NS_OK);
}