Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Events | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes
nsMsgAccountManagerDataSource Class Reference

#include <nsMsgAccountManagerDS.h>

Inheritance diagram for nsMsgAccountManagerDataSource:
Inheritance graph
[legend]
Collaboration diagram for nsMsgAccountManagerDataSource:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsMsgAccountManagerDataSource ()
virtual ~nsMsgAccountManagerDataSource ()
virtual nsresult Init ()
virtual void Cleanup ()
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIFOLDERLISTENER
NS_DECL_NSIINCOMINGSERVERLISTENER
NS_DECL_NSIOBSERVER NS_IMETHOD 
GetTarget (nsIRDFResource *source, nsIRDFResource *property, PRBool aTruthValue, nsIRDFNode **_retval)
NS_IMETHOD GetTargets (nsIRDFResource *source, nsIRDFResource *property, PRBool aTruthValue, nsISimpleEnumerator **_retval)
NS_IMETHOD ArcLabelsOut (nsIRDFResource *source, nsISimpleEnumerator **_retval)
NS_IMETHOD HasAssertion (nsIRDFResource *aSource, nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue, PRBool *_retval)
NS_IMETHOD HasArcOut (nsIRDFResource *source, nsIRDFResource *aArc, PRBool *result)
nsIRDFResource GetSource (in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue)
 Find an RDF resource that points to a given node over the specified arc & truth value.
nsISimpleEnumerator GetSources (in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue)
 Find all RDF resources that point to a given node over the specified arc & truth value.
nsIRDFNode GetTarget (in nsIRDFResource aSource, in nsIRDFResource aProperty, in boolean aTruthValue)
 Find a child of that is related to the source by the given arc arc and truth value.
nsISimpleEnumerator GetTargets (in nsIRDFResource aSource, in nsIRDFResource aProperty, in boolean aTruthValue)
 Find all children of that are related to the source by the given arc arc and truth value.
void Assert (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue)
 Add an assertion to the graph.
void Unassert (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget)
 Remove an assertion from the graph.
void Change (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aOldTarget, in nsIRDFNode aNewTarget)
 Change an assertion from.
void Move (in nsIRDFResource aOldSource, in nsIRDFResource aNewSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget)
 'Move' an assertion from
boolean HasAssertion (in nsIRDFResource aSource, in nsIRDFResource aProperty, in nsIRDFNode aTarget, in boolean aTruthValue)
 Query whether an assertion exists in this graph.
void AddObserver (in nsIRDFObserver aObserver)
 Add an observer to this data source.
void RemoveObserver (in nsIRDFObserver aObserver)
 Remove an observer from this data source.
nsISimpleEnumerator ArcLabelsIn (in nsIRDFNode aNode)
 Get a cursor to iterate over all the arcs that point into a node.
nsISimpleEnumerator ArcLabelsOut (in nsIRDFResource aSource)
 Get a cursor to iterate over all the arcs that originate in a resource.
nsISimpleEnumerator GetAllResources ()
 Retrieve all of the resources that the data source currently refers to.
boolean IsCommandEnabled (in nsISupportsArray aSources, in nsIRDFResource aCommand, in nsISupportsArray aArguments)
 Returns whether a given command is enabled for a set of sources.
void DoCommand (in nsISupportsArray aSources, in nsIRDFResource aCommand, in nsISupportsArray aArguments)
 Perform the specified command on set of sources.
nsISimpleEnumerator GetAllCmds (in nsIRDFResource aSource)
 Returns the set of all commands defined for a given source.
boolean hasArcIn (in nsIRDFNode aNode, in nsIRDFResource aArc)
 Returns true if the specified node is pointed to by the specified arc.
boolean hasArcOut (in nsIRDFResource aSource, in nsIRDFResource aArc)
 Returns true if the specified node has the specified outward arc.
void beginUpdateBatch ()
 Notify observers that the datasource is about to send several notifications at once.
void endUpdateBatch ()
 Notify observers that the datasource has completed issuing a notification group.
void observe (in nsISupports aSubject, in string aTopic, in wstring aData)
 Observe will be called when there is a notification for the topic |aTopic|.
void OnItemAdded (in nsIRDFResource parentItem, in nsISupports item)
void OnItemRemoved (in nsIRDFResource parentItem, in nsISupports item)
void OnItemPropertyChanged (in nsIRDFResource item, in nsIAtom property, in string oldValue, in string newValue)
void OnItemIntPropertyChanged (in nsIRDFResource item, in nsIAtom property, in long oldValue, in long newValue)
void OnItemBoolPropertyChanged (in nsIRDFResource item, in nsIAtom property, in boolean oldValue, in boolean newValue)
void OnItemUnicharPropertyChanged (in nsIRDFResource item, in nsIAtom property, in wstring oldValue, in wstring newValue)
void OnItemPropertyFlagChanged (in nsIMsgDBHdr item, in nsIAtom property, in unsigned long oldFlag, in unsigned long newFlag)
void OnItemEvent (in nsIMsgFolder item, in nsIAtom event)
void onServerLoaded (in nsIMsgIncomingServer server)
void onServerUnloaded (in nsIMsgIncomingServer server)
void onServerChanged (in nsIMsgIncomingServer server)

Public Attributes

readonly attribute string URI
 The "URI" of the data source.
attribute nsIMsgWindow window
const folderListenerNotifyFlagValue added = 0x1
const folderListenerNotifyFlagValue removed = 0x2
const folderListenerNotifyFlagValue propertyChanged = 0x4
const folderListenerNotifyFlagValue intPropertyChanged = 0x8
const folderListenerNotifyFlagValue boolPropertyChanged = 0x10
const folderListenerNotifyFlagValue unicharPropertyChanged = 0x20
const folderListenerNotifyFlagValue propertyFlagChanged = 0x40

Protected Member Functions

nsresult HasAssertionServer (nsIMsgIncomingServer *aServer, nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue, PRBool *_retval)
nsresult HasAssertionAccountRoot (nsIRDFResource *aProperty, nsIRDFNode *aTarget, PRBool aTruthValue, PRBool *_retval)
PRBool isDefaultServer (nsIMsgIncomingServer *aServer)
PRBool supportsFilters (nsIMsgIncomingServer *aServer)
PRBool canGetMessages (nsIMsgIncomingServer *aServer)
PRBool canGetIncomingMessages (nsIMsgIncomingServer *aServer)
nsresult getServerForFolderNode (nsIRDFNode *aResource, nsIMsgIncomingServer **aResult)
nsresult createRootResources (nsIRDFResource *aProperty, nsISupportsArray *aNodeArray)
nsresult createSettingsResources (nsIRDFResource *aSource, nsISupportsArray *aNodeArray)
nsresult appendGenericSettingsResources (nsIMsgIncomingServer *server, nsISupportsArray *aNodeArray)
nsresult appendGenericSetting (const char *name, nsISupportsArray *aNodeArray)
PRBool IsFakeAccountRequired ()
nsresult GetFakeAccountHostName (char **aHostName)
nsresult IsIncomingServerForFakeAccount (nsIMsgIncomingServer *aServer, PRBool *aResult)
nsIRDFServicegetRDFService ()
nsresult NotifyObservers (nsIRDFResource *subject, nsIRDFResource *property, nsIRDFNode *newObject, nsIRDFNode *oldObject, PRBool assert, PRBool change)
virtual nsresult NotifyPropertyChanged (nsIRDFResource *resource, nsIRDFResource *propertyResource, nsIRDFNode *newNode, nsIRDFNode *oldNode=nsnull)
nsresult GetTransactionManager (nsISupportsArray *sources, nsITransactionManager **aTransactionManager)

