Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Static Public Member Functions | Public Attributes
nsMsgResultElement Class Reference

#include <nsMsgResultElement.h>

Collaboration diagram for nsMsgResultElement:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsMsgResultElement (nsIMsgSearchAdapter *)
virtual ~nsMsgResultElement ()
nsresult GetValue (nsMsgSearchAttribValue, nsMsgSearchValue **) const
nsresult AddValue (nsIMsgSearchValue *)
nsresult AddValue (nsMsgSearchValue *)
nsresult GetPrettyName (nsMsgSearchValue **)
nsresult GetValueRef (nsMsgSearchAttribValue, nsIMsgSearchValue **) const
nsresult Open (void *window)

Static Public Member Functions

static nsresult AssignValues (nsIMsgSearchValue *src, nsMsgSearchValue *dst)
static int CompareByFolderInfoPtrs (const void *, const void *)
static int Compare (const void *, const void *)
static nsresult DestroyValue (nsIMsgSearchValue *value)

Public Attributes

nsCOMPtr< nsISupportsArraym_valueList
nsIMsgSearchAdapterm_adapter

Detailed Description

Definition at line 52 of file nsMsgResultElement.h.


Constructor & Destructor Documentation

Definition at line 1611 of file nsMsgSearchTerm.cpp.

Here is the call graph for this function:

Definition at line 1618 of file nsMsgSearchTerm.cpp.

{
}

Member Function Documentation

Definition at line 1623 of file nsMsgSearchTerm.cpp.

{ 
  m_valueList->AppendElement (value); 
  return NS_OK;
}

Here is the caller graph for this function:

Definition at line 1629 of file nsMsgSearchTerm.cpp.

{
  nsMsgSearchValueImpl* valueImpl = new nsMsgSearchValueImpl(value);
  delete value;               // we keep the nsIMsgSearchValue, not
                              // the nsMsgSearchValue
  return AddValue(valueImpl);
}

Here is the call graph for this function:

Definition at line 1638 of file nsMsgSearchTerm.cpp.

