Esempio n. 1
0
/* void addTag (in wstring tag, in long color); */
NS_IMETHODIMP nsMsgTagService::AddTag(const nsAString  &tag,
                                      const nsACString &color,
                                      const nsACString &ordinal)
{
  // figure out key from tag. Apply transformation stripping out
  // illegal characters like <SP> and then convert to imap mod utf7.
  // Then, check if we have a tag with that key yet, and if so,
  // make it unique by appending A, AA, etc.
  // Should we use an iterator?
  nsAutoString transformedTag(tag);
  MsgReplaceChar(transformedTag, " ()/{%*<>\\\"", '_');
  nsCAutoString key;
  CopyUTF16toMUTF7(transformedTag, key);
  // We have an imap server that converts keys to upper case so we're going
  // to normalize all keys to lower case (upper case looks ugly in prefs.js)
  ToLowerCase(key);
  nsCAutoString prefName(key);
  while (true)
  {
    nsAutoString tagValue;
    nsresult rv = GetTagForKey(prefName, tagValue);
    if (NS_FAILED(rv) || tagValue.IsEmpty() || tagValue.Equals(tag))
      return AddTagForKey(prefName, tag, color, ordinal);
    prefName.Append('A');
  }
  NS_ASSERTION(false, "can't get here");
  return NS_ERROR_FAILURE;
}
Esempio n. 2
0
void nsEscapeNativePath(nsCString& nativePath)
{
#if defined(XP_WIN) || defined(XP_OS2)
  nativePath.Insert('/', 0);
  MsgReplaceChar(nativePath, '\\', '/');
#endif
}
void nsOutlookMail::SanitizeValue(nsString& val)
{
  MsgReplaceSubstring(val, NS_LITERAL_STRING("\r\n"), NS_LITERAL_STRING(", "));
  MsgReplaceChar(val, "\r\n", ',');
}
void nsEudoraAddress::SanitizeValue(nsCString& val)
{
  MsgReplaceSubstring(val, "\n", ", ");
  MsgReplaceChar(val, '\r', ',');
}
void nsOEAddressIterator::SanitizeValue(nsString& val)
{
  MsgReplaceSubstring(val, NS_LITERAL_STRING("\r\n"), NS_LITERAL_STRING(", "));
  MsgReplaceChar(val, "\r\n", ',');
}