Static Protected Member Functions

static PRBool isContainment (nsIRDFResource *aProperty)
static nsresult getAccountArcs (nsISupportsArray **aResult)
static nsresult getAccountRootArcs (nsISupportsArray **aResult)
static PRBool assertEnumFunc (nsISupports *aElement, void *aData)
static PRBool unassertEnumFunc (nsISupports *aElement, void *aData)
static PRBool changeEnumFunc (nsISupports *aElement, void *aData)

Protected Attributes

nsCOMPtr< nsIMsgWindowmWindow
PRBool m_shuttingDown
PRBool mInitialized

Static Protected Attributes

static nsIRDFResourcekNC_Name = nsnull
static nsIRDFResourcekNC_FolderTreeName = nsnull
static nsIRDFResourcekNC_FolderTreeSimpleName = nsnull
static nsIRDFResourcekNC_NameSort = nsnull
static nsIRDFResourcekNC_FolderTreeNameSort = nsnull
static nsIRDFResourcekNC_PageTag = nsnull
static nsIRDFResourcekNC_IsDefaultServer = nsnull
static nsIRDFResourcekNC_SupportsFilters = nsnull
static nsIRDFResourcekNC_CanGetMessages = nsnull
static nsIRDFResourcekNC_CanGetIncomingMessages = nsnull
static nsIRDFResourcekNC_Child = nsnull
static nsIRDFResourcekNC_AccountRoot = nsnull
static nsIRDFResourcekNC_Account = nsnull
static nsIRDFResourcekNC_Server = nsnull
static nsIRDFResourcekNC_Identity = nsnull
static nsIRDFResourcekNC_Settings = nsnull
static nsIRDFResourcekNC_Junk = nsnull
static nsIRDFResourcekNC_PageTitleMain = nsnull
static nsIRDFResourcekNC_PageTitleServer = nsnull
static nsIRDFResourcekNC_PageTitleCopies = nsnull
static nsIRDFResourcekNC_PageTitleOfflineAndDiskSpace = nsnull
static nsIRDFResourcekNC_PageTitleDiskSpace = nsnull
static nsIRDFResourcekNC_PageTitleAddressing = nsnull
static nsIRDFResourcekNC_PageTitleSMTP = nsnull
static nsIRDFResourcekNC_PageTitleJunk = nsnull
static nsIRDFResourcekNC_PageTitleFakeAccount = nsnull
static nsIRDFLiteralkTrueLiteral = nsnull
static nsIAtomkDefaultServerAtom = nsnull
static nsrefcnt gAccountManagerResourceRefCnt = 0

Events

const
folderListenerNotifyFlagValue=0 
x80
const folderListenerNotifyFlagValue all = 0xFFFFFFFF

Private Member Functions

nsresult serverHasIdentities (nsIMsgIncomingServer *aServer, PRBool *aResult)
nsresult getStringBundle ()

Static Private Member Functions

static PRBool createServerResources (nsISupports *element, void *data)
static PRBool findServerByKey (nsISupports *aElement, void *aData)

Private Attributes

nsWeakPtr mAccountManager
nsCOMPtr< nsIStringBundlemStringBundle

Static Private Attributes

static nsCOMPtr< nsISupportsArraymAccountArcsOut
static nsCOMPtr< nsISupportsArraymAccountRootArcsOut

Detailed Description

Definition at line 59 of file nsMsgAccountManagerDS.h.


Constructor & Destructor Documentation

Definition at line 156 of file nsMsgAccountManagerDS.cpp.

{
#ifdef DEBUG_amds
  printf("nsMsgAccountManagerDataSource() being created\n");
#endif

  // do per-class initialization here
  if (gAccountManagerResourceRefCnt++ == 0) {
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_CHILD), &kNC_Child);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_NAME), &kNC_Name);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_FOLDERTREENAME),
                                 &kNC_FolderTreeName);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_FOLDERTREESIMPLENAME),
                                 &kNC_FolderTreeSimpleName);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_NAME_SORT), &kNC_NameSort);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_FOLDERTREENAME_SORT),
                                 &kNC_FolderTreeNameSort);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETAG), &kNC_PageTag);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_ISDEFAULTSERVER),
                                 &kNC_IsDefaultServer);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_SUPPORTSFILTERS),
                                 &kNC_SupportsFilters);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_CANGETMESSAGES),
                                 &kNC_CanGetMessages);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_CANGETINCOMINGMESSAGES),
                                 &kNC_CanGetIncomingMessages);

    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_ACCOUNT), &kNC_Account);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_SERVER), &kNC_Server);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_IDENTITY), &kNC_Identity);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_JUNK), &kNC_Junk);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_MAIN),
                                 &kNC_PageTitleMain);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_SERVER),
                                 &kNC_PageTitleServer);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_COPIES),
                                 &kNC_PageTitleCopies);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_OFFLINEANDDISKSPACE),
                                 &kNC_PageTitleOfflineAndDiskSpace);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_DISKSPACE),
                                 &kNC_PageTitleDiskSpace);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_ADDRESSING),
                                 &kNC_PageTitleAddressing);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_SMTP),
                                 &kNC_PageTitleSMTP);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_JUNK),
                                 &kNC_PageTitleJunk);
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_PAGETITLE_FAKEACCOUNT),
                                 &kNC_PageTitleFakeAccount);

    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_ACCOUNTROOT),
                                 &kNC_AccountRoot);

    getRDFService()->GetLiteral(NS_LITERAL_STRING("true").get(),
                                &kTrueLiteral);

    // eventually these need to exist in some kind of array
    // that's easily extensible
    getRDFService()->GetResource(NS_LITERAL_CSTRING(NC_RDF_SETTINGS), &kNC_Settings);

    kDefaultServerAtom = NS_NewAtom("DefaultServer");
  }

  nsCOMPtr<nsIPrefBranch2> prefBranchInternal(do_GetService(NS_PREFSERVICE_CONTRACTID));
  if (prefBranchInternal)
    prefBranchInternal->AddObserver(PREF_SHOW_FAKE_ACCOUNT, this, PR_FALSE);
}

Here is the call graph for this function:


Member Function Documentation

Add an observer to this data source.

If the datasource supports observers, the datasource source should hold a strong reference to the observer.

Here is the caller graph for this function:

Definition at line 765 of file nsMsgAccountManagerDS.cpp.