{
  NS_ENSURE_ARG_POINTER(src);
  NS_ENSURE_ARG_POINTER(dst);
  
  // Yes, this could be an operator overload, but nsMsgSearchValue is totally public, so I'd
  // have to define a derived class with nothing by operator=, and that seems like a bit much
  nsresult err = NS_OK;
  src->GetAttrib(&dst->attribute);
  switch (dst->attribute)
  {
  case nsMsgSearchAttrib::Priority:
    err = src->GetPriority(&dst->u.priority);
    break;
  case nsMsgSearchAttrib::Date:
    err = src->GetDate(&dst->u.date);
    break;
  case nsMsgSearchAttrib::HasAttachmentStatus:
  case nsMsgSearchAttrib::MsgStatus:
    err = src->GetStatus(&dst->u.msgStatus);
    break;
  case nsMsgSearchAttrib::MessageKey:
    err = src->GetMsgKey(&dst->u.key);
    break;
  case nsMsgSearchAttrib::AgeInDays:
    err = src->GetAge(&dst->u.age);
    break;
  case nsMsgSearchAttrib::Label:
    err = src->GetLabel(&dst->u.label);
    break;
  case nsMsgSearchAttrib::JunkStatus:
    err = src->GetJunkStatus(&dst->u.junkStatus);
    break;
  case nsMsgSearchAttrib::Size:
    err = src->GetSize(&dst->u.size);
    break;
  default:
    if (dst->attribute < nsMsgSearchAttrib::kNumMsgSearchAttributes)
    {
      NS_ASSERTION(IS_STRING_ATTRIBUTE(dst->attribute), "assigning non-string result");
      nsXPIDLString unicodeString;
      err = src->GetStr(getter_Copies(unicodeString));
      dst->string = ToNewUTF8String(unicodeString);
    }
    else
      err = NS_ERROR_INVALID_ARG;
  }
  return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int nsMsgResultElement::Compare ( const void e1,
const void e2 
) [static]

Definition at line 1826 of file nsMsgSearchTerm.cpp.

{
  int ret = 0;
    return ret;
}

Definition at line 1804 of file nsMsgSearchTerm.cpp.

{
#ifdef HAVE_SEARCH_PORT
  nsMsgResultElement * re1 = *(nsMsgResultElement **) e1;
  nsMsgResultElement * re2 = *(nsMsgResultElement **) e2;
  
  // get the src folder for each one
  
  const nsMsgSearchValue * v1 = re1->GetValueRef(attribFolderInfo);
  const nsMsgSearchValue * v2 = re2->GetValueRef(attribFolderInfo);
  
  if (!v1 || !v2)
    return 0;
  
  return (v1->u.folder - v2->u.folder);
#else
  return -1;
#endif // HAVE_SEARCH_PORT
}

Here is the call graph for this function:

Definition at line 1765 of file nsMsgSearchTerm.cpp.

{
  nsresult err = GetValue (nsMsgSearchAttrib::Location, value);
#ifdef HAVE_SEARCH_PORT
  if (NS_OK == err)
  {
    nsMsgFolderInfo *folder = m_adapter->m_scope->m_folder;
    nsMsgNewsHost *host = NULL;
    if (folder)
    {
      // Find the news host because only the host knows whether pretty
      // names are supported. 
      if (FOLDER_CONTAINERONLY == folder->GetType())
        host = ((nsMsgNewsFolderInfoContainer*) folder)->GetHost();
      else if (folder->IsNews())
        host = folder->GetNewsFolderInfo()->GetHost();
      
      // Ask the host whether it knows pretty names. It isn't strictly
      // necessary to avoid calling folder->GetPrettiestName() since it
      // does the right thing. But we do have to find the folder from the host.
      if (host && host->QueryExtension ("LISTPNAMES"))
      {
        folder = host->FindGroup ((*value)->u.string);
        if (folder)
        {
          char *tmp = nsCRT::strdup (folder->GetPrettiestName());
          if (tmp)
          {
            XP_FREE ((*value)->u.string);
            (*value)->u.utf8SstringZ = tmp;
          }
        }
      }
    }
  }
#endif // HAVE_SEARCH_PORT
  return err;
}

Here is the call graph for this function:

Definition at line 1689 of file nsMsgSearchTerm.cpp.

{
  nsresult err = NS_OK;
  nsCOMPtr<nsIMsgSearchValue> value;
  *outValue = NULL;
  
  PRUint32 count;
  m_valueList->Count(&count);
  for (PRUint32 i = 0; i < count && err != NS_OK; i++)
  {
    m_valueList->QueryElementAt(i, NS_GET_IID(nsIMsgSearchValue),
      (void **)getter_AddRefs(value));
    
    nsMsgSearchAttribValue valueAttribute;
    value->GetAttrib(&valueAttribute);
    if (attrib == valueAttribute)
    {
      *outValue = new nsMsgSearchValue;
      if (*outValue)
      {
        err = AssignValues (value, *outValue);
        err = NS_OK;
      }
      else
        err = NS_ERROR_OUT_OF_MEMORY;
    }
  }
#ifdef HAVE_SEARCH_PORT
  // No need to store the folderInfo separately; we can always get it if/when
  // we need it. This code is to support "view thread context" in the search dialog
  if (SearchError_ScopeAgreement == err && attrib == nsMsgSearchAttrib::FolderInfo)
  {
    nsMsgFolderInfo *targetFolder = m_adapter->FindTargetFolder (this);
    if (targetFolder)
    {
      *outValue = new nsMsgSearchValue;
      if (*outValue)
      {
        (*outValue)->u.folder = targetFolder;
        (*outValue)->attribute = nsMsgSearchAttrib::FolderInfo;
        err = NS_OK;
      }
    }
  }
#endif
  return err;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1740 of file nsMsgSearchTerm.cpp.

{
  nsCOMPtr<nsIMsgSearchValue> value;
  PRUint32 count;
  m_valueList->Count(&count);
  nsresult rv;
  for (PRUint32 i = 0; i < count; i++)
  {
    rv = m_valueList->QueryElementAt(i, NS_GET_IID(nsIMsgSearchValue),
      getter_AddRefs(value));
    NS_ASSERTION(NS_SUCCEEDED(rv), "bad element of array");
    if (NS_FAILED(rv)) continue;
    
    nsMsgSearchAttribValue valueAttribute;
    value->GetAttrib(&valueAttribute);
    if (attrib == valueAttribute) {
      *aResult = value;
      NS_ADDREF(*aResult);
    }
  }
  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1856 of file nsMsgSearchTerm.cpp.

{
#ifdef HAVE_SEARCH_PORT
  // ###phil this is a little ugly, but I'm not inclined to invest more in it
  // until the libnet rework is done and I know what kind of context we'll end up with
  
  if (window)
  {
    if (m_adapter->m_scope->m_attribute != nsMsgSearchScopeLdapDirectory)
    {
      msgPane = (MSG_MessagePane *) window; 
      PR_ASSERT (MSG_MESSAGEPANE == msgPane->GetPaneType());
      return m_adapter->OpenResultElement (msgPane, this);
    }
    else
    {
      context = (MWContext*) window;
      PR_ASSERT (MWContextBrowser == context->type);
      msg_SearchLdap *thisAdapter = (msg_SearchLdap*) m_adapter;
      return thisAdapter->OpenResultElement (context, this);
    }
  }
#endif
  return NS_ERROR_NULL_POINTER;
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 76 of file nsMsgResultElement.h.

Definition at line 75 of file nsMsgResultElement.h.


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