1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is mozilla.org code.
16 *
17 * The Initial Developer of the Original Code is
18 * The Mozilla Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 2006
20 * the Initial Developer. All Rights Reserved.
21 *
22 * Contributor(s):
23 * David Bienvenu <bienvenu@mozilla.com>
24 * Karsten Düsterloh <mnyromyr@tprac.de>
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either of the GNU General Public License Version 2 or later (the "GPL"),
28 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
37 *
38 * ***** END LICENSE BLOCK ***** */
39
40 #include "nsISupports.idl"
41
42 /*
43 * Keys are the internal representation of tags, and use a limited range of
44 * characters, basically the characters allowed in imap keywords, which are
45 * alphanumeric characters, but don't include spaces. Keys are stored on
46 * the imap server, in local mail messages, and in summary files.
47 *
48 * Tags are the user visible representation of keys, and are full unicode
49 * strings. Tags should allow any unicode character.
50 *
51 * This service will do the mapping between keys and tags. When a tag
52 * is added, we'll need to "compute" the corresponding key to use. This
53 * will probably entail replacing illegal ascii characters (' ', '/', etc)
54 * with '_' and then converting to imap mod utf7. We'll then need to make
55 * sure that no other keyword has the same value since that algorithm
56 * doesn't guarantee a unique mapping.
57 *
58 * Tags are sorted internally by 'importance' by their ordinal strings (which by
59 * default are equal to a tag's key and thus only stored if different).
60 * The alphanumerically 'smallest' string is called the 'most important' one and
61 * comes first in any sorted array. The remainder follows in ascending order.
62 */
63
64 [scriptable, uuid(84d593a3-5d8a-45e6-96e2-9189acd422e1)]
65 interface nsIMsgTag : nsISupports {
66 readonly attribute ACString key; // distinct tag identifier
67 readonly attribute AString tag; // human readable tag name
68 readonly attribute ACString color; // tag color
69 readonly attribute ACString ordinal; // custom sort string (usually empty)
70 };
71
72 [scriptable, uuid(b897da55-8256-4cf5-892b-32e77bc7c50b)]
73 interface nsIMsgTagService : nsISupports {
74 // create new tag by deriving the key from the tag
75 void addTag(in AString tag, in ACString color, in ACString ordinal);
76 // create/update tag with known key
77 void addTagForKey(in ACString key, in AString tag, in ACString color, in ACString ordinal);
78 // get the key representation of a given tag
79 ACString getKeyForTag(in AString tag);
80 // get the first key by ordinal order
81 ACString getTopKey(in string keyList);
82 // support functions for single tag aspects
83 AString getTagForKey(in ACString key); // look up the tag for a key.
84 void setTagForKey(in ACString key, in AString tag); // this can be used to "rename" a tag
85 ACString getColorForKey(in ACString key);
86 void setColorForKey(in ACString key, in ACString color);
87 ACString getOrdinalForKey(in ACString key);
88 void setOrdinalForKey(in ACString key, in ACString ordinal);
89 // delete a tag from the list of known tags (but not from any messages)
90 void deleteKey(in ACString key);
91 // get all known tags
92 void getAllTags(out unsigned long count,
93 [retval, array, size_is(count)] out nsIMsgTag tagArray);
94 };