From 302bf1b523012e11b60425d6eee1221ebc2724eb Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Sun, 3 Nov 2019 00:17:46 -0400 Subject: Issue #1258 - Part 1: Import mailnews, ldap, and mork from comm-esr52.9.1 --- mailnews/base/public/nsIMsgTagService.idl | 67 +++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 mailnews/base/public/nsIMsgTagService.idl (limited to 'mailnews/base/public/nsIMsgTagService.idl') diff --git a/mailnews/base/public/nsIMsgTagService.idl b/mailnews/base/public/nsIMsgTagService.idl new file mode 100644 index 000000000..b666c3b62 --- /dev/null +++ b/mailnews/base/public/nsIMsgTagService.idl @@ -0,0 +1,67 @@ +/* -*- 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); + 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 + void getAllTags(out unsigned long count, + [retval, array, size_is(count)] out nsIMsgTag tagArray); + /* + * 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); +}; -- cgit v1.2.3