jwz@teak.berkeley.edu (Jamie Zawinski) (11/28/89)
Could someone explain to me what the date field of an entry in the .MS_MsgDir file is? My guesses were: number of seconds since Jan 1 00; number of seconds since Jan 1 1900; number of seconds since Jan 1 1970; and all of the above expressed in tenths, thirty-seconds, fiftieths, and sixtieths of seconds, and in various bit/byte orders. I have no clue. I'm talking about the field whose length is specified by AMS_DATESIZE; I don't remember what the actual names of the struct/slot are. I'm also confused about the format of the header-part of this file; there's supposed to be some sort of major/minor version numbers there, but I can't decipher them either. I'm not doing this in C, so answers more specific than "just read a string and cast it to..." would be best. Thanks, -- Jamie
nsb@THUMPER.BELLCORE.COM (Nathaniel Borenstein) (11/28/89)
First of all, the date field: This is a UNIX-style date (seconds since January 1, 1970, or something like that) converted from a long into a base 64 string of six bytes. The AMS libraries contain functions for going into and out of base64, but of course that won't help you if you're not using C; the code for them is in overhead/mail/lib/genid.c, and should be easily converted to some other language. (The rationale for the base 64 stuff is lost in ancient history, but had to do with wanting to put the dates in ASCII-readable form for things like file names, etc. In retrospect, I don't care to defend it.) The header part of the .MS_MsgDir file is basically a magic signature and some directory-wide information. Included in it are a major and minor version number for the format of the .MS_MsgDir file itself. That format hasn't changed for years, and probably won't change any time soon, but checking it is a good idea in case it changes some time in the future. The actual format of the header is fairly idiosyncratic, but easily understood if you know where to look. The place to look, it turns out, is in ams/libs/ms/rawdb.c, in a routine called DestructivelyWriteDirectoryHead. That routine is what normally writes out the directory headers, and it should be pretty easy to tell, from that, what the format is. (No, there is no formal spec anywhere for the format.) I hope that helps; if you need further help, don't hesitate to ask.
cfe+@ANDREW.CMU.EDU ("Craig F. Everhart") (11/30/89)
An alternative to having to know what the field is, that I'm surprised Nathaniel didn't mention, is that you should be using message-server routines to deal with the .MS_MsgDir file itself. Now, if the question is really about the format of the snapshots that the message server returns to the caller, I understand why you might want to know. Craig
jwz@teak.berkeley.edu (Jamie Zawinski) (11/30/89)
> An alternative to having to know what the field is, that I'm surprised > Nathaniel didn't mention, is that you should be using message-server > routines to deal with the .MS_MsgDir file itself. Now, if the question > is really about the format of the snapshots that the message server > returns to the caller, I understand why you might want to know. > > Craig Actually, the reason I wanted to know is I'm implementing a Messages-like program on the TI Explorer Lisp machine (which doesn't run C). I've got code that reads the datastream (fonts and rasters, anyway) and dumps it into a Zmacs buffer (the Explorer editor, which has its own format for fonted text). I'm reading the bb files off of AFS directly; the Explorer's file system knows about FTP at a very low level, so I can just open "spice.cs.cmu.edu:/afs/andrew/usr/bb/..." and read from those. Now, I'd much rather do this by opening up a TCP connection to some server and talk to it the way I would talk to NNTP; with a setup like this, I might not even have to give Andrew or Spice a password, and people without Andrew accounts would be able to use this code. But alas, my previous post asking about this turned up little; someone said "I think SNAP does that, but SNAP isn't part of the X11r3 release, and I don't know where the source code is, or if it's protocol is documented at all." I looked around on /afs/andrew/ and couldn't find snap, so I gave up... Anyone want to tell me how to do this the right way? -- Jamie
nsb@THUMPER.BELLCORE.COM (Nathaniel Borenstein) (11/30/89)
Craig is of course right; even if you're programming in LISP, it could well be argued that the right thing to do is make a LISP RPC interface to the messageserver. I should have mentioned that, indeed. -- NB
nsb@THUMPER.BELLCORE.COM (Nathaniel Borenstein) (11/30/89)
Well, SNAP is indeed part of the R4 release, though not the R3 release, so your options are about to increase in number. But SNAP also requires a userid and password to connect to a remote messageserver. Still, it is a cleaner and more maintainable way to do what you're doing now... -- NB