} NS_NAMESPACE_END //---------------------------------------------------------------------------------------- nsresult ns_file_convert_result(PRInt32 nativeErr) //---------------------------------------------------------------------------------------- { return nativeErr ? NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES,((nativeErr)&0xFFFF)) : NS_OK; }
static nsresult ns_file_convert_result(PRInt32 nativeErr) { return nativeErr ? NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES,((nativeErr)&0xFFFF)) : NS_OK; }
nsresult nsLDAPAutoCompleteSession::OnLDAPSearchResult(nsILDAPMessage *aMessage) { nsresult rv; // Temp for return vals PR_LOG(sLDAPAutoCompleteLogModule, PR_LOG_DEBUG, ("nsLDAPAutoCompleteSession::OnLDAPSearchResult entered\n")); // Figure out if we succeeded or failed, and set the status // and default index appropriately. AutoCompleteStatus status; PRInt32 lderrno; if (mEntriesReturned) { status = nsIAutoCompleteStatus::matchFound; // There's at least one match, so the default index should // point to the first thing here. This ensures that if the local // addressbook autocomplete session only found [email protected], // this will be given preference. rv = mResults->SetDefaultItemIndex(0); if (NS_FAILED(rv)) { NS_ERROR("nsLDAPAutoCompleteSession::OnLDAPSearchResult(): " "mResults->SetDefaultItemIndex(0) failed"); FinishAutoCompleteLookup(nsIAutoCompleteStatus::failureItems, rv, BOUND); } } else { // Note that we only look at the error code if there are no results for // this session; if we got results and then an error happened, this // is ignored, in part because it seems likely to be confusing to the // user, and in part because it is likely to be scrolled out of view // anyway. aMessage->GetErrorCode(&lderrno); if (lderrno != nsILDAPErrors::SUCCESS) { PR_LOG(sLDAPAutoCompleteLogModule, PR_LOG_DEBUG, ("nsLDAPAutoCompleteSession::OnLDAPSearchResult(): " "lderrno=%d\n", lderrno)); FinishAutoCompleteLookup(nsIAutoCompleteStatus::failureItems, NS_ERROR_GENERATE_FAILURE( NS_ERROR_MODULE_LDAP, lderrno), BOUND); return NS_OK; } // We could potentially keep track of non-fatal errors to the // search, and if there has been more than 1, and there are no entries, // we could return |failed| instead of |noMatch|. It's unclear to me // that this actually buys us anything though. status = nsIAutoCompleteStatus::noMatch; } // Call the mListener's OnAutoComplete and clean up // // XXXdmose should we really leave the connection BOUND here? FinishAutoCompleteLookup(status, NS_OK, BOUND); return NS_OK; }