Newbie question - Integration with other email systems

2004-02-01 Thread Nick Birren
Hi

I'm trying to figure out what's the best way to connect to a proprietary-protocol emailserver and expose IMAP functionality. 
I do not wish to import all emails into a flat-file and feed it into the IMAP server, but rather integrate to it by implementing some pre-defined interface that the IMAP server will use (and will, on the other end, act as a client for the proprietary server).

Can it be done with WU IMAP? Any other ways that you think I should consider?

Any pointers to reading material / codesections to look at will be much appreciated.

-N
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

Re: Newbie question - Integration with other email systems

2004-02-01 Thread pheonix1t
Nick Birren wrote:

Hi
 
I'm trying to figure out what's the best way to connect to a 
proprietary-protocol email server and expose IMAP functionality.
I do not wish to import all emails into a flat-file and feed it into 
the IMAP server, but rather integrate to it by implementing some 
pre-defined interface that the IMAP server will use (and will, on the 
other end, act as a client for the proprietary server).
 
Can it be done with WU IMAP? Any other ways that you think I should 
consider?
 
Any pointers to reading material / code sections to look at will be 
much appreciated.
 
-N

Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. *Try it!* 
http://us.rd.yahoo.com/evt=21608/*http://webhosting.yahoo.com/ps/sb/ 
do you mean something like www.bynari.com ?




Re: Newbie question - Integration with other email systems

2004-02-01 Thread Mark Crispin
On Sun, 1 Feb 2004, Nick Birren wrote:
 I'm trying to figure out what's the best way to connect to a
 proprietary-protocol email server and expose IMAP functionality.  I do
 not wish to import all emails into a flat-file and feed it into the IMAP
 server, but rather integrate to it by implementing some pre-defined
 interface that the IMAP server will use (and will, on the other end, act
 as a client for the proprietary server).

This certainly can be done, and relatively easily in UW (not WU) IMAP.
What you need to do is write a c-client driver that is a client for your
proprietary-protocol email server.  That way, imapd would be a client of
your proprietary-protocol email server; just as imapd can be a client of a
POP3, NNTP, or another IMAP server today.

The tricky thing is deciding how to pass authentication credentials from
the end user to your proprietary-protocol email server.  There's code now
to pass the same userid and password as was used to log in to the IMAP
server, but perhaps you might want to do something better than that.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.


Re: Newbie question - Integration with other email systems

2004-02-01 Thread Nick Birren
Cool. Any recommended reading material for writing c-client drivers?

Thanks
-NickMark Crispin [EMAIL PROTECTED] wrote:
On Sun, 1 Feb 2004, Nick Birren wrote: I'm trying to figure out what's the best way to connect to a proprietary-protocol email server and expose IMAP functionality. I do not wish to import all emails into a flat-file and feed it into the IMAP server, but rather integrate to it by implementing some pre-defined interface that the IMAP server will use (and will, on the other end, act as a client for the proprietary server).This certainly can be done, and relatively easily in UW (not "WU") IMAP.What you need to do is write a c-client driver that is a client for yourproprietary-protocol email server. That way, imapd would be a client ofyour proprietary-protocol email server; just as imapd can be a client of aPOP3, NNTP, or another IMAP server today.The tricky thing is deciding how to pass authentication
 credentials fromthe end user to your proprietary-protocol email server. There's code nowto pass the same userid and password as was used to log in to the IMAPserver, but perhaps you might want to do something better than that.-- Mark --http://staff.washington.edu/mrcScience does not emerge from voting, party politics, or public debate.Si vis pacem, para bellum.
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

Re: Newbie question - Integration with other email systems

2004-02-01 Thread Mark Crispin
On Sun, 1 Feb 2004, Nick Birren wrote:
 Cool. Any recommended reading material for writing c-client drivers?

I would start with using the latest sources (imap-2004 RC6) instead of
the release version (imap-2002e).

Inside the imap-2004/docs/ directory there is a file called internal.txt
which contains some information about c-client programming.  Look towards
the end under Driver Interface.  Note that this document was written in
1996 and so should be used as a guideline to understand rather than an
authoritative reference.

Also, look at how existing drivers work.  I suggest looking at the NNTP,
POP3, and IMAP drivers.  Note how some methods are mandatory-to-implement
while others are not; e.g. open is a mandatory method, but search is not.

Sometimes, you have a choice of which method(s) to implement.  For
example, the IMAP driver implements the msgdata method but not header or
text, whereas the other drivers implement header and text but not msgdata.
This is because the IMAP server does message parts, whereas in other
drivers c-client has to do it internally.

There's a bit of a steep learning curve, which is why I recommend looking
at how existing drivers work.  The good news is that once you climb that
curve it's a fairly straightforward task to do the job.

-- Mark --

http://staff.washington.edu/mrc
Science does not emerge from voting, party politics, or public debate.
Si vis pacem, para bellum.


Re: Compiling IMAP under Visual Studio

2004-02-01 Thread Shawn Walker
Compile c-client the normal way (nmake /f makefile.nt) to get the c-client
directory created and all the files copied.

Go to MSVC and create a project for c-client for static library and add the
files in c-client (you can't add all of them, only the ones that c-client
need, look in the makefile).

That should be it.

 - Original Message - 
 From: Nick Birren
 To: [EMAIL PROTECTED]
 Sent: Sunday, February 01, 2004 2:25 PM
 Subject: Compiling IMAP under Visual Studio


 A friend of mine wants to know if anyone has a workspace for compiling
IMAP under Visual Studio (either 6.0 or .Net).
 I believe creating it should be quite straightforward, but still, if
someone has already  done it, I'd appreciate getting the workspace.
 I mean - he'd appreciate it.

 -N


 Do you Yahoo!?
 Yahoo! SiteBuilder - Free web site building tool. Try it!



Re: [patch] hashed spool directories

2004-02-01 Thread Matt Selsky
 My feeling about hashed spool directories is that this functionality is
 site-specific, with no obvious single definition of how it is to be
 implemented that applies in all instances.  Consequently, I consider it to
 be something that should always be of the form of a third-party patch
 rather than an official part of c-client.  I do encourage you to continue
 distributing this patch since it's likely to be useful for some people

Thank you for your feedback.

Procmail has included support for hashed spool directories since 3.13,
so I don't think the feature is that site specific. (see
procmail/src/authenticate.c #define MAILSPOOLHASH 0)

 For what it's worth, I suggest the following alternative implementation of
 your patch, which avoids needless rescans of the string:
 
int i;
char *u,*s;
strcpy (tmp,MAILSPOOL);
for (i = 0, u = myusername (), s = tmp + strlen (tmp);
 (*s++ = '/')  (i  spool_hash_depth)  u[i];
 *s++ = u[i++]);
strcpy (s,u);

See my new patch against imap-2004rc6.  Further comments are welcome.


Cheers.


Re: [patch] hashed spool directories

2004-02-01 Thread Matt Selsky
Sorry, I forgot to include the attachment.

Cheers.

On Sun, Feb 01, 2004 at 05:59:13PM -0500, Matt Selsky wrote:
  My feeling about hashed spool directories is that this functionality is
  site-specific, with no obvious single definition of how it is to be
  implemented that applies in all instances.  Consequently, I consider it to
  be something that should always be of the form of a third-party patch
  rather than an official part of c-client.  I do encourage you to continue
  distributing this patch since it's likely to be useful for some people
 
 Thank you for your feedback.
 
 Procmail has included support for hashed spool directories since 3.13,
 so I don't think the feature is that site specific. (see
 procmail/src/authenticate.c #define MAILSPOOLHASH 0)
 
  For what it's worth, I suggest the following alternative implementation of
  your patch, which avoids needless rescans of the string:
  
 int i;
 char *u,*s;
 strcpy (tmp,MAILSPOOL);
 for (i = 0, u = myusername (), s = tmp + strlen (tmp);
  (*s++ = '/')  (i  spool_hash_depth)  u[i];
  *s++ = u[i++]);
 strcpy (s,u);
 
 See my new patch against imap-2004rc6.  Further comments are welcome.
 
 
 Cheers.
--- imap-2004.RC6/src/osdep/unix/env_unix.c 2004/02/01 21:30:40 1.2
+++ imap-2004.RC6/src/osdep/unix/env_unix.c 2004/02/01 22:55:31
@@ -92,6 +92,8 @@
/* block notification */
 static blocknotify_t mailblocknotify = mm_blocknotify;
 
+static short spool_hash_depth = 0; /* 2 means spool is /var/mail/f/o/foo */
+
 /* Note: setting disableLockWarning means that you assert that the
  * so-modified copy of this software will NEVER be used:
  *  1) in conjunction with any software which expects .lock files
@@ -818,7 +820,23 @@
 {
   char tmp[MAILTMPLEN];
   if (!sysInbox) { /* initialize if first time */
-sprintf (tmp,%s/%s,MAILSPOOL,myusername ());
+int i;
+char *u,*s, c;
+static short endofstring = NIL;
+
+strcpy (tmp,MAILSPOOL);
+for (i = 0, u = myusername (), s = tmp + strlen (tmp);
+(*s++ = '/')  (i  spool_hash_depth);
+i++) {
+  /* deal with usernames shorter than hash depth */
+  if (u[i]  !endofstring)
+   c = u[i];
+  else
+   endofstring = T;
+  *s++ = c;
+}
+strcpy (s,u);
+
 sysInbox = cpystr (tmp);   /* system inbox is from mail spool */
   }
   return sysInbox;