1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
/*
copyright 2002 Alexander Malmberg <alexander@malmberg.org>
*/
#ifndef MsgDB_h
#define MsgDB_h
typedef unsigned int msg_id_t;
@class NSMutableDictionary,NSNotificationCenter,NSString;
#define DSTATUS_NODATA 0
#define DSTATUS_DATA 1
#define DSTATUS_PENDING 2
#define DSTATUS_ERROR 3
#define DSTATUS_NOSOURCE 4
@class MsgDB;
@protocol Msg_Source <NSObject>
- initWithMsg: (msg_id_t)mid db: (MsgDB *)mdb;
-(msg_id_t) mid;
-(void) update;
-(void) disconnect;
-(unsigned int) getMessage: (msg_id_t)mid priority: (int)pri;
-(BOOL) cancelGetMessage: (msg_id_t)mid id: (unsigned int) d;
@end
@protocol Msg_Folder <NSObject>
-(int) numMessages;
-(msg_id_t *) getMessages;
@end
@class NSString;
@class NSMutableArray;
@interface MsgDB : NSObject
{
msg_id_t main_id;
NSString *dir;
NSMutableDictionary *sources;
msg_id_t last_source_id;
struct message_s *messages;
unsigned int num_messages;
char **meta_headers;
int num_meta_headers;
struct msgdb_hash_s *hash;
NSMutableDictionary *folders;
NSNotificationCenter *ncenter;
}
- initWithDirectory: (NSString *)adir;
-(NSNotificationCenter *)notificationCenter;
-(void)setNotificationCenter: (NSNotificationCenter *)nc;
-(msg_id_t) midForId: (const char *)msgid;
-(msg_id_t) createMessageWithId: (const char *)msgid source: (NSObject<Msg_Source> *)src;
-(void) setMessageData: (unsigned char *)d length: (int)l : (msg_id_t) mid;
-(void) msg_setSource: (NSObject<Msg_Source> *)src : (msg_id_t) mid;
-(void) updateAll;
-(const char *) msg_getMessageID: (msg_id_t)mid;
-(const char *)msg_getMetaHeader: (const char *)hname : (msg_id_t)mid;
-(void)msg_setMetaHeader: (const char *)hname value: (const char *)value : (msg_id_t)mid;
-(const char *)msg_getMetaHeaderWithNumber: (int)num : (msg_id_t)mid;
-(void)msg_setMetaHeaderWithNumber: (int)num value: (const char *)value : (msg_id_t)mid;
-(const char *)msg_getHeader: (const char *)hname : (msg_id_t)mid;
/* priority ~10 for something the user wants to view, ~0 for read-ahead,
~-10 for bulk download */
-(void) msg_wantData: (msg_id_t)mid priority: (int)pri;
-(void) msg_needData: (msg_id_t)mid;
-(void) msg_cancelWantData: (msg_id_t)mid;
-(int) msg_getData: (const unsigned char **)data length: (int *)length : (msg_id_t)mid;
-(int) msg_dstatus: (msg_id_t)mid;
-(void)msg_addToFolder: (const char *)foldername : (msg_id_t)mid;
-(int) getMetaHeaderNum: (const char *)hname;
-(const char *) getMetaHeaderName: (int)num;
-(void) syncToDisk;
-(void)dumpMessages;
-(void)dumpMessage: (msg_id_t)mid;
-(NSDictionary *) folders;
-(NSArray *) sources;
-(NSObject<Msg_Source> *) addSourceOfType: (Class)c;
-(void) removeSource: (NSObject<Msg_Source> *)src;
@end
extern NSString
*MsgDB_MsgDStatusNotification,
*MsgDB_MsgMetaChangeNotification,
*MsgDB_LogMessageNotification,
*MsgDB_FolderAddMsgNotification,
*MsgDB_FolderAddNotification,
*MsgDB_SourceAddNotification,
*MsgDB_SourceRemoveNotification,
*MsgDB_SourceChangeNotification;
#include <Foundation/NSNotification.h>
@interface MidNotification : NSNotification
{
NSString *name;
id object;
msg_id_t mid;
NSObject<Msg_Folder> *folder;
int header;
}
+ notificationWithName: (NSString *)name object: (id)o mid: (msg_id_t)m folder: (NSObject<Msg_Folder> *)f header: (int)h;
- initWithName: (NSString *)n object: (id)o mid: (msg_id_t)m folder: (NSObject<Msg_Folder> *)f header: (int)h;
-(msg_id_t) mid;
-(NSObject<Msg_Folder> *) folder;
-(const char *) headerName;
@end
#endif
|