{
  NS_ENSURE_ARG_POINTER(name);
  NS_ENSURE_ARG_POINTER(aNodeArray);

  nsCOMPtr <nsIRDFResource> resource;

  nsCAutoString resourceStr;
  resourceStr = NC_RDF_PAGETITLE_PREFIX;
  resourceStr += name;

  nsresult rv = getRDFService()->GetResource(resourceStr, getter_AddRefs(resource));
  NS_ENSURE_SUCCESS(rv,rv);

  // AppendElement will addref.
  aNodeArray->AppendElement(resource);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 713 of file nsMsgAccountManagerDS.cpp.

{
  nsresult rv;

  nsCOMPtr<nsICategoryManager> catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
  NS_ENSURE_SUCCESS(rv,rv);

  nsCOMPtr<nsISimpleEnumerator> e;
  rv = catman->EnumerateCategory(MAILNEWS_ACCOUNTMANAGER_EXTENSIONS, getter_AddRefs(e));
  if(NS_SUCCEEDED(rv) && e) {
    while (PR_TRUE) {
      nsCOMPtr<nsISupportsCString> catEntry;
      rv = e->GetNext(getter_AddRefs(catEntry));
      if (NS_FAILED(rv) || !catEntry)
        break;

      nsCAutoString entryString;
      rv = catEntry->GetData(entryString);
      if (NS_FAILED(rv))
        break;

      nsXPIDLCString contractidString;
      rv = catman->GetCategoryEntry(MAILNEWS_ACCOUNTMANAGER_EXTENSIONS, entryString.get(), getter_Copies(contractidString));
      if (NS_FAILED(rv))
        break;

      nsCOMPtr <nsIMsgAccountManagerExtension> extension =
        do_GetService(contractidString.get(), &rv);
      if (NS_FAILED(rv) || !extension)
        break;

      PRBool showPanel;
      rv = extension->ShowPanel(server, &showPanel);
      if (NS_FAILED(rv))
        break;

      if (showPanel) {
        nsXPIDLCString name;
        rv = extension->GetName(getter_Copies(name));
        if (NS_FAILED(rv))
          break;

        rv = appendGenericSetting(name.get(), aNodeArray);
        if (NS_FAILED(rv))
          break;
      }
    }
  }
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Get a cursor to iterate over all the arcs that point into a node.

Returns:
NS_OK unless a catastrophic error occurs. If the method returns NS_OK, you may assume that labels points to a valid (but possible empty) nsISimpleEnumerator object.

Here is the caller graph for this function:

Definition at line 976 of file nsMsgAccountManagerDS.cpp.

{
  nsresult rv;

  // we have to return something, so always create the array/enumerators
  nsCOMPtr<nsISupportsArray> arcs;
  if (source == kNC_AccountRoot)
    rv = getAccountRootArcs(getter_AddRefs(arcs));
  else
    rv = getAccountArcs(getter_AddRefs(arcs));
  NS_ENSURE_SUCCESS(rv, rv);

  rv = NS_NewArrayEnumerator(_retval, arcs);
  if (NS_FAILED(rv)) return rv;

#ifdef DEBUG_amds_
  printf("GetArcLabelsOut(%s): Adding child, settings, and name arclabels\n", value);
#endif

  return NS_OK;
}

Here is the call graph for this function:

Get a cursor to iterate over all the arcs that originate in a resource.

Returns:
NS_OK unless a catastrophic error occurs. If the method returns NS_OK, you may assume that labels points to a valid (but possible empty) nsISimpleEnumerator object.

Here is the caller graph for this function:

void nsIRDFDataSource::Assert ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget,
in boolean  aTruthValue 
) [inherited]

Add an assertion to the graph.

Here is the caller graph for this function:

PRBool nsMsgRDFDataSource::assertEnumFunc ( nsISupports *  aElement,
void aData 
) [static, protected, inherited]

Definition at line 401 of file nsMsgRDFDataSource.cpp.

{
  nsMsgRDFNotification *note = (nsMsgRDFNotification *)aData;
  nsIRDFObserver* observer = (nsIRDFObserver *)aElement;
  
  observer->OnAssert(note->datasource,
                     note->subject,
                     note->property,
                     note->newObject);
  return PR_TRUE;
}

Here is the caller graph for this function:

Notify observers that the datasource is about to send several notifications at once.

This must be followed by calling endUpdateBatch(), otherwise viewers will get out of sync.

Definition at line 1117 of file nsMsgAccountManagerDS.cpp.

{
  nsXPIDLCString type;
  nsresult rv = aServer->GetType(getter_Copies(type));
  NS_ENSURE_SUCCESS(rv, PR_FALSE);

  nsCAutoString contractid(NS_MSGPROTOCOLINFO_CONTRACTID_PREFIX);
  contractid.Append(type);

  nsCOMPtr<nsIMsgProtocolInfo> protocolInfo = do_GetService(contractid.get(), &rv);
  NS_ENSURE_SUCCESS(rv, PR_FALSE);

  PRBool canGetIncomingMessages = PR_FALSE;
  protocolInfo->GetCanGetIncomingMessages(&canGetIncomingMessages);

  return canGetIncomingMessages;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1098 of file nsMsgAccountManagerDS.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIRDFDataSource::Change ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aOldTarget,
in nsIRDFNode  aNewTarget 
) [inherited]

Change an assertion from.

[aSource]--[aProperty]-->[aOldTarget]

to

[aSource]--[aProperty]-->[aNewTarget]

Here is the caller graph for this function:

PRBool nsMsgRDFDataSource::changeEnumFunc ( nsISupports *  aElement,
void aData 
) [static, protected, inherited]

Definition at line 427 of file nsMsgRDFDataSource.cpp.

{
  nsMsgRDFNotification* note = (nsMsgRDFNotification *)aData;
  nsIRDFObserver* observer = (nsIRDFObserver *)aElement;

  observer->OnChange(note->datasource,
                     note->subject,
                     note->property,
                     note->oldObject, note->newObject);
  return PR_TRUE;
}

Here is the caller graph for this function:

Reimplemented from nsMsgRDFDataSource.

Definition at line 307 of file nsMsgAccountManagerDS.cpp.

{
  nsCOMPtr<nsIMsgAccountManager> am = do_QueryReferent(mAccountManager);

  if (am)
  {
    am->RemoveIncomingServerListener(this);
    am->RemoveRootFolderListener(this);
  }

  nsMsgRDFDataSource::Cleanup();
}

Here is the call graph for this function:

Definition at line 670 of file nsMsgAccountManagerDS.cpp.

{
  nsresult rv = NS_OK;
  if (isContainment(property)) {

    nsCOMPtr<nsIMsgAccountManager> am = do_QueryReferent(mAccountManager);
    if (!am) return NS_ERROR_FAILURE;

    nsCOMPtr<nsISupportsArray> servers;
    rv = am->GetAllServers(getter_AddRefs(servers));
    if (NS_FAILED(rv)) return rv;

    // fill up the nodes array with the RDF Resources for the servers
    serverCreationParams params = { aNodeArray, getRDFService() };
    servers->EnumerateForwards(createServerResources, (void*)&params);
#ifdef DEBUG_amds
    PRUint32 nodecount;
    aNodeArray->Count(&nodecount);
    printf("GetTargets(): added %d servers on %s\n", nodecount,
           (const char*)property_arc);
#endif
    // for the "settings" arc, we also want to add SMTP setting and the fake account (if required)
    if (property == kNC_Settings) {
      aNodeArray->AppendElement(kNC_PageTitleSMTP);
      if (IsFakeAccountRequired())
        aNodeArray->AppendElement(kNC_PageTitleFakeAccount);
    }
    else if (property == kNC_Child && IsFakeAccountRequired()) {
      aNodeArray->AppendElement(kNC_PageTitleFakeAccount);
    }
  }

#ifdef DEBUG_amds
  else {
    printf("unknown arc %s on msgaccounts:/\n", (const char*)property_arc);
  }
#endif

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsMsgAccountManagerDataSource::createServerResources ( nsISupports *  element,
void data 
) [static, private]

Definition at line 869 of file nsMsgAccountManagerDS.cpp.

{
  nsresult rv;
  // get parameters out of the data argument
  serverCreationParams *params = (serverCreationParams*)data;
  nsCOMPtr<nsISupportsArray> servers = params->serverArray;
  nsCOMPtr<nsIRDFService> rdf = params->rdfService;

  // the server itself is in the element argument
  nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(element, &rv);
  if (NS_FAILED(rv)) return PR_TRUE;

  nsCOMPtr <nsIMsgFolder> serverFolder;
  rv = server->GetRootFolder(getter_AddRefs(serverFolder));
  if(NS_FAILED(rv)) return PR_TRUE;

  // add the resource to the array
  nsCOMPtr<nsIRDFResource> serverResource = do_QueryInterface(serverFolder);
  if(serverResource)
    (void) servers->AppendElement(serverResource);
  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 787 of file nsMsgAccountManagerDS.cpp.

{
  // If this isn't a server, just return.
  if (aSource == kNC_PageTitleSMTP)
    return NS_OK;

  nsCOMPtr<nsIMsgIncomingServer> server;
  nsresult rv = getServerForFolderNode(aSource, getter_AddRefs(server));
  NS_ENSURE_SUCCESS(rv, rv);
  if (server) {
    PRBool hasIdentities;
    rv = serverHasIdentities(server, &hasIdentities);

    if (hasIdentities) {
      aNodeArray->AppendElement(kNC_PageTitleServer);
      aNodeArray->AppendElement(kNC_PageTitleCopies);
      aNodeArray->AppendElement(kNC_PageTitleAddressing);
    }

    // junk settings apply for all server types except for news
    nsXPIDLCString serverType;
    server->GetType(getter_Copies(serverType));
    if (!serverType.LowerCaseEqualsLiteral("nntp"))
      aNodeArray->AppendElement(kNC_PageTitleJunk);

    // Check the offline capability before adding
    // offline item
    PRInt32 offlineSupportLevel = 0;
    rv = server->GetOfflineSupportLevel(&offlineSupportLevel);
    NS_ENSURE_SUCCESS(rv,rv);

    PRBool supportsDiskSpace;
    rv = server->GetSupportsDiskSpace(&supportsDiskSpace);
    NS_ENSURE_SUCCESS(rv,rv);

    // currently there is no offline without diskspace
    if (offlineSupportLevel >= OFFLINE_SUPPORT_LEVEL_REGULAR) 
      aNodeArray->AppendElement(kNC_PageTitleOfflineAndDiskSpace);
    else if (supportsDiskSpace)
      aNodeArray->AppendElement(kNC_PageTitleDiskSpace);

    if (hasIdentities) {
      // extensions come after the default panels
      rv = appendGenericSettingsResources(server, aNodeArray);
      NS_ASSERTION(NS_SUCCEEDED(rv), "failed to add generic panels");
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIRDFDataSource::DoCommand ( in nsISupportsArray  aSources,
in nsIRDFResource  aCommand,
in nsISupportsArray  aArguments 
) [inherited]

Perform the specified command on set of sources.

Here is the caller graph for this function:

Notify observers that the datasource has completed issuing a notification group.

PRBool nsMsgAccountManagerDataSource::findServerByKey ( nsISupports *  aElement,
void aData 
) [static, private]

Definition at line 1204 of file nsMsgAccountManagerDS.cpp.

{
  nsresult rv;
  findServerByKeyEntry *entry = (findServerByKeyEntry*)aData;

  nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(aElement, &rv);
  if (NS_FAILED(rv)) return PR_TRUE;

  nsXPIDLCString key;
  server->GetKey(getter_Copies(key));
  if (nsCRT::strcmp(key, entry->serverKey)==0) 
  {
    entry->found = PR_TRUE;
    return PR_FALSE;        // stop when found
  }

  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 894 of file nsMsgAccountManagerDS.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 917 of file nsMsgAccountManagerDS.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the set of all commands defined for a given source.

Here is the caller graph for this function:

Retrieve all of the resources that the data source currently refers to.

Here is the caller graph for this function:

Definition at line 1405 of file nsMsgAccountManagerDS.cpp.

{
  NS_ENSURE_ARG_POINTER(aHostName);
  nsresult rv;
  nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
  if (NS_SUCCEEDED(rv))
    rv = prefBranch->GetCharPref("mailnews.fakeaccount.server", aHostName);

  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIRDFService * nsMsgRDFDataSource::getRDFService ( ) [protected, inherited]

Definition at line 356 of file nsMsgRDFDataSource.cpp.

{
    if (!mRDFService && !m_shuttingDown) {
        nsresult rv;
        mRDFService = do_GetService(kRDFServiceCID, &rv);
        if (NS_FAILED(rv)) return nsnull;
    }
    
    return mRDFService;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1188 of file nsMsgAccountManagerDS.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(aResource, &rv);
  if (NS_SUCCEEDED(rv)) 
  {
    PRBool isServer;
    rv = folder->GetIsServer(&isServer);
    if (NS_SUCCEEDED(rv) && isServer) 
      return folder->GetServer(aResult);
  }
  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIRDFResource nsIRDFDataSource::GetSource ( in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget,
in boolean  aTruthValue 
) [inherited]

Find an RDF resource that points to a given node over the specified arc & truth value.

Returns:
NS_RDF_NO_VALUE if there is no source that leads to the target with the specified property.

Here is the caller graph for this function:

nsISimpleEnumerator nsIRDFDataSource::GetSources ( in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget,
in boolean  aTruthValue 
) [inherited]

Find all RDF resources that point to a given node over the specified arc & truth value.

Returns:
NS_OK unless a catastrophic error occurs. If the method returns NS_OK, you may assume that nsISimpleEnumerator points to a valid (but possibly empty) cursor.

Here is the caller graph for this function:

Definition at line 1225 of file nsMsgAccountManagerDS.cpp.

{
  if (mStringBundle) return NS_OK;

  nsresult rv;

  nsCOMPtr<nsIStringBundleService> strBundleService =
      do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
  if (NS_FAILED(rv)) return rv;

  return strBundleService->CreateBundle("chrome://messenger/locale/prefs.properties",
                                      getter_AddRefs(mStringBundle));
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsMsgAccountManagerDataSource::GetTarget ( nsIRDFResource source,
nsIRDFResource property,
PRBool  aTruthValue,
nsIRDFNode **  _retval 
)

Definition at line 322 of file nsMsgAccountManagerDS.cpp.

{
  nsresult rv;


  rv = NS_RDF_NO_VALUE;

  nsAutoString str;
  if (property == kNC_Name || property == kNC_FolderTreeName ||
      property == kNC_FolderTreeSimpleName) 
  {
    rv = getStringBundle();
    NS_ENSURE_SUCCESS(rv, rv);

    nsXPIDLString pageTitle;
    if (source == kNC_PageTitleServer)
      mStringBundle->GetStringFromName(NS_LITERAL_STRING("prefPanel-server").get(),
                                       getter_Copies(pageTitle));

    else if (source == kNC_PageTitleCopies)
      mStringBundle->GetStringFromName(NS_LITERAL_STRING("prefPanel-copies").get(),
                                       getter_Copies(pageTitle));
    else if (source == kNC_PageTitleOfflineAndDiskSpace)
      mStringBundle->GetStringFromName(NS_LITERAL_STRING("prefPanel-offline-and-diskspace").get(),
                                       getter_Copies(pageTitle));
    else if (source == kNC_PageTitleDiskSpace)
      mStringBundle->GetStringFromName(NS_LITERAL_STRING("prefPanel-diskspace").get(),
                                       getter_Copies(pageTitle));
    else if (source == kNC_PageTitleAddressing)
      mStringBundle->GetStringFromName(NS_LITERAL_STRING("prefPanel-addressing").get(),
                                       getter_Copies(pageTitle));
    else if (source == kNC_PageTitleSMTP)
      mStringBundle->GetStringFromName(NS_LITERAL_STRING("prefPanel-smtp").get(),
                                       getter_Copies(pageTitle));
    else if (source == kNC_PageTitleJunk)
      mStringBundle->GetStringFromName(NS_LITERAL_STRING("prefPanel-junk").get(),
                                       getter_Copies(pageTitle));

    else if (source == kNC_PageTitleFakeAccount) {
      PRBool showFakeAccount;
      nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
      if (NS_SUCCEEDED(rv))
        rv = prefBranch->GetBoolPref(PREF_SHOW_FAKE_ACCOUNT, &showFakeAccount);

      if (showFakeAccount) {
        nsCOMPtr<nsIStringBundleService> strBundleService =
          do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
        if (NS_FAILED(rv)) return rv;
        nsCOMPtr<nsIStringBundle> bundle;
        rv = strBundleService->CreateBundle("chrome://messenger/locale/fakeAccount.properties",
                                             getter_AddRefs(bundle));
        if (NS_SUCCEEDED(rv))
          bundle->GetStringFromName(NS_LITERAL_STRING("prefPanel-fake-account").get(),
                                    getter_Copies(pageTitle));
      }
    }

    else {
      // if it's a server, use the pretty name
      nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(source, &rv);
      if (NS_SUCCEEDED(rv) && folder) {
        PRBool isServer;
        rv = folder->GetIsServer(&isServer);
        if (NS_SUCCEEDED(rv) && isServer)
          rv = folder->GetPrettyName(getter_Copies(pageTitle));
      }
      else {
        // allow for the accountmanager to be dynamically extended.

        nsCOMPtr<nsIStringBundleService> strBundleService =
          do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
        NS_ENSURE_SUCCESS(rv,rv);

        const char *sourceValue;
        rv = source->GetValueConst(&sourceValue);
        NS_ENSURE_SUCCESS(rv,rv);

        // make sure the pointer math we're about to do is safe.
        NS_ENSURE_TRUE(sourceValue && (strlen(sourceValue) > strlen(NC_RDF_PAGETITLE_PREFIX)), NS_ERROR_UNEXPECTED);

        nsCOMPtr<nsIMsgAccountManager> am = do_QueryReferent(mAccountManager, &rv);
        NS_ENSURE_SUCCESS(rv, PR_FALSE);

        // turn NC#PageTitlefoobar into foobar, so we can get the am-foobar.properties bundle
        nsXPIDLCString chromePackageName;
        rv = am->GetChromePackageName((sourceValue + strlen(NC_RDF_PAGETITLE_PREFIX)), getter_Copies(chromePackageName));
        NS_ENSURE_SUCCESS(rv,rv);

        nsCAutoString bundleURL;
        bundleURL = "chrome://";
        bundleURL += chromePackageName;
        bundleURL += "/locale/am-";
        bundleURL += (sourceValue + strlen(NC_RDF_PAGETITLE_PREFIX));
        bundleURL += ".properties";

        nsCOMPtr <nsIStringBundle> bundle;
        rv = strBundleService->CreateBundle(bundleURL.get(), getter_AddRefs(bundle));

        NS_ENSURE_SUCCESS(rv,rv);

        nsAutoString panelTitleName;
        panelTitleName.AssignLiteral("prefPanel-");
        panelTitleName.AppendWithConversion(sourceValue + strlen(NC_RDF_PAGETITLE_PREFIX));
        bundle->GetStringFromName(panelTitleName.get(), getter_Copies(pageTitle));
      }
    }
    str = pageTitle.get();
  }
  else if (property == kNC_PageTag) {
    // do NOT localize these strings. these are the urls of the XUL files
    if (source == kNC_PageTitleServer)
      str.AssignLiteral("am-server.xul");
    else if (source == kNC_PageTitleCopies)
      str.AssignLiteral("am-copies.xul");
    else if ((source == kNC_PageTitleOfflineAndDiskSpace) ||
             (source == kNC_PageTitleDiskSpace))
      str.AssignLiteral("am-offline.xul");
    else if (source == kNC_PageTitleAddressing)
      str.AssignLiteral("am-addressing.xul");
    else if (source == kNC_PageTitleSMTP)
      str.AssignLiteral("am-smtp.xul");
    else if (source == kNC_PageTitleJunk)
      str.AssignLiteral("am-junk.xul");
    else if (source == kNC_PageTitleFakeAccount)
      str.AssignLiteral("am-fakeaccount.xul");
    else {
      nsCOMPtr<nsIMsgFolder> folder = do_QueryInterface(source, &rv);
      if (NS_SUCCEEDED(rv) && folder) {
        /* 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)
          server->GetAccountManagerChrome(str);
        else 
          str.AssignLiteral("am-main.xul");
      }
      else {
        // allow for the accountmanager to be dynamically extended
        const char *sourceValue;
        rv = source->GetValueConst(&sourceValue);
        NS_ENSURE_SUCCESS(rv,rv);

        // make sure the pointer math we're about to do is safe.
        NS_ENSURE_TRUE(sourceValue && (strlen(sourceValue) > strlen(NC_RDF_PAGETITLE_PREFIX)), NS_ERROR_UNEXPECTED);

        // turn NC#PageTitlefoobar into foobar, so we can get the am-foobar.xul file
        str.AssignLiteral("am-");
        str.AppendWithConversion((sourceValue + strlen(NC_RDF_PAGETITLE_PREFIX)));
        str.AppendLiteral(".xul");
      }
    }
  }

  // handle sorting of servers
  else if ((property == kNC_NameSort) ||
           (property == kNC_FolderTreeNameSort)) {

    // order for the folder pane
    // and for the account manager tree is:
    //
    // - default mail account
    // - <other mail accounts>
    // - "Local Folders" account
    // - news accounts
    // - smtp settings (note, this is only in account manager tree)
    // - fake account

    // make sure we're handling a root folder that is a server
    nsCOMPtr<nsIMsgIncomingServer> server;
    rv = getServerForFolderNode(source, getter_AddRefs(server));

    if (NS_SUCCEEDED(rv) && server) {
      PRInt32 accountNum;
      nsCOMPtr<nsIMsgAccountManager> am = do_QueryReferent(mAccountManager);

      if (isDefaultServer(server))
        str.AssignLiteral("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);
      }
    }
    else {
      const char *sourceValue;
      rv = source->GetValueConst(&sourceValue);
      NS_ENSURE_SUCCESS(rv, NS_RDF_NO_VALUE);

      // if this is a page (which we determine by the prefix of the URI)
      // we want to generate a sort value
      // so that we can sort the categories in the account manager tree
      // (or the folder pane)
      //
      // otherwise, return NS_RDF_NO_VALUE
      // so that the folder data source will take care of it.
      if (sourceValue && (strncmp(sourceValue, NC_RDF_PAGETITLE_PREFIX, strlen(NC_RDF_PAGETITLE_PREFIX)) == 0)) {
        if (source == kNC_PageTitleSMTP)
          str.AssignLiteral("4000");
        else if (source == kNC_PageTitleFakeAccount)
          str.AssignLiteral("5000");
        else if (source == kNC_PageTitleServer)
          str.AssignLiteral("1");
        else if (source == kNC_PageTitleCopies)
          str.AssignLiteral("2");
        else if (source == kNC_PageTitleAddressing)
          str.AssignLiteral("3");
        else if (source == kNC_PageTitleOfflineAndDiskSpace)
          str.AssignLiteral("4");
        else if (source == kNC_PageTitleDiskSpace)
          str.AssignLiteral("4");
        else if (source == kNC_PageTitleJunk)
          str.AssignLiteral("5");
        else {
          // allow for the accountmanager to be dynamically extended
          // all the other pages come after the standard ones
          // server, copies, addressing, disk space (or offline & disk space)
          str.AssignWithConversion(sourceValue);
        }
      }
      else {
        return NS_RDF_NO_VALUE;
      }
    }
  }

  // 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.AssignLiteral("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;

    if (isDefaultServer(thisServer))
      str.AssignLiteral("true");
  }

  else if (property == kNC_SupportsFilters) {
    nsCOMPtr<nsIMsgIncomingServer> server;
    rv = getServerForFolderNode(source, getter_AddRefs(server));
    if (NS_FAILED(rv) || !server) return NS_RDF_NO_VALUE;

    if (supportsFilters(server))
      str.AssignLiteral("true");
  }
  else if (property == kNC_CanGetMessages) {
    nsCOMPtr<nsIMsgIncomingServer> server;
    rv = getServerForFolderNode(source, getter_AddRefs(server));
    if (NS_FAILED(rv) || !server) return NS_RDF_NO_VALUE;

    if (canGetMessages(server))
      str.AssignLiteral("true");
  }
  else if (property == kNC_CanGetIncomingMessages) {
    nsCOMPtr<nsIMsgIncomingServer> server;
    rv = getServerForFolderNode(source, getter_AddRefs(server));
    if (NS_FAILED(rv) || !server) return NS_RDF_NO_VALUE;

    if (canGetIncomingMessages(server))
      str.AssignLiteral("true");
  }
  else if (property == kNC_PageTitleFakeAccount) {
    if (source == kNC_PageTitleFakeAccount)
      str.AssignLiteral("true");
  }
  if (!str.IsEmpty())
    rv = createNode(str.get(), 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;
}

Here is the call graph for this function:

nsIRDFNode nsIRDFDataSource::GetTarget ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in boolean  aTruthValue 
) [inherited]

Find a child of that is related to the source by the given arc arc and truth value.

Returns:
NS_RDF_NO_VALUE if there is no target accessable from the source via the specified property.

Here is the caller graph for this function:

Definition at line 628 of file nsMsgAccountManagerDS.cpp.

{
  nsresult rv = NS_RDF_NO_VALUE;

  // create array and enumerator
  // even if we're not handling this we need to return something empty?
  nsCOMPtr<nsISupportsArray> nodes;
  rv = NS_NewISupportsArray(getter_AddRefs(nodes));
  if (NS_FAILED(rv)) return rv;

  rv = NS_NewArrayEnumerator(_retval, nodes);
  if (NS_FAILED(rv)) return rv;

#ifdef DEBUG_amds
  nsXPIDLCString source_value;
  rv = source->GetValue(getter_Copies(source_value));

  nsXPIDLCString property_arc;
  rv = property->GetValue(getter_Copies(property_arc));
  if (NS_FAILED(rv)) return rv;

  printf("GetTargets(%s with arc %s...)\n",
         (const char*)source_value,
         (const char*)property_arc);
#endif

  if (source == kNC_AccountRoot)
    rv = createRootResources(property, nodes);
  else if (property == kNC_Settings)
    rv = createSettingsResources(source, nodes);

  if (NS_FAILED(rv))
    return NS_RDF_NO_VALUE;

  return NS_OK;
}

Here is the call graph for this function:

nsISimpleEnumerator nsIRDFDataSource::GetTargets ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in boolean  aTruthValue 
) [inherited]

Find all children of that are related to the source by the given arc arc and truth value.

Returns:
NS_OK unless a catastrophic error occurs. If the method returns NS_OK, you may assume that nsISimpleEnumerator points to a valid (but possibly empty) cursor.

Here is the caller graph for this function:

nsresult nsMsgRDFDataSource::GetTransactionManager ( nsISupportsArray sources,
nsITransactionManager **  aTransactionManager 
) [protected, inherited]

Definition at line 439 of file nsMsgRDFDataSource.cpp.

{
  if(!aTransactionManager)
    return NS_ERROR_NULL_POINTER;
  
  *aTransactionManager = nsnull;
  nsresult rv = NS_OK;
  
  nsCOMPtr<nsITransactionManager> transactionManager;
  
  PRUint32 cnt;
  
  rv = aSources->Count(&cnt);
  if (NS_FAILED(rv)) return rv;
  
  if (cnt > 0)
  {
    transactionManager = do_QueryElementAt(aSources, 0, &rv);
    if (NS_SUCCEEDED(rv) && transactionManager)
    {
      aSources->RemoveElementAt(0);
      NS_IF_ADDREF(*aTransactionManager = transactionManager);
    }
  }
  
  return NS_OK;      
}

Here is the call graph for this function:

boolean nsIRDFDataSource::hasArcIn ( in nsIRDFNode  aNode,
in nsIRDFResource  aArc 
) [inherited]

Returns true if the specified node is pointed to by the specified arc.

Equivalent to enumerating ArcLabelsIn and comparing for the specified arc.

Definition at line 943 of file nsMsgAccountManagerDS.cpp.

{
  nsresult rv = NS_OK;
  if (aArc == kNC_Settings) {
    // based on createSettingsResources()
    // we only have settings for local folders and servers with identities
    nsCOMPtr<nsIMsgIncomingServer> server;
    rv = getServerForFolderNode(source, getter_AddRefs(server));
    if (server) {
      // Check the offline capability before adding arc
      PRInt32 offlineSupportLevel = 0;
      (void) server->GetOfflineSupportLevel(&offlineSupportLevel);
      if (offlineSupportLevel >= OFFLINE_SUPPORT_LEVEL_REGULAR) {
        *result = PR_TRUE;
        return NS_OK;
      }

      PRBool supportsDiskSpace;
      (void) server->GetSupportsDiskSpace(&supportsDiskSpace);
      if (supportsDiskSpace) {
        *result = PR_TRUE;
        return NS_OK;
      }
      return serverHasIdentities(server, result);
    }
  }

  *result = PR_FALSE;
  return NS_OK;
}

Here is the call graph for this function:

Returns true if the specified node has the specified outward arc.

Equivalent to enumerating ArcLabelsOut and comparing for the specified arc.

NS_IMETHODIMP nsMsgAccountManagerDataSource::HasAssertion ( nsIRDFResource aSource,
nsIRDFResource aProperty,
nsIRDFNode aTarget,
PRBool  aTruthValue,
PRBool _retval 
)

Definition at line 1000 of file nsMsgAccountManagerDS.cpp.

{
  nsresult rv=NS_ERROR_FAILURE;

  //
  // msgaccounts:/ properties
  //
  if (aSource == kNC_AccountRoot) {
    rv = HasAssertionAccountRoot(aProperty, aTarget, aTruthValue, _retval);
  }
  //
  // server properties
  //   try to convert the resource to a folder, and then only
  //   answer if it's a server.. any failure falls through to the default case
  //
  // short-circuit on property, so objects like filters, etc, don't get queried
  else if (aProperty == kNC_IsDefaultServer || aProperty == kNC_CanGetMessages ||
           aProperty == kNC_CanGetIncomingMessages || aProperty == kNC_SupportsFilters) {
    nsCOMPtr<nsIMsgIncomingServer> server;
    rv = getServerForFolderNode(aSource, getter_AddRefs(server));
    if (NS_SUCCEEDED(rv) && server)
      rv = HasAssertionServer(server, aProperty, aTarget,
                              aTruthValue, _retval);
  }

  // any failures above fallthrough to the parent class
  if (NS_FAILED(rv))
    return nsMsgRDFDataSource::HasAssertion(aSource, aProperty,
                                            aTarget, aTruthValue, _retval);
  return NS_OK;
}

Here is the call graph for this function:

boolean nsIRDFDataSource::HasAssertion ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget,
in boolean  aTruthValue 
) [inherited]

Query whether an assertion exists in this graph.

Here is the caller graph for this function:

nsresult nsMsgAccountManagerDataSource::HasAssertionAccountRoot ( nsIRDFResource aProperty,
nsIRDFNode aTarget,
PRBool  aTruthValue,
PRBool _retval 
) [protected]

Definition at line 1136 of file nsMsgAccountManagerDS.cpp.

{

  nsresult rv;

  // set up default
  *_retval = PR_FALSE;

  // for child and settings arcs, just make sure it's a valid server:
  if (isContainment(aProperty)) {

    nsCOMPtr<nsIMsgIncomingServer> server;
    rv = getServerForFolderNode(aTarget, getter_AddRefs(server));
    if (NS_FAILED(rv) || !server) return rv;

    nsXPIDLCString serverKey;
    server->GetKey(getter_Copies(serverKey));

    nsCOMPtr<nsIMsgAccountManager> am = do_QueryReferent(mAccountManager, &rv);
    if (NS_FAILED(rv)) return rv;

    nsCOMPtr<nsISupportsArray> serverArray;
    rv = am->GetAllServers(getter_AddRefs(serverArray));
    if (NS_FAILED(rv)) return rv;

    findServerByKeyEntry entry;
    entry.serverKey = serverKey;
    entry.found = PR_FALSE;

    serverArray->EnumerateForwards(findServerByKey, &entry);
    (*_retval) = entry.found;

  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgAccountManagerDataSource::HasAssertionServer ( nsIMsgIncomingServer aServer,
nsIRDFResource aProperty,
nsIRDFNode aTarget,
PRBool  aTruthValue,
PRBool _retval 
) [protected]

Definition at line 1039 of file nsMsgAccountManagerDS.cpp.

{
  if (aProperty == kNC_IsDefaultServer)
    *_retval = (aTarget == kTrueLiteral) ? isDefaultServer(aServer) : !isDefaultServer(aServer);
  else if (aProperty == kNC_SupportsFilters)
    *_retval = (aTarget == kTrueLiteral) ? supportsFilters(aServer) : !supportsFilters(aServer);
  else if (aProperty == kNC_CanGetMessages)
   *_retval = (aTarget == kTrueLiteral) ? canGetMessages(aServer) : !canGetMessages(aServer);
  else if (aProperty == kNC_CanGetIncomingMessages)
    *_retval = (aTarget == kTrueLiteral) ? canGetIncomingMessages(aServer) : !canGetIncomingMessages(aServer);
  else
    *_retval = PR_FALSE;
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from nsMsgRDFDataSource.

Definition at line 279 of file nsMsgAccountManagerDS.cpp.

{
  nsresult rv;

  rv = nsMsgRDFDataSource::Init();
  if (NS_FAILED(rv)) return rv;

  nsCOMPtr<nsIMsgAccountManager> am;

  // get a weak ref to the account manager
  if (!mAccountManager) 
  {
    am = do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
    mAccountManager = do_GetWeakReference(am);
  }
  else
    am = do_QueryReferent(mAccountManager);

  if (am) 
  {
    am->AddIncomingServerListener(this);
    am->AddRootFolderListener(this);
  }


  return NS_OK;
}

Here is the call graph for this function:

boolean nsIRDFDataSource::IsCommandEnabled ( in nsISupportsArray  aSources,
in nsIRDFResource  aCommand,
in nsISupportsArray  aArguments 
) [inherited]

Returns whether a given command is enabled for a set of sources.

Here is the caller graph for this function:

Definition at line 1177 of file nsMsgAccountManagerDS.cpp.

{

  if (aProperty == kNC_Child ||
      aProperty == kNC_Settings)
    return PR_TRUE;
  return PR_FALSE;
}

Here is the caller graph for this function:

Definition at line 1059 of file nsMsgAccountManagerDS.cpp.

{
  nsresult rv;
  if (!aServer) return PR_FALSE;

  nsCOMPtr<nsIMsgAccountManager> am = do_QueryReferent(mAccountManager, &rv);
  NS_ENSURE_SUCCESS(rv, PR_FALSE);

  nsCOMPtr<nsIMsgAccount> defaultAccount;
  rv = am->GetDefaultAccount(getter_AddRefs(defaultAccount));
  NS_ENSURE_SUCCESS(rv, PR_FALSE);
  if (!defaultAccount) return PR_FALSE;

  // in some weird case that there is no default and they asked
  // for the default
  nsCOMPtr<nsIMsgIncomingServer> defaultServer;
  rv = defaultAccount->GetIncomingServer(getter_AddRefs(defaultServer));
  NS_ENSURE_SUCCESS(rv, PR_FALSE);
  if (!defaultServer) return PR_FALSE;

  PRBool isEqual;
  rv = defaultServer->Equals(aServer, &isEqual);
  NS_ENSURE_SUCCESS(rv, PR_FALSE);

  return isEqual;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1347 of file nsMsgAccountManagerDS.cpp.

{
  nsresult rv;
  nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));

  PRBool showFakeAccount = PR_FALSE;
  if (NS_SUCCEEDED(rv))
    rv = prefBranch->GetBoolPref(PREF_SHOW_FAKE_ACCOUNT, &showFakeAccount);

  if (!showFakeAccount)
    return PR_FALSE;

  nsXPIDLCString fakeHostName;
  rv = GetFakeAccountHostName(getter_Copies(fakeHostName));
  NS_ENSURE_SUCCESS(rv,rv);

  nsCOMPtr<nsIMsgAccountManager> accountManager = do_QueryReferent(mAccountManager);
  if (!accountManager)
    return NS_ERROR_FAILURE;

  nsCOMPtr<nsIMsgIncomingServer> server;

  if (!fakeHostName.IsEmpty()) {
    rv = accountManager->FindServer("",fakeHostName.get(),"", getter_AddRefs(server));
    if (NS_SUCCEEDED(rv) && server)
      return PR_FALSE;
  }

  return PR_TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1379 of file nsMsgAccountManagerDS.cpp.

{
  NS_ENSURE_ARG_POINTER(aServer);
  NS_ENSURE_ARG_POINTER(aResult);

  nsresult rv;
  nsXPIDLCString fakeAccountHostName;
  rv = GetFakeAccountHostName(getter_Copies(fakeAccountHostName));
  NS_ENSURE_SUCCESS(rv,rv);

  if (fakeAccountHostName.IsEmpty()) 
  {
    *aResult = PR_FALSE;
    return NS_OK;
  }

  nsXPIDLCString hostname;
  rv = aServer->GetHostName(getter_Copies(hostname));
  NS_ENSURE_SUCCESS(rv,rv);

  *aResult = (strcmp(hostname.get(), fakeAccountHostName.get()) == 0);
  return NS_OK;
}

Here is the call graph for this function:

void nsIRDFDataSource::Move ( in nsIRDFResource  aOldSource,
in nsIRDFResource  aNewSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget 
) [inherited]

'Move' an assertion from

[aOldSource]--[aProperty]-->[aTarget]

to

[aNewSource]--[aProperty]-->[aTarget]

Here is the caller graph for this function:

nsresult nsMsgRDFDataSource::NotifyObservers ( nsIRDFResource subject,
nsIRDFResource property,
nsIRDFNode newObject,
nsIRDFNode oldObject,
PRBool  assert,
PRBool  change 
) [protected, inherited]

Definition at line 378 of file nsMsgRDFDataSource.cpp.

{
    NS_ASSERTION(!(change && assert),
                 "Can't change and assert at the same time!\n");
    
       if(mObservers)
       {
              nsMsgRDFNotification note = { this, subject, property, newObject, oldObject };
              if(change)
                     mObservers->EnumerateForwards(changeEnumFunc, &note);
              else if (assert)
                     mObservers->EnumerateForwards(assertEnumFunc, &note);
              else
                     mObservers->EnumerateForwards(unassertEnumFunc, &note);
  }
       return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsMsgRDFDataSource::NotifyPropertyChanged ( nsIRDFResource resource,
nsIRDFResource propertyResource,
nsIRDFNode newNode,
nsIRDFNode oldNode = nsnull 
) [protected, virtual, inherited]

Reimplemented in nsMsgRecentFoldersDataSource, and nsMsgUnreadFoldersDataSource.

Definition at line 367 of file nsMsgRDFDataSource.cpp.

{

  NotifyObservers(resource, propertyResource, newNode, oldNode, PR_FALSE, PR_TRUE);
  return NS_OK;

}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIObserver::observe ( in nsISupports  aSubject,
in string  aTopic,
in wstring  aData 
) [inherited]

Observe will be called when there is a notification for the topic |aTopic|.

This assumes that the object implementing this interface has been registered with an observer service such as the nsIObserverService.

If you expect multiple topics/subjects, the impl is responsible for filtering.

You should not modify, add, remove, or enumerate notifications in the implemention of observe.

Parameters:
aSubject: Notification specific interface pointer.
aTopic: The notification topic or subject.
aData: Notification specific wide string. subject event.
void nsIFolderListener::OnItemAdded ( in nsIRDFResource  parentItem,
in nsISupports  item 
) [inherited]

Here is the caller graph for this function:

void nsIFolderListener::OnItemBoolPropertyChanged ( in nsIRDFResource  item,
in nsIAtom  property,
in boolean  oldValue,
in boolean  newValue 
) [inherited]

Here is the caller graph for this function:

void nsIFolderListener::OnItemEvent ( in nsIMsgFolder  item,
in nsIAtom  event 
) [inherited]

Here is the caller graph for this function:

void nsIFolderListener::OnItemIntPropertyChanged ( in nsIRDFResource  item,
in nsIAtom  property,
in long  oldValue,
in long  newValue 
) [inherited]

Here is the caller graph for this function:

void nsIFolderListener::OnItemPropertyChanged ( in nsIRDFResource  item,
in nsIAtom  property,
in string  oldValue,
in string  newValue 
) [inherited]
void nsIFolderListener::OnItemPropertyFlagChanged ( in nsIMsgDBHdr  item,
in nsIAtom  property,
in unsigned long  oldFlag,
in unsigned long  newFlag 
) [inherited]

Here is the caller graph for this function:

void nsIFolderListener::OnItemRemoved ( in nsIRDFResource  parentItem,
in nsISupports  item 
) [inherited]
void nsIFolderListener::OnItemUnicharPropertyChanged ( in nsIRDFResource  item,
in nsIAtom  property,
in wstring  oldValue,
in wstring  newValue 
) [inherited]

Remove an observer from this data source.

Here is the caller graph for this function:

Definition at line 840 of file nsMsgAccountManagerDS.cpp.

{
  nsresult rv;
  *aResult = PR_FALSE;

  nsCOMPtr<nsIMsgAccountManager> am = do_QueryReferent(mAccountManager, &rv);

  if (NS_FAILED(rv)) return rv;

  nsCOMPtr<nsISupportsArray> identities;
  rv = am->GetIdentitiesForServer(aServer, getter_AddRefs(identities));

  // no identities just means no arcs
  if (NS_FAILED(rv)) return NS_OK;

  PRUint32 count;
  rv = identities->Count(&count);
  if (NS_FAILED(rv)) return NS_OK;

  if (count >0)
    *aResult = PR_TRUE;
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1088 of file nsMsgAccountManagerDS.cpp.

{
  PRBool supportsFilters;
  nsresult rv = aServer->GetCanHaveFilters(&supportsFilters);
  NS_ENSURE_SUCCESS(rv, PR_FALSE);

  return supportsFilters;
}

Here is the caller graph for this function:

void nsIRDFDataSource::Unassert ( in nsIRDFResource  aSource,
in nsIRDFResource  aProperty,
in nsIRDFNode  aTarget 
) [inherited]

Remove an assertion from the graph.

Here is the caller graph for this function:

PRBool nsMsgRDFDataSource::unassertEnumFunc ( nsISupports *  aElement,
void aData 
) [static, protected, inherited]

Definition at line 414 of file nsMsgRDFDataSource.cpp.

{
  nsMsgRDFNotification* note = (nsMsgRDFNotification *)aData;
  nsIRDFObserver* observer = (nsIRDFObserver *)aElement;

  observer->OnUnassert(note->datasource,
                       note->subject,
                       note->property,
                       note->newObject);
  return PR_TRUE;
}

Here is the caller graph for this function:


Member Data Documentation

Definition at line 49 of file nsIFolderListener.idl.

Definition at line 69 of file nsIFolderListener.idl.

Definition at line 163 of file nsMsgAccountManagerDS.h.

Definition at line 63 of file nsIFolderListener.idl.

Definition at line 161 of file nsMsgAccountManagerDS.h.

Definition at line 143 of file nsMsgAccountManagerDS.h.

Definition at line 141 of file nsMsgAccountManagerDS.h.

Definition at line 138 of file nsMsgAccountManagerDS.h.

Definition at line 137 of file nsMsgAccountManagerDS.h.

Definition at line 140 of file nsMsgAccountManagerDS.h.

Definition at line 130 of file nsMsgAccountManagerDS.h.

Definition at line 133 of file nsMsgAccountManagerDS.h.

Definition at line 131 of file nsMsgAccountManagerDS.h.

Definition at line 145 of file nsMsgAccountManagerDS.h.

Definition at line 135 of file nsMsgAccountManagerDS.h.

Definition at line 147 of file nsMsgAccountManagerDS.h.

Definition at line 129 of file nsMsgAccountManagerDS.h.

Definition at line 132 of file nsMsgAccountManagerDS.h.

Definition at line 134 of file nsMsgAccountManagerDS.h.

Definition at line 154 of file nsMsgAccountManagerDS.h.

Definition at line 151 of file nsMsgAccountManagerDS.h.

Definition at line 153 of file nsMsgAccountManagerDS.h.

Definition at line 157 of file nsMsgAccountManagerDS.h.

Definition at line 156 of file nsMsgAccountManagerDS.h.

Definition at line 149 of file nsMsgAccountManagerDS.h.

Definition at line 152 of file nsMsgAccountManagerDS.h.

Definition at line 150 of file nsMsgAccountManagerDS.h.

Definition at line 155 of file nsMsgAccountManagerDS.h.

Definition at line 144 of file nsMsgAccountManagerDS.h.

Definition at line 146 of file nsMsgAccountManagerDS.h.

Definition at line 136 of file nsMsgAccountManagerDS.h.

Definition at line 159 of file nsMsgAccountManagerDS.h.

Definition at line 88 of file nsMsgRDFDataSource.h.

Definition at line 179 of file nsMsgAccountManagerDS.h.

Definition at line 181 of file nsMsgAccountManagerDS.h.

Definition at line 180 of file nsMsgAccountManagerDS.h.

PRBool nsMsgRDFDataSource::mInitialized [protected, inherited]

Definition at line 89 of file nsMsgRDFDataSource.h.

Definition at line 183 of file nsMsgAccountManagerDS.h.

Definition at line 86 of file nsMsgRDFDataSource.h.

Definition at line 57 of file nsIFolderListener.idl.

Definition at line 81 of file nsIFolderListener.idl.

Definition at line 53 of file nsIFolderListener.idl.

Definition at line 75 of file nsIFolderListener.idl.

readonly attribute string nsIRDFDataSource::URI [inherited]

The "URI" of the data source.

This used by the RDF service's |GetDataSource()| method to cache datasources.

Definition at line 56 of file nsIRDFDataSource.idl.

Definition at line 47 of file nsIMsgRDFDataSource.idl.


Event Documentation

Definition at line 90 of file nsIFolderListener.idl.

Definition at line 87 of file nsIFolderListener.idl.


The documentation for this class was generated from the following files: