示例#1
0
nsresult nsMailtoUrl::ParseUrl()
{
    // we can get the path from the simple url.....
    nsCString escapedPath;
    m_baseURL->GetPath(escapedPath);

    int32_t startOfSearchPart = escapedPath.FindChar('?');
    if (startOfSearchPart >= 0)
    {
        // now parse out the search field...
        nsAutoCString searchPart(Substring(escapedPath, startOfSearchPart));

        if (!searchPart.IsEmpty())
        {
            // now we need to strip off the search part from the
            // to part....
            escapedPath.SetLength(startOfSearchPart);
            MsgUnescapeString(escapedPath, 0, m_toPart);
            ParseMailtoUrl(searchPart.BeginWriting());
        }
    }
    else if (!escapedPath.IsEmpty())
    {
        MsgUnescapeString(escapedPath, 0, m_toPart);
    }

    return NS_OK;
}
示例#2
0
nsresult nsMailtoUrl::ParseUrl()
{
	nsresult rv = NS_OK;

  // we can get the path from the simple url.....
  nsCAutoString aPath;
  m_baseURL->GetPath(aPath);
  m_toPart.Assign(aPath);

  PRInt32 startOfSearchPart = m_toPart.FindChar('?');
  if (startOfSearchPart >= 0)
  {
    // now parse out the search field...
    nsCAutoString searchPart;
    PRUint32 numExtraChars = m_toPart.Right(searchPart,
                                            m_toPart.Length() -
                                            startOfSearchPart);
    if (!searchPart.IsEmpty())
    {
      // now we need to strip off the search part from the
      // to part....
      m_toPart.Cut(startOfSearchPart, numExtraChars);
      ParseMailtoUrl(searchPart.BeginWriting());
    }
	}
  else if (!m_toPart.IsEmpty())
  {
    nsUnescape(m_toPart.BeginWriting());
  }

  return rv;
}