else if ((property == kNC_NameSort) || (property == kNC_FolderTreeNameSort)) {   nsCOMPtr<nsIMsgIncomingServer> server; rv = getServerForFolderNode(source, getter_AddRefs(server));   if (NS_FAILED(rv) || !server) return NS_RDF_NO_VALUE;        PRInt32 accountNum; nsCOMPtr<nsIMsgAccountManager> am = do_QueryReferent(mAccountManager);  if (isDefaultServer(server)) str = NS_LITERAL_STRING("0000"); else {  rv = am->FindServerIndex(server, &accountNum); if (NS_FAILED(rv)) return rv;   nsXPIDLCString serverType; server->GetType(getter_Copies(serverType));  if (nsCRT::strcasecmp(serverType, "none")==0) accountNum += 2000; else if (nsCRT::strcasecmp(serverType, "nntp")==0) accountNum += 3000; else accountNum += 1000;  str.AppendInt(accountNum); }
else if (PL_strcmp(propval, NC_RDF_PAGETAG)==0) {  if (PL_strcmp(srcval, NC_RDF_PAGETITLE_SERVER)==0) str = "am-server.xul"; else if (PL_strcmp(srcval, NC_RDF_PAGETITLE_COPIES)==0) str = "am-copies.xul"; else if (PL_strcmp(srcval, NC_RDF_PAGETITLE_ADVANCED)==0) str = "am-advanced.xul"; else str = "am-main.xul";
nsMsgAccountManagerDataSource::GetTarget(nsIRDFResource *source,                                         nsIRDFResource *property,                                         PRBool aTruthValue,                                         nsIRDFNode **target){  nsresult rv;      rv = NS_RDF_NO_VALUE;  nsAutoString str;  if (property == kNC_Name || property == kNC_FolderTreeName) {      rv = getStringBundle();      NS_ENSURE_SUCCESS(rv, rv);            nsXPIDLString pageTitle;      if (source == kNC_PageTitleServer)          mStringBundle->GetStringFromName(NS_ConvertASCIItoUCS2("prefPanel-server").GetUnicode(),                                           getter_Copies(pageTitle));            else if (source == kNC_PageTitleCopies)          mStringBundle->GetStringFromName(NS_ConvertASCIItoUCS2("prefPanel-copies").GetUnicode(),                                           getter_Copies(pageTitle));      else if (source == kNC_PageTitleAdvanced)          mStringBundle->GetStringFromName(NS_ConvertASCIItoUCS2("prefPanel-advanced").GetUnicode(),                                           getter_Copies(pageTitle));      else if (source == kNC_PageTitleSMTP)          mStringBundle->GetStringFromName(NS_ConvertASCIItoUCS2("prefPanel-smtp").GetUnicode(),                                           getter_Copies(pageTitle));      else {          nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(source, &rv);          if (NS_SUCCEEDED(rv)) {              PRBool isServer;              rv = folder->GetIsServer(&isServer);              if(NS_SUCCEEDED(rv) && isServer)                  rv = folder->GetPrettyName(getter_Copies(pageTitle));          }      }      str.Assign((const PRUnichar*)pageTitle);  }  else if (property == kNC_PageTag) {    // do NOT localize these strings. these are the urls of the XUL files    if (source == kNC_PageTitleServer)      str.AssignWithConversion("am-server.xul");    else if (source == kNC_PageTitleCopies)      str.AssignWithConversion("am-copies.xul");    else if (source == kNC_PageTitleAdvanced)      str.AssignWithConversion("am-advanced.xul");    else if (source == kNC_PageTitleSMTP)       str.AssignWithConversion("am-smtp.xul");    else {      str.AssignWithConversion("am-main.xul");      /* if this is a server, with no identities, then we show a special panel */      nsCOMPtr<nsIMsgIncomingServer> server;      rv = getServerForFolderNode(source, getter_AddRefs(server));      if (server) {          PRBool hasIdentities;          rv = serverHasIdentities(server, &hasIdentities);          if (NS_SUCCEEDED(rv) && !hasIdentities) {            str.AssignWithConversion("am-serverwithnoidentities.xul");          }      }    }  }  // handle sorting of servers  else if ((property == kNC_NameSort) ||           (property == kNC_FolderTreeNameSort)) {    // make sure we're handling a root folder that is a server    nsCOMPtr<nsIMsgIncomingServer> server;    rv = getServerForFolderNode(source, getter_AddRefs(server));    // only answer for servers!    if (NS_FAILED(rv) || !server)        return NS_RDF_NO_VALUE;    // order is:    // - default account    // - <other servers>    // - Local Folders    // - news        PRInt32 accountNum;    nsCOMPtr<nsIMsgAccountManager> am =        do_QueryReferent(mAccountManager);    if (isDefaultServer(server))        str = NS_LITERAL_STRING("0000");    else {            rv = am->FindServerIndex(server, &accountNum);        if (NS_FAILED(rv)) return rv;                // this is a hack for now - hardcode server order by type        nsXPIDLCString serverType;        server->GetType(getter_Copies(serverType));                if (nsCRT::strcasecmp(serverType, "none")==0)            accountNum += 2000;        else if (nsCRT::strcasecmp(serverType, "nntp")==0)            accountNum += 3000;        else            accountNum += 1000;     // default is to appear at the top                str.AppendInt(accountNum);    }  }  // GetTargets() stuff - need to return a valid answer so that  // twisties will appear  else if (property == kNC_Settings) {    nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(source,&rv);    if (NS_FAILED(rv))      return NS_RDF_NO_VALUE;        PRBool isServer=PR_FALSE;    folder->GetIsServer(&isServer);    // no need to localize this!    if (isServer)      str.AssignWithConversion("ServerSettings");  }  else if (property == kNC_IsDefaultServer) {      nsCOMPtr<nsIMsgIncomingServer> thisServer;      rv = getServerForFolderNode(source, getter_AddRefs(thisServer));      if (NS_FAILED(rv) || !thisServer) return NS_RDF_NO_VALUE;            nsCOMPtr<nsIMsgAccountManager> am =          do_QueryReferent(mAccountManager);            nsCOMPtr<nsIMsgAccount> defaultAccount;      rv = am->GetDefaultAccount(getter_AddRefs(defaultAccount));      NS_ENSURE_SUCCESS(rv, rv);      if (!defaultAccount) return NS_RDF_NO_VALUE;      nsCOMPtr<nsIMsgIncomingServer> defaultServer;      rv = defaultAccount->GetIncomingServer(getter_AddRefs(defaultServer));      NS_ENSURE_SUCCESS(rv, rv);      if (!defaultServer) return NS_RDF_NO_VALUE;      PRBool isEqual;      rv = defaultServer->Equals(thisServer, &isEqual);      NS_ENSURE_SUCCESS(rv, rv);      if (isEqual)          str.AssignWithConversion("true");  }    if (!str.IsEmpty())    rv = createNode(str, target, getRDFService());  //if we have an empty string and we don't have an error value, then   //we don't have a value for RDF.  else if(NS_SUCCEEDED(rv))	rv = NS_RDF_NO_VALUE;  return rv;}