summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorWojciech Polak <polak@gnu.org>2004-11-17 21:24:50 +0000
committerWojciech Polak <polak@gnu.org>2004-11-17 21:24:50 +0000
commit7e90b785792197188501d8dfc78f8e3057634796 (patch)
tree31fc41a727db9c26807b85a6e3e0da9dd357dc60 /include
parent346f0be99bca5c7e2d2264ed404a47499129d53e (diff)
downloadmailutils-7e90b785792197188501d8dfc78f8e3057634796.tar.gz
mailutils-7e90b785792197188501d8dfc78f8e3057634796.tar.bz2
Initial version of libmu_cpp.
Diffstat (limited to 'include')
-rw-r--r--include/mailutils/cpp/Makefile.am36
-rw-r--r--include/mailutils/cpp/address.h70
-rw-r--r--include/mailutils/cpp/error.h54
-rw-r--r--include/mailutils/cpp/filter.h45
-rw-r--r--include/mailutils/cpp/header.h46
-rw-r--r--include/mailutils/cpp/iterator.h54
-rw-r--r--include/mailutils/cpp/list.h68
-rw-r--r--include/mailutils/cpp/mailbox.h63
-rw-r--r--include/mailutils/cpp/mailcap.h64
-rw-r--r--include/mailutils/cpp/mailer.h50
-rw-r--r--include/mailutils/cpp/mailutils.h33
-rw-r--r--include/mailutils/cpp/message.h46
-rw-r--r--include/mailutils/cpp/pop3.h72
-rw-r--r--include/mailutils/cpp/stream.h128
-rw-r--r--include/mailutils/cpp/url.h58
15 files changed, 887 insertions, 0 deletions
diff --git a/include/mailutils/cpp/Makefile.am b/include/mailutils/cpp/Makefile.am
new file mode 100644
index 000000000..0e6012893
--- /dev/null
+++ b/include/mailutils/cpp/Makefile.am
@@ -0,0 +1,36 @@
+## Process this file with GNU Automake to create Makefile.in
+##
+## Copyright (C) 2004 Free Software Foundation, Inc.
+##
+## GNU Mailutils is free software; you can redistribute it and/or
+## modify it under the terms of the GNU General Public License as
+## published by the Free Software Foundation; either version 2, or (at
+## your option) any later version.
+##
+## GNU Mailutils is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with GNU Mailutils; if not, write to the Free Software
+## Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+MU_CXX_INCLUDES = \
+ address.h\
+ error.h\
+ filter.h\
+ header.h\
+ iterator.h\
+ list.h\
+ mailbox.h\
+ mailcap.h\
+ mailer.h\
+ mailutils.h\
+ message.h\
+ pop3.h\
+ stream.h\
+ url.h
+
+pkginclude_HEADERS = @MU_CXX_INCLUDES@
+EXTRA_HEADERS = '$(MU_CXX_INCLUDES)'
diff --git a/include/mailutils/cpp/address.h b/include/mailutils/cpp/address.h
new file mode 100644
index 000000000..a67868e7a
--- /dev/null
+++ b/include/mailutils/cpp/address.h
@@ -0,0 +1,70 @@
+/*
+ GNU Mailutils -- a suite of utilities for electronic mail
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef _ADDRESS_H
+#define _ADDRESS_H
+
+#include <iostream>
+#include <mailutils/address.h>
+#include <mailutils/cpp/error.h>
+
+namespace mailutils
+{
+
+class Address
+{
+ private:
+ char buf[256];
+
+ protected:
+ address_t addr;
+
+ friend class Mailer;
+
+ public:
+ Address (const std::string&);
+ Address (const address_t);
+ ~Address ();
+
+ size_t GetCount ();
+ bool IsGroup (size_t);
+
+ std::string GetEmail (size_t);
+ std::string GetLocalPart (size_t);
+ std::string GetDomain (size_t);
+ std::string GetPersonal (size_t);
+ std::string GetComments (size_t);
+ std::string GetRoute (size_t);
+
+ // Address Exceptions
+ class EInval : public Exception {
+ public:
+ EInval (const std::string& m, int s) : Exception (m, s) {}
+ };
+
+ class ENoent : public Exception {
+ public:
+ ENoent (const std::string& m, int s) : Exception (m, s) {}
+ };
+};
+
+}
+
+#endif // not _ADDRESS_H
+
diff --git a/include/mailutils/cpp/error.h b/include/mailutils/cpp/error.h
new file mode 100644
index 000000000..d0bb6de95
--- /dev/null
+++ b/include/mailutils/cpp/error.h
@@ -0,0 +1,54 @@
+/*
+ GNU Mailutils -- a suite of utilities for electronic mail
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef _ERROR_H
+#define _ERROR_H
+
+#include <iostream>
+#include <string>
+#include <mailutils/errno.h>
+
+namespace mailutils
+{
+
+class Exception
+{
+ protected:
+ std::string method;
+ std::string msgerr;
+
+ public:
+ Exception (const std::string m, int s) {
+ method = m;
+ msgerr = mu_strerror (s);
+ }
+
+ std::string Method () const {
+ return method;
+ }
+
+ std::string MsgError () const {
+ return msgerr;
+ }
+};
+
+}
+
+#endif /* not _ERROR_H */
+
diff --git a/include/mailutils/cpp/filter.h b/include/mailutils/cpp/filter.h
new file mode 100644
index 000000000..d79dfeab2
--- /dev/null
+++ b/include/mailutils/cpp/filter.h
@@ -0,0 +1,45 @@
+/*
+ GNU Mailutils -- a suite of utilities for electronic mail
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef _FILTER_H
+#define _FILTER_H
+
+#include <iostream>
+#include <mailutils/filter.h>
+#include <mailutils/cpp/stream.h>
+
+namespace mailutils
+{
+
+class FilterStream : public Stream
+{
+ private:
+ Stream *input;
+
+ public:
+ void Create (Stream&, const std::string&, int, int);
+ void IconvCreate (Stream&, const std::string&,
+ const std::string&, int,
+ enum mu_iconv_fallback_mode);
+};
+
+}
+
+#endif // not _FILTER_H
+
diff --git a/include/mailutils/cpp/header.h b/include/mailutils/cpp/header.h
new file mode 100644
index 000000000..17e75c5b2
--- /dev/null
+++ b/include/mailutils/cpp/header.h
@@ -0,0 +1,46 @@
+/*
+ GNU Mailutils -- a suite of utilities for electronic mail
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef _HEADER_H
+#define _HEADER_H
+
+#include <iostream>
+#include <string>
+#include <mailutils/header.h>
+
+namespace mailutils
+{
+
+class Header
+{
+ protected:
+ header_t hdr;
+
+ public:
+ Header ();
+ Header (const header_t);
+
+ std::string GetValue (const std::string&);
+ std::string operator [] (const std::string&);
+};
+
+}
+
+#endif // not _HEADER_H
+
diff --git a/include/mailutils/cpp/iterator.h b/include/mailutils/cpp/iterator.h
new file mode 100644
index 000000000..1437ac0ac
--- /dev/null
+++ b/include/mailutils/cpp/iterator.h
@@ -0,0 +1,54 @@
+/*
+ GNU Mailutils -- a suite of utilities for electronic mail
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef _ITERATOR_H
+#define _ITERATOR_H
+
+#include <iostream>
+#include <mailutils/iterator.h>
+#include <mailutils/cpp/list.h>
+
+namespace mailutils
+{
+
+class Iterator
+{
+ protected:
+ iterator_t mu_iter;
+ List* pList;
+
+ public:
+ Iterator (const List&);
+ Iterator (const iterator_t);
+ ~Iterator ();
+
+ void Dup (Iterator*&, const Iterator&);
+ void First ();
+ void Next ();
+ Iterator& operator ++ (int);
+ void Current (void**);
+ void* Current ();
+ bool IsDone ();
+ List& GetList ();
+};
+
+}
+
+#endif // not _ITERATOR_H
+
diff --git a/include/mailutils/cpp/list.h b/include/mailutils/cpp/list.h
new file mode 100644
index 000000000..aea9872e9
--- /dev/null
+++ b/include/mailutils/cpp/list.h
@@ -0,0 +1,68 @@
+/*
+ GNU Mailutils -- a suite of utilities for electronic mail
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef _LIST_H
+#define _LIST_H
+
+#include <iostream>
+#include <mailutils/list.h>
+
+typedef int list_action_t (void*, void*);
+typedef int (*list_comparator_t) (const void*, const void*);
+
+namespace mailutils
+{
+
+class List
+{
+ protected:
+ list_t mu_list;
+
+ friend class Iterator;
+
+ public:
+ List ();
+ List (const list_t);
+ ~List ();
+
+ void Append (void*);
+ void Prepend (void*);
+ void Insert (void*, void*);
+ void Remove (void*);
+ void Replace (void*, void*);
+
+ void Get (size_t, void**);
+ void* Get (size_t);
+ void* operator [] (size_t);
+
+ void ToArray (void**, size_t, size_t*);
+ void Locate (void*, void**);
+
+ void Do (list_action_t*, void*);
+ list_comparator_t SetComparator (list_comparator_t);
+ void SetDestroyItem (void (*destoy_item) (void *));
+
+ bool IsEmpty ();
+ size_t Count ();
+};
+
+}
+
+#endif // not _LIST_H
+
diff --git a/include/mailutils/cpp/mailbox.h b/include/mailutils/cpp/mailbox.h
new file mode 100644
index 000000000..4a24e1b8f
--- /dev/null
+++ b/include/mailutils/cpp/mailbox.h
@@ -0,0 +1,63 @@
+/*
+ GNU Mailutils -- a suite of utilities for electronic mail
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef _MAILBOX_H
+#define _MAILBOX_H
+
+#include <iostream>
+#include <mailutils/mailbox.h>
+#include <mailutils/cpp/message.h>
+
+namespace mailutils
+{
+
+class MailboxBase
+{
+ protected:
+ mailbox_t mbox;
+
+ public:
+ void Open (int);
+ void Close ();
+
+ size_t MessagesCount ();
+ Message& GetMessage (size_t);
+ Message& operator [] (size_t);
+};
+
+class Mailbox : public MailboxBase
+{
+ public:
+ Mailbox (const std::string&);
+ Mailbox (const mailbox_t);
+ ~Mailbox ();
+};
+
+class MailboxDefault : public MailboxBase
+{
+ public:
+ MailboxDefault (const std::string&);
+ MailboxDefault (const mailbox_t);
+ ~MailboxDefault ();
+};
+
+}
+
+#endif /* not _MAILBOX_H */
+
diff --git a/include/mailutils/cpp/mailcap.h b/include/mailutils/cpp/mailcap.h
new file mode 100644
index 000000000..50ffd361a
--- /dev/null
+++ b/include/mailutils/cpp/mailcap.h
@@ -0,0 +1,64 @@
+/*
+ GNU Mailutils -- a suite of utilities for electronic mail
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef _MAILCAP_H
+#define _MAILCAP_H
+
+#include <iostream>
+#include <mailutils/mailcap.h>
+#include <mailutils/cpp/stream.h>
+
+namespace mailutils
+{
+
+class MailcapEntry
+{
+ private:
+ char buf[256];
+
+ protected:
+ mu_mailcap_entry_t entry;
+
+ public:
+ MailcapEntry (mu_mailcap_entry_t);
+
+ size_t FieldsCount ();
+ std::string GetTypeField ();
+ std::string GetViewCommand ();
+ std::string GetField (size_t);
+};
+
+class Mailcap
+{
+ protected:
+ mu_mailcap_t mailcap;
+
+ public:
+ Mailcap (const Stream&);
+ Mailcap (const mu_mailcap_t);
+ ~Mailcap ();
+
+ size_t GetCount ();
+ MailcapEntry& GetEntry (size_t);
+};
+
+}
+
+#endif // not _MAILCAP_H
+
diff --git a/include/mailutils/cpp/mailer.h b/include/mailutils/cpp/mailer.h
new file mode 100644
index 000000000..1c4d98296
--- /dev/null
+++ b/include/mailutils/cpp/mailer.h
@@ -0,0 +1,50 @@
+/*
+ GNU Mailutils -- a suite of utilities for electronic mail
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef _MAILER_H
+#define _MAILER_H
+
+#include <iostream>
+#include <string>
+#include <mailutils/mailer.h>
+#include <mailutils/cpp/message.h>
+#include <mailutils/cpp/address.h>
+
+namespace mailutils
+{
+
+class Mailer
+{
+ protected:
+ mailer_t mailer;
+
+ public:
+ Mailer (const std::string&);
+ Mailer (const mailer_t);
+ ~Mailer ();
+
+ void Open (int);
+ void Close ();
+ void SendMessage (const Message&, const Address&, const Address&);
+};
+
+}
+
+#endif // not _MAILER_H
+
diff --git a/include/mailutils/cpp/mailutils.h b/include/mailutils/cpp/mailutils.h
new file mode 100644
index 000000000..d7f5bde56
--- /dev/null
+++ b/include/mailutils/cpp/mailutils.h
@@ -0,0 +1,33 @@
+/*
+ GNU Mailutils -- a suite of utilities for electronic mail
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include <mailutils/cpp/address.h>
+#include <mailutils/cpp/error.h>
+#include <mailutils/cpp/filter.h>
+#include <mailutils/cpp/header.h>
+#include <mailutils/cpp/iterator.h>
+#include <mailutils/cpp/list.h>
+#include <mailutils/cpp/mailbox.h>
+#include <mailutils/cpp/mailcap.h>
+#include <mailutils/cpp/mailer.h>
+#include <mailutils/cpp/message.h>
+#include <mailutils/cpp/pop3.h>
+#include <mailutils/cpp/stream.h>
+#include <mailutils/cpp/url.h>
+
diff --git a/include/mailutils/cpp/message.h b/include/mailutils/cpp/message.h
new file mode 100644
index 000000000..bf294558c
--- /dev/null
+++ b/include/mailutils/cpp/message.h
@@ -0,0 +1,46 @@
+/*
+ GNU Mailutils -- a suite of utilities for electronic mail
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef _MESSAGE_H
+#define _MESSAGE_H
+
+#include <mailutils/message.h>
+#include <mailutils/cpp/header.h>
+
+namespace mailutils
+{
+
+class Message
+{
+ protected:
+ message_t msg;
+
+ friend class Mailer;
+
+ public:
+ Message ();
+ Message (const message_t);
+
+ Header& GetHeader ();
+};
+
+}
+
+#endif // not _MESSAGE_H
+
diff --git a/include/mailutils/cpp/pop3.h b/include/mailutils/cpp/pop3.h
new file mode 100644
index 000000000..dbd381311
--- /dev/null
+++ b/include/mailutils/cpp/pop3.h
@@ -0,0 +1,72 @@
+/*
+ GNU Mailutils -- a suite of utilities for electronic mail
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef _POP3_H
+#define _POP3_H
+
+#include <iostream>
+#include <mailutils/pop3.h>
+#include <mailutils/cpp/list.h>
+#include <mailutils/cpp/stream.h>
+
+namespace mailutils
+{
+
+class Pop3
+{
+ protected:
+ mu_pop3_t pop3;
+ Stream* pStream;
+
+ public:
+ Pop3 ();
+ Pop3 (const mu_pop3_t);
+ ~Pop3 ();
+
+ void SetCarrier (const Stream&);
+ Stream& GetCarrier ();
+ void Connect ();
+ void Disconnect ();
+ void SetTimeout (int);
+ int GetTimeout ();
+
+ void Stls ();
+ Iterator& Capa ();
+ void Dele (unsigned int);
+ size_t List (unsigned int);
+ Iterator& ListAll ();
+ void Noop ();
+ void Pass (const char*);
+ void Quit ();
+ Stream& Retr (unsigned int);
+ void Rset ();
+ void Stat (unsigned int*, size_t*);
+ Stream& Top (unsigned int, unsigned int);
+ void User (const char*);
+
+ size_t ReadLine (char*, size_t);
+ size_t Response (char*, size_t);
+ void SendLine (const char*);
+ void Send ();
+};
+
+}
+
+#endif // not _POP3_H
+
diff --git a/include/mailutils/cpp/stream.h b/include/mailutils/cpp/stream.h
new file mode 100644
index 000000000..583f388f0
--- /dev/null
+++ b/include/mailutils/cpp/stream.h
@@ -0,0 +1,128 @@
+/*
+ GNU Mailutils -- a suite of utilities for electronic mail
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef _STREAM_H
+#define _STREAM_H
+
+#include <iostream>
+#include <string>
+#include <cstdio>
+#include <mailutils/stream.h>
+#include <mailutils/cpp/error.h>
+
+namespace mailutils
+{
+
+class Stream
+{
+ protected:
+ stream_t stm;
+ size_t readn;
+ size_t writen;
+ int wflags;
+ bool opened;
+ size_t reference_count;
+
+ // Inlines
+ void reference () {
+ reference_count++;
+ }
+ bool dereference () {
+ return --reference_count == 0;
+ }
+
+ // Friends
+ friend class FilterStream;
+ friend class FilterProgStream;
+ friend class Mailcap;
+ friend class Pop3;
+
+ public:
+ Stream ();
+ Stream (Stream& s);
+ Stream (const stream_t);
+ ~Stream ();
+
+ void Open ();
+ void Close ();
+ void SetWaitFlags (int);
+ void Wait (); // timeval is missing
+ void Wait (int); // timeval is missing
+ void Read (char*, size_t, off_t);
+ void Write (const std::string&, size_t, off_t);
+ void ReadLine (char*, size_t, off_t);
+ void SequentialReadLine (char*, size_t);
+ void SequentialWrite (const std::string&, size_t);
+ void Flush ();
+
+ // Inlines
+ size_t GetReadn () const {
+ return readn;
+ };
+ size_t GetWriten () const {
+ return writen;
+ };
+
+ friend Stream& operator << (Stream&, const std::string&);
+ friend Stream& operator >> (Stream&, std::string&);
+
+ // Stream Exceptions
+ class EAgain : public Exception {
+ public:
+ EAgain (const std::string& m, int s) : Exception (m, s) {}
+ };
+};
+
+class TcpStream : public Stream
+{
+ public:
+ TcpStream (const std::string&, int, int);
+};
+
+class FileStream : public Stream
+{
+ public:
+ FileStream (const std::string&, int);
+};
+
+class StdioStream : public Stream
+{
+ public:
+ StdioStream (FILE*, int);
+};
+
+class ProgStream : public Stream
+{
+ public:
+ ProgStream (const std::string&, int);
+};
+
+class FilterProgStream : public Stream
+{
+ private:
+ Stream *input;
+ public:
+ FilterProgStream (const std::string&, Stream&);
+ FilterProgStream (const std::string&, Stream*);
+};
+
+}
+
+#endif // not _STREAM_H
+
diff --git a/include/mailutils/cpp/url.h b/include/mailutils/cpp/url.h
new file mode 100644
index 000000000..db24d157f
--- /dev/null
+++ b/include/mailutils/cpp/url.h
@@ -0,0 +1,58 @@
+/*
+ GNU Mailutils -- a suite of utilities for electronic mail
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#ifndef _URL_H
+#define _URL_H
+
+#include <iostream>
+#include <string>
+#include <mailutils/url.h>
+
+namespace mailutils
+{
+
+class Url
+{
+ private:
+ char buf[1024];
+
+ protected:
+ url_t url;
+
+ public:
+ Url (const std::string&);
+ Url (const char*);
+ Url (const url_t);
+ ~Url ();
+
+ void Parse ();
+ long GetPort ();
+ std::string GetScheme ();
+ std::string GetUser ();
+ std::string GetPasswd ();
+ std::string GetAuth ();
+ std::string GetHost ();
+ std::string GetPath ();
+ std::string GetQuery ();
+};
+
+}
+
+#endif // not _URL_H
+

Return to:

Send suggestions and report system problems to the System administrator.