1 /* $Id: Keys.h 1649 2009-10-19 14:35:01Z terpstra $ 2 * 3 * Keys.h - What prefixs various database keys 4 * 5 * Copyright (C) 2002 - Wesley W. Terpstra 6 * 7 * License: GPL 8 * 9 * Authors: 'Wesley W. Terpstra' <wesley@terpstra.ca> 10 * 11 * This program is free software; you can redistribute it and/or modify 12 * it under the terms of the GNU General Public License as published by 13 * the Free Software Foundation; version 2.1. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with this program; if not, write to the Free Software 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 */ 24 25 #ifndef KEYS_H 26 #define KEYS_H 27 28 #include <string> 29 #include <vector> 30 31 using std::string; 32 using std::vector; 33 34 // These must have length 1 35 #define LU_THREADING "t" 36 #define LU_KEYWORD "k" 37 #define LU_SUMMARY "s" 38 #define LU_CACHE "c" 39 #define LU_NEW_TOPICS "n" 40 41 #define LU_MESSAGE_DELETED 'd' 42 #define LU_MESSAGE_AUTHOR_EMAIL 'e' 43 #define LU_MESSAGE_AUTHOR_NAME 'n' 44 #define LU_MESSAGE_SUBJECT 's' 45 #define LU_MESSAGE_MBOX 'x' 46 47 /* special keywords */ 48 #define LU_KEYWORD_DELETED "id:deleted" /* a deleted message */ 49 50 /* fields indexed early */ 51 #define LU_KEYWORD_EVERYTHING "id:any" /* empty search */ 52 #define LU_KEYWORD_MESSAGE_ID "id:" /* Message id */ 53 #define LU_KEYWORD_REPLY_TO "rt:" /* Reply-to */ 54 #define LU_KEYWORD_THREAD "th:" /* THread */ 55 56 /* lu_import_message */ 57 #define LU_KEYWORD_LIST "ml:" /* Mailing List */ 58 #define LU_KEYWORD_AUTHOR "au:" /* AUthor */ 59 #define LU_KEYWORD_SUBJECT "sb:" /* SuBject */ 60 61 /* magic automatic keywords */ 62 #define LU_KEYWORD_GROUP "gr:" /* Mailing group */ 63 #define LU_KEYWORD_LANGUAGE "lang:" /* Language */ 64 65 /* import processing */ 66 #define LU_KEYWORD_WORD "" /* body keywords */ 67 68 /* The longest length a keyword can be */ 69 #define LU_KEYWORD_LEN 80 70 71 /* Analyze the string for keywords. */ 72 extern int my_keyword_digest_string( 73 const char* buf, 74 int len, 75 const char* prefix, 76 int (*writefn)(const char* keyword, void* arg), 77 void* arg, 78 int do_div); 79 80 const char* skipSubjectStart(const char* subject); 81 string subject_hash(const char* subject); 82 vector<string> extract_message_ids(const char* str); 83 84 /* The database has these types: 85 * 86 * Threading: 87 * LU_THREADING 88 * subject_hash 89 * message_id 90 * (reply_to_hash*) 91 * 92 * Summary: 93 * LU_SUMMARY 94 * message_id 95 * DELETED/AUTHOR_EMAIL/AUTHOR_NAME/SUBJECT/MBOX 96 * ... if it has any of these then it must have all of them, in that order 97 * For all except the MBOX+DELETED, one has just a string value. 98 * For Mbox: 99 * <mailbox-as-string> '\0' <64bit offset> <32bit length> 100 * 101 * Keyword: 102 * LU_KEYWORD 103 * keyword 104 * '\0' 105 * mid 106 * 107 * Cache cleaning: 108 * LU_CACHE 109 * import timestamp as 4 bytes in bigendian order 110 * mid 111 * 112 * New topics fields: 113 * LU_NEW_TOPICS 114 * listid '\0' 115 * timestamp 116 * threadhash 117 */ 118 119 #endif 120