kpilot Library API Documentation

popmail-conduit.h

00001 #ifndef _KPILOT_POPMAIL_CONDUIT_H
00002 #define _KPILOT_POPMAIL_CONDUIT_H
00003 /* popmail-conduit.h                    KPilot
00004 **
00005 ** Copyright (C) 1998,1999,2000 Dan Pilone
00006 ** Copyright (C) 1999,2000 Michael Kropfberger
00007 **
00008 ** This file is part of the popmail conduit, a conduit for KPilot that
00009 ** synchronises the Pilot's email application with the outside world,
00010 ** which currently means:
00011 **      -- sendmail or SMTP for outgoing mail
00012 **      -- POP or mbox for incoming mail
00013 */
00014 
00015 /*
00016 ** This program is free software; you can redistribute it and/or modify
00017 ** it under the terms of the GNU General Public License as published by
00018 ** the Free Software Foundation; either version 2 of the License, or
00019 ** (at your option) any later version.
00020 **
00021 ** This program is distributed in the hope that it will be useful,
00022 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00023 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00024 ** GNU General Public License for more details.
00025 **
00026 ** You should have received a copy of the GNU General Public License
00027 ** along with this program in a file called COPYING; if not, write to
00028 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
00029 ** MA 02111-1307, USA.
00030 */
00031 
00032 /*
00033 ** Bug reports and questions can be sent to kde-pim@kde.org
00034 */
00035 
00036 
00037 #include <stdio.h>
00038 
00039 #include "plugin.h"
00040 
00041 class KSocket;
00042 
00043 class PilotRecord;
00044 class PilotDatabase;
00045 
00046 class PopMailConduit : public ConduitAction
00047 {
00048 public:
00049         PopMailConduit(KPilotDeviceLink *d,
00050                 const char *n=0L,
00051                 const QStringList &l=QStringList());
00052         virtual ~PopMailConduit();
00053 
00054         enum RetrievalMode {
00055                 RECV_NONE=0,
00056                 RECV_POP=1,
00057                 RECV_UNIX=2 } ;
00058         enum SendMode {
00059                 SEND_NONE=0,
00060                 SEND_SENDMAIL=7,
00061                 SEND_KMAIL=8,
00062                 SEND_SMTP=12
00063                 } ;
00064 
00065 protected:
00066         virtual bool exec();
00067 
00068         static PilotRecord *readMessage(FILE *mailbox,
00069                 char *buffer,int bufferSize);
00070 
00071 protected:
00072         void doSync();
00073         void doTest();
00074 
00075         // Pilot -> Sendmail
00076         //
00077         //
00078         int sendPendingMail(int mode /* unused */);
00079         int sendViaSendmail();
00080         int sendViaKMail();
00081         int sendViaSMTP();
00082         void writeMessageToFile(FILE* sendf, struct Mail& theMail);
00083         QString getKMailOutbox() const;
00084 
00085 
00086         // Local mail -> Pilot
00087         //
00088         //
00089         int retrieveIncoming(int mode);
00090         int doPopQuery();
00091         int doUnixStyle();
00092 
00093 
00094   // Taken from pilot-mail.c in pilot-link.0.8.7 by Kenneth Albanowski
00095   int getpopchar(int socket);
00096   int getpopstring(int socket, char * buf);
00097   int getpopresult(int socket, char * buf);
00098 
00099         // Helper functions for the POP mail handler
00100         //
00101         //
00102         typedef enum { POP_DELE=16 } retrieveFlags ;
00103         void retrievePOPMessages(KSocket *,
00104                 int const msgcount,
00105                 int const flags,
00106                 char *buffer, int const buffer_size);
00107 
00108         static char* skipspace(char * c);
00109         static void header(struct Mail * m, char * t);
00110 
00119         static int skipBlanks(FILE *,char *buf,int size);
00120 
00135         static int readHeaders(FILE *,char *buf,int size,
00136                 struct Mail *,int expectFrom);
00137         static int readBody(FILE *,char *buf,int size);
00138 
00139 private:
00140         PilotDatabase *fDatabase;
00141 };
00142 
00143 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.4.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sat Oct 18 02:47:15 2003 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001