Back to index

lightning-sunbird  0.9+nobinonly
nsIMsgTagService.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * The Mozilla Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 2006
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   David Bienvenu <bienvenu@mozilla.com>
00024  *   Karsten Düsterloh <mnyromyr@tprac.de>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either of the GNU General Public License Version 2 or later (the "GPL"),
00028  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039 
00040 #include "nsISupports.idl"
00041 
00042 /*
00043  * Keys are the internal representation of tags, and use a limited range of
00044  * characters, basically the characters allowed in imap keywords, which are
00045  * alphanumeric characters, but don't include spaces. Keys are stored on
00046  * the imap server, in local mail messages, and in summary files.
00047  *
00048  * Tags are the user visible representation of keys, and are full unicode
00049  * strings. Tags should allow any unicode character.
00050  *
00051  * This service will do the mapping between keys and tags. When a tag
00052  * is added, we'll need to "compute" the corresponding key to use. This
00053  * will probably entail replacing illegal ascii characters (' ', '/', etc)
00054  * with '_' and then converting to imap mod utf7. We'll then need to make
00055  * sure that no other keyword has the same value since that algorithm
00056  * doesn't guarantee a unique mapping.
00057  *
00058  * Tags are sorted internally by 'importance' by their ordinal strings (which by
00059  * default are equal to a tag's key and thus only stored if different). 
00060  * The alphanumerically 'smallest' string is called the 'most important' one and
00061  * comes first in any sorted array. The remainder follows in ascending order.
00062  */
00063 
00064 [scriptable, uuid(84d593a3-5d8a-45e6-96e2-9189acd422e1)]
00065 interface nsIMsgTag : nsISupports {
00066   readonly attribute ACString key;     // distinct tag identifier
00067   readonly attribute AString  tag;     // human readable tag name
00068   readonly attribute ACString color;   // tag color
00069   readonly attribute ACString ordinal; // custom sort string (usually empty)
00070 };
00071 
00072 [scriptable, uuid(b897da55-8256-4cf5-892b-32e77bc7c50b)]
00073 interface nsIMsgTagService : nsISupports {
00074   // create new tag by deriving the key from the tag
00075   void addTag(in AString tag, in ACString color, in ACString ordinal);
00076   // create/update tag with known key
00077   void addTagForKey(in ACString key, in AString tag, in ACString color, in ACString ordinal);
00078   // get the key representation of a given tag
00079   ACString getKeyForTag(in AString tag);
00080   // get the first key by ordinal order
00081   ACString getTopKey(in string keyList);
00082   // support functions for single tag aspects
00083   AString getTagForKey(in ACString key); // look up the tag for a key.
00084   void setTagForKey(in ACString key, in AString tag); // this can be used to "rename" a tag
00085   ACString getColorForKey(in ACString key);
00086   void setColorForKey(in ACString key, in ACString color);
00087   ACString getOrdinalForKey(in ACString key);
00088   void setOrdinalForKey(in ACString key, in ACString ordinal);
00089   // delete a tag from the list of known tags (but not from any messages)
00090   void deleteKey(in ACString key);
00091   // get all known tags
00092   void getAllTags(out unsigned long count,
00093                   [retval, array, size_is(count)] out nsIMsgTag tagArray);
00094 };