rem:  if (gSearchInput.searchMode == kQuickSearchSender || gSearchInput.searchMode == kQuickSearchSenderOrSubject) { term = gSearchSession.createTerm(); value = term.value; value.str = termList[i]; term.value = value; term.attrib = searchAttrib; term.op = nsMsgSearchOp.Contains; term.booleanAnd = false; searchTermsArray.AppendElement(term); } } 
add:  if (gSearchInput.searchMode == kQuickSearchSender || gSearchInput.searchMode == kQuickSearchSenderOrSubject) { term = gSearchSession.createTerm(); value = term.value; value.str = termList[i]; term.value = value; term.attrib = searchAttrib; term.op = nsMsgSearchOp.Contains; term.booleanAnd = false; searchTermsArray.AppendElement(term); } } 
context: function createSearchTerms(){  var nsMsgSearchScope = Components.interfaces.nsMsgSearchScope;  var nsMsgSearchAttrib = Components.interfaces.nsMsgSearchAttrib;  var nsMsgSearchOp = Components.interfaces.nsMsgSearchOp;  // create an i supports array to store our search terms   var searchTermsArray = Components.classes["@mozilla.org/supports-array;1"].createInstance(Components.interfaces.nsISupportsArray);  var selectedFolder = GetThreadPaneFolder();  var searchAttrib = (IsSpecialFolder(selectedFolder, MSG_FOLDER_FLAG_SENTMAIL | MSG_FOLDER_FLAG_DRAFTS | MSG_FOLDER_FLAG_QUEUE)) ? nsMsgSearchAttrib.ToOrCC : nsMsgSearchAttrib.Sender;  // implement | for QS  // does this break if the user types "foo|bar" expecting to see subjects with that string?  // I claim no, since "foo|bar" will be a hit for "foo" || "bar"  // they just might get more false positives  if (!gSearchInput.showingSearchCriteria) // ignore the text box value if it's just showing the search criteria string  {  var termList = gSearchInput.value.split("|");  for (var i = 0; i < termList.length; i ++)  {    // if the term is empty, skip it    if (termList[i] == "")      continue;    // create, fill, and append the subject term    var term;    var value;    // if our search criteria is subject or subject|sender then add a term for the subject    if (gSearchInput.searchMode == kQuickSearchSubject || gSearchInput.searchMode == kQuickSearchSenderOrSubject)    {       term = gSearchSession.createTerm();       value = term.value;    value.str = termList[i];    term.value = value;    term.attrib = nsMsgSearchAttrib.Subject;    term.op = nsMsgSearchOp.Contains;    term.booleanAnd = false;    searchTermsArray.AppendElement(term);     }     if (gSearchInput.searchMode == kQuickSearchBody)     {       // what do we do for news and imap users that aren't configured for offline use?       // in these cases the body search will never return any matches. Should we try to        // see if body is a valid search scope in this particular case before doing the search?       // should we switch back to a subject/sender search behind the scenes?       term = gSearchSession.createTerm();       value = term.value;       value.str = termList[i];       term.value = value;       term.attrib = nsMsgSearchAttrib.Body;       term.op = nsMsgSearchOp.Contains;        term.booleanAnd = false;       searchTermsArray.AppendElement(term);            }    // create, fill, and append the sender (or recipient) term    if (gSearchInput.searchMode == kQuickSearchSender || gSearchInput.searchMode == kQuickSearchSenderOrSubject)    {    term = gSearchSession.createTerm();    value = term.value;    value.str = termList[i];    term.value = value;    term.attrib = searchAttrib;    term.op = nsMsgSearchOp.Contains;     term.booleanAnd = false;    searchTermsArray.AppendElement(term);  }  }  }  // now append the default view criteria to the quick search so we don't lose any default  // view information  if (gDefaultSearchViewTerms)  {    var isupports = null;    var searchTerm;     var termsArray = gDefaultSearchViewTerms.QueryInterface(Components.interfaces.nsISupportsArray);    for (i = 0; i < termsArray.Count(); i++)    {      isupports = termsArray.GetElementAt(i);      searchTerm = isupports.QueryInterface(Components.interfaces.nsIMsgSearchTerm);      searchTermsArray.AppendElement(searchTerm);    }  }    createSearchTermsWithList(searchTermsArray);    // now that we've added the terms, clear out our input array  searchTermsArray.Clear();}
meta: 9421	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9421/c8d5f0018a72b4a1986c3645dbd3a14e311596e9/searchBar.js/buggy/mail/base/content/searchBar.js