Revision control

Copy as Markdown

Other Tools

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
/*
* Keys are the internal representation of tags, and use a limited range of
* characters, basically the characters allowed in imap keywords, which are
* alphanumeric characters, but don't include spaces. Keys are stored on
* the imap server, in local mail messages, and in summary files.
*
* Tags are the user visible representation of keys, and are full unicode
* strings. Tags should allow any unicode character.
*
* This service will do the mapping between keys and tags. When a tag
* is added, we'll need to "compute" the corresponding key to use. This
* will probably entail replacing illegal ascii characters (' ', '/', etc)
* with '_' and then converting to imap mod utf7. We'll then need to make
* sure that no other keyword has the same value since that algorithm
* doesn't guarantee a unique mapping.
*
* Tags are sorted internally by 'importance' by their ordinal strings (which by
* default are equal to a tag's key and thus only stored if different).
* The alphanumerically 'smallest' string is called the 'most important' one and
* comes first in any sorted array. The remainder follows in ascending order.
*/
[scriptable, uuid(84d593a3-5d8a-45e6-96e2-9189acd422e1)]
interface nsIMsgTag : nsISupports {
readonly attribute ACString key; // distinct tag identifier
readonly attribute AString tag; // human readable tag name
readonly attribute ACString color; // tag color
readonly attribute ACString ordinal; // custom sort string (usually empty)
};
[scriptable, uuid(97360ce3-0fba-4f1c-8214-af7bdc6f8587)]
interface nsIMsgTagService : nsISupports {
// create new tag by deriving the key from the tag
void addTag(in AString tag, in ACString color, in ACString ordinal);
// create/update tag with known key
void addTagForKey(in ACString key, in AString tag, in ACString color, in ACString ordinal);
// get the key representation of a given tag
ACString getKeyForTag(in AString tag);
// get the first key by ordinal order
ACString getTopKey(in ACString keyList);
// support functions for single tag aspects
AString getTagForKey(in ACString key); // look up the tag for a key.
void setTagForKey(in ACString key, in AString tag); // this can be used to "rename" a tag
ACString getColorForKey(in ACString key);
AString getSelectorForKey(in ACString key); // return wide string to avoid conversion
void setColorForKey(in ACString key, in ACString color);
ACString getOrdinalForKey(in ACString key);
void setOrdinalForKey(in ACString key, in ACString ordinal);
// delete a tag from the list of known tags (but not from any messages)
void deleteKey(in ACString key);
// get all known tags
Array<nsIMsgTag> getAllTags();
/*
* Determines if the token in aKey corresponds to a current valid tag
*
* @param aKey The string to test
* @return True if aKey is a current token
*/
boolean isValidKey(in ACString aKey);
};