rv = prefs->Startup("prefs50.js"); if (NS_FAILED(rv)) printf("Couldn't read prefs\n");
static nsresult printIdentity(nsIMsgIdentity *);static nsresult printAccount(nsIMsgAccount *);static nsresult printIncomingServer(nsIMsgIncomingServer*);/* I tried to rip this from webshell/tests/viewer/nsSetupRegistry.cpp and    then realized it was futile.   this is SO ugly, but I'm not going to copy stuff from this file,   it's too big*/#include "../../../../webshell/tests/viewer/nsSetupRegistry.cpp"int main() {  nsresult rv;  NS_SetupRegistry();  printf("Kicking off prefs\n");  static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);  nsIPref *prefs;  // start up prefs  rv = nsServiceManager::GetService(kPrefServiceCID,                                    nsIPref::GetIID(),                                    (nsISupports**)&prefs);  if (NS_FAILED(rv)) {    printf("Couldn't start prefs\n");    exit(1);  }  rv = prefs->Startup("prefs50.js");  if (NS_FAILED(rv)) printf("Couldn't read prefs\n");  nsIMsgAccountManager *accountManager;  rv = nsComponentManager::CreateInstance(kMsgAccountManagerCID,                                          nsnull,                                          nsIMsgAccountManager::GetIID(),                                          (void **)&accountManager);  if (NS_FAILED(rv)) {    printf("Couldn't create the account manager. Check that autoregistration is working\n");    return 1;  }  rv = accountManager->LoadAccounts();  if (NS_FAILED(rv)) {    printf("Error loading accounts\n");    return 1;  }    nsIMsgAccount *account;  rv = accountManager->GetDefaultAccount(&account);  if (NS_FAILED(rv)) {    printf("Error getting default account\n");    return 1;  }  rv = printAccount(account);    if (NS_FAILED(rv)) {    printf("Error %8.8X printing account\n", rv);    return 1;  }}static nsresultprintAccount(nsIMsgAccount *account){  nsresult rv;  if (!account) {    printf("No account\n");    return NS_ERROR_UNEXPECTED;  }    printf("Incoming Server data:\n");  nsIMsgIncomingServer *server;  rv = account->GetIncomingServer(&server);  if (NS_FAILED(rv)) {    printf("No incoming server\n");    //    return rv;  } else {    rv = printIncomingServer(server);  //  if (NS_FAILED(rv)) return rv;  }  printf("Identity data:\n");  //nsIEnumerator *identities;  nsIMsgIdentity *identity;    //rv = account->getIdentities(&identities);  //  if (NS_FAILED(rv)) return rv;  rv = account->GetDefaultIdentity(&identity);  if (NS_FAILED(rv)) {    printf("No Identity\n");    return rv;  }  rv = printIdentity(identity);  if (NS_FAILED(rv)) {    printf("Error printing identity\n");    return rv;  }  return rv;};static nsresultprintIdentity(nsIMsgIdentity *identity){  if (!identity) return NS_ERROR_NULL_POINTER;  char *value;  nsresult rv;  rv = identity->GetIdentityName(&value);  if (NS_SUCCEEDED(rv) && value) printf("\tID Name: %s\n", value);  rv = identity->GetFullName(&value);  if (NS_SUCCEEDED(rv) && value) printf("\tFullName: %s\n", value);  rv = identity->GetEmail(&value);  if (NS_SUCCEEDED(rv) && value) printf("\tEmail: %s\n", value);    rv = identity->GetReplyTo(&value);  if (NS_SUCCEEDED(rv) && value) printf("\tReplyTo: %s\n", value);  rv = identity->GetOrganization(&value);  if (NS_SUCCEEDED(rv) && value) printf("\tOrganization: %s\n", value);    rv = identity->GetSmtpHostname(&value);  if (NS_SUCCEEDED(rv) && value) printf("\tSmtpHostname: %s\n", value);  rv = identity->GetSmtpUsername(&value);    if (NS_SUCCEEDED(rv) && value) printf("\tSmtpUsername: %s\n", value);  return rv;}