Updated to the current API 1.0
Showing
13 changed files
with
355 additions
and
343 deletions
... | @@ -14,7 +14,8 @@ | ... | @@ -14,7 +14,8 @@ |
14 | ## | 14 | ## |
15 | ## You should have received a copy of the GNU General Public License | 15 | ## You should have received a copy of the GNU General Public License |
16 | ## along with this program; if not, write to the Free Software | 16 | ## along with this program; if not, write to the Free Software |
17 | ## Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | ## Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA |
18 | ## 02110-1301 USA | ||
18 | 19 | ||
19 | INCLUDES = @MU_COMMON_INCLUDES@ @INTLINCS@ | 20 | INCLUDES = @MU_COMMON_INCLUDES@ @INTLINCS@ |
20 | 21 | ||
... | @@ -36,7 +37,6 @@ libmu_cpp_la_SOURCES = \ | ... | @@ -36,7 +37,6 @@ libmu_cpp_la_SOURCES = \ |
36 | stream.cc\ | 37 | stream.cc\ |
37 | url.cc | 38 | url.cc |
38 | 39 | ||
39 | libmu_cpp_la_DEPENDENCIES = @MU_LTLIBOBJS@ | 40 | libmu_cpp_la_LIBADD = @MU_COMMON_LIBRARIES@ |
40 | libmu_cpp_la_LIBADD = @MU_LTLIBOBJS@ @MU_COMMON_LIBRARIES@ | ||
41 | libmu_cpp_la_LDFLAGS = -version-info @VI_CURRENT@:@VI_REVISION@:@VI_AGE@ | 41 | libmu_cpp_la_LDFLAGS = -version-info @VI_CURRENT@:@VI_REVISION@:@VI_AGE@ |
42 | 42 | ... | ... |
1 | /* | 1 | /* |
2 | GNU Mailutils -- a suite of utilities for electronic mail | 2 | GNU Mailutils -- a suite of utilities for electronic mail |
3 | Copyright (C) 2004 Free Software Foundation, Inc. | 3 | Copyright (C) 2004, 2006 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public |
... | @@ -12,9 +12,10 @@ | ... | @@ -12,9 +12,10 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. | 13 | Lesser General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Lesser General Public | 15 | You should have received a copy of the GNU Lesser General |
16 | License along with this library; if not, write to the Free Software | 16 | Public License along with this library; if not, write to the |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301 USA | ||
18 | */ | 19 | */ |
19 | 20 | ||
20 | #include <mailutils/cpp/address.h> | 21 | #include <mailutils/cpp/address.h> |
... | @@ -29,12 +30,12 @@ using namespace mailutils; | ... | @@ -29,12 +30,12 @@ using namespace mailutils; |
29 | 30 | ||
30 | Address :: Address (const std::string& str) | 31 | Address :: Address (const std::string& str) |
31 | { | 32 | { |
32 | int status = address_create (&addr, str.c_str ()); | 33 | int status = mu_address_create (&addr, str.c_str ()); |
33 | if (status) | 34 | if (status) |
34 | throw Exception ("Address::Address", status); | 35 | throw Exception ("Address::Address", status); |
35 | } | 36 | } |
36 | 37 | ||
37 | Address :: Address (const address_t addr) | 38 | Address :: Address (const mu_address_t addr) |
38 | { | 39 | { |
39 | if (addr == 0) | 40 | if (addr == 0) |
40 | throw Exception ("Address::Address", EINVAL); | 41 | throw Exception ("Address::Address", EINVAL); |
... | @@ -44,14 +45,14 @@ Address :: Address (const address_t addr) | ... | @@ -44,14 +45,14 @@ Address :: Address (const address_t addr) |
44 | 45 | ||
45 | Address :: ~Address () | 46 | Address :: ~Address () |
46 | { | 47 | { |
47 | address_destroy (&addr); | 48 | mu_address_destroy (&addr); |
48 | } | 49 | } |
49 | 50 | ||
50 | bool | 51 | bool |
51 | Address :: IsGroup (size_t n) | 52 | Address :: isGroup (size_t n) |
52 | { | 53 | { |
53 | int isgroup; | 54 | int isgroup; |
54 | int status = address_is_group (addr, n, &isgroup); | 55 | int status = mu_address_is_group (addr, n, &isgroup); |
55 | if (status == EINVAL) | 56 | if (status == EINVAL) |
56 | throw Address::EInval ("Address::IsGroup", status); | 57 | throw Address::EInval ("Address::IsGroup", status); |
57 | else if (status == ENOENT) | 58 | else if (status == ENOENT) |
... | @@ -61,81 +62,81 @@ Address :: IsGroup (size_t n) | ... | @@ -61,81 +62,81 @@ Address :: IsGroup (size_t n) |
61 | } | 62 | } |
62 | 63 | ||
63 | size_t | 64 | size_t |
64 | Address :: GetCount () | 65 | Address :: getCount () |
65 | { | 66 | { |
66 | size_t count; | 67 | size_t count; |
67 | address_get_count (addr, &count); | 68 | mu_address_get_count (addr, &count); |
68 | return count; | 69 | return count; |
69 | } | 70 | } |
70 | 71 | ||
71 | std::string | 72 | std::string |
72 | Address :: GetEmail (size_t n) | 73 | Address :: getEmail (size_t n) |
73 | { | 74 | { |
74 | int status = address_get_email (addr, n, buf, sizeof (buf), 0); | 75 | int status = mu_address_get_email (addr, n, buf, sizeof (buf), 0); |
75 | if (status == EINVAL) | 76 | if (status == EINVAL) |
76 | throw Address::EInval ("Address::GetEmail", status); | 77 | throw Address::EInval ("Address::getEmail", status); |
77 | else if (status == ENOENT) | 78 | else if (status == ENOENT) |
78 | throw Address::ENoent ("Address::GetEmail", status); | 79 | throw Address::ENoent ("Address::getEmail", status); |
79 | 80 | ||
80 | return std::string (buf); | 81 | return std::string (buf); |
81 | } | 82 | } |
82 | 83 | ||
83 | std::string | 84 | std::string |
84 | Address :: GetLocalPart (size_t n) | 85 | Address :: getLocalPart (size_t n) |
85 | { | 86 | { |
86 | int status = address_get_local_part (addr, n, buf, sizeof (buf), 0); | 87 | int status = mu_address_get_local_part (addr, n, buf, sizeof (buf), 0); |
87 | if (status == EINVAL) | 88 | if (status == EINVAL) |
88 | throw Address::EInval ("Address::GetLocalPart", status); | 89 | throw Address::EInval ("Address::getLocalPart", status); |
89 | else if (status == ENOENT) | 90 | else if (status == ENOENT) |
90 | throw Address::ENoent ("Address::GetLocalPart", status); | 91 | throw Address::ENoent ("Address::getLocalPart", status); |
91 | 92 | ||
92 | return std::string (buf); | 93 | return std::string (buf); |
93 | } | 94 | } |
94 | 95 | ||
95 | std::string | 96 | std::string |
96 | Address :: GetDomain (size_t n) | 97 | Address :: getDomain (size_t n) |
97 | { | 98 | { |
98 | int status = address_get_domain (addr, n, buf, sizeof (buf), 0); | 99 | int status = mu_address_get_domain (addr, n, buf, sizeof (buf), 0); |
99 | if (status == EINVAL) | 100 | if (status == EINVAL) |
100 | throw Address::EInval ("Address::GetDomain", status); | 101 | throw Address::EInval ("Address::getDomain", status); |
101 | else if (status == ENOENT) | 102 | else if (status == ENOENT) |
102 | throw Address::ENoent ("Address::GetDomain", status); | 103 | throw Address::ENoent ("Address::getDomain", status); |
103 | 104 | ||
104 | return std::string (buf); | 105 | return std::string (buf); |
105 | } | 106 | } |
106 | 107 | ||
107 | std::string | 108 | std::string |
108 | Address :: GetPersonal (size_t n) | 109 | Address :: getPersonal (size_t n) |
109 | { | 110 | { |
110 | int status = address_get_personal (addr, n, buf, sizeof (buf), 0); | 111 | int status = mu_address_get_personal (addr, n, buf, sizeof (buf), 0); |
111 | if (status == EINVAL) | 112 | if (status == EINVAL) |
112 | throw Address::EInval ("Address::GetPersonal", status); | 113 | throw Address::EInval ("Address::getPersonal", status); |
113 | else if (status == ENOENT) | 114 | else if (status == ENOENT) |
114 | throw Address::ENoent ("Address::GetPersonal", status); | 115 | throw Address::ENoent ("Address::getPersonal", status); |
115 | 116 | ||
116 | return std::string (buf); | 117 | return std::string (buf); |
117 | } | 118 | } |
118 | 119 | ||
119 | std::string | 120 | std::string |
120 | Address :: GetComments (size_t n) | 121 | Address :: getComments (size_t n) |
121 | { | 122 | { |
122 | int status = address_get_comments (addr, n, buf, sizeof (buf), 0); | 123 | int status = mu_address_get_comments (addr, n, buf, sizeof (buf), 0); |
123 | if (status == EINVAL) | 124 | if (status == EINVAL) |
124 | throw Address::EInval ("Address::GetComments", status); | 125 | throw Address::EInval ("Address::getComments", status); |
125 | else if (status == ENOENT) | 126 | else if (status == ENOENT) |
126 | throw Address::ENoent ("Address::GetComments", status); | 127 | throw Address::ENoent ("Address::getComments", status); |
127 | 128 | ||
128 | return std::string (buf); | 129 | return std::string (buf); |
129 | } | 130 | } |
130 | 131 | ||
131 | std::string | 132 | std::string |
132 | Address :: GetRoute (size_t n) | 133 | Address :: getRoute (size_t n) |
133 | { | 134 | { |
134 | int status = address_get_route (addr, n, buf, sizeof (buf), 0); | 135 | int status = mu_address_get_route (addr, n, buf, sizeof (buf), 0); |
135 | if (status == EINVAL) | 136 | if (status == EINVAL) |
136 | throw Address::EInval ("Address::GetRoute", status); | 137 | throw Address::EInval ("Address::getRoute", status); |
137 | else if (status == ENOENT) | 138 | else if (status == ENOENT) |
138 | throw Address::ENoent ("Address::GetRoute", status); | 139 | throw Address::ENoent ("Address::getRoute", status); |
139 | 140 | ||
140 | return std::string (buf); | 141 | return std::string (buf); |
141 | } | 142 | } | ... | ... |
1 | /* | 1 | /* |
2 | GNU Mailutils -- a suite of utilities for electronic mail | 2 | GNU Mailutils -- a suite of utilities for electronic mail |
3 | Copyright (C) 2004 Free Software Foundation, Inc. | 3 | Copyright (C) 2004, 2006 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public |
... | @@ -12,9 +12,10 @@ | ... | @@ -12,9 +12,10 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. | 13 | Lesser General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Lesser General Public | 15 | You should have received a copy of the GNU Lesser General |
16 | License along with this library; if not, write to the Free Software | 16 | Public License along with this library; if not, write to the |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301 USA | ||
18 | */ | 19 | */ |
19 | 20 | ||
20 | #include <mailutils/cpp/filter.h> | 21 | #include <mailutils/cpp/filter.h> |
... | @@ -26,32 +27,32 @@ using namespace mailutils; | ... | @@ -26,32 +27,32 @@ using namespace mailutils; |
26 | // | 27 | // |
27 | 28 | ||
28 | void | 29 | void |
29 | FilterStream :: Create (Stream& transport, | 30 | FilterStream :: create (Stream& transport, |
30 | const std::string& code, | 31 | const std::string& code, |
31 | int mode, int flag) | 32 | int mode, int flag) |
32 | { | 33 | { |
33 | int status = filter_create (&this->stm, | 34 | int status = mu_filter_create (&this->stm, |
34 | transport.stm, | 35 | transport.stm, |
35 | code.c_str (), | 36 | code.c_str (), |
36 | mode, flag); | 37 | mode, flag); |
37 | if (status) | 38 | if (status) |
38 | throw Exception ("FilterStream::Create", status); | 39 | throw Exception ("FilterStream::create", status); |
39 | this->input = new Stream (transport); | 40 | this->input = new Stream (transport); |
40 | } | 41 | } |
41 | 42 | ||
42 | void | 43 | void |
43 | FilterStream :: IconvCreate (Stream& transport, | 44 | FilterStream :: iconvCreate (Stream& transport, |
44 | const std::string& fromcode, | 45 | const std::string& fromcode, |
45 | const std::string& tocode, | 46 | const std::string& tocode, |
46 | int flags, | 47 | int flags, |
47 | enum mu_iconv_fallback_mode fallback_mode) | 48 | enum mu_iconv_fallback_mode fallback_mode) |
48 | { | 49 | { |
49 | int status = filter_iconv_create (&this->stm, transport.stm, | 50 | int status = mu_filter_iconv_create (&this->stm, transport.stm, |
50 | fromcode.c_str (), | 51 | fromcode.c_str (), |
51 | tocode.c_str (), | 52 | tocode.c_str (), |
52 | flags, fallback_mode); | 53 | flags, fallback_mode); |
53 | if (status) | 54 | if (status) |
54 | throw Exception ("FilterStream::IconvCreate", status); | 55 | throw Exception ("FilterStream::iconvCreate", status); |
55 | this->input = new Stream (transport); | 56 | this->input = new Stream (transport); |
56 | } | 57 | } |
57 | 58 | ... | ... |
1 | /* | 1 | /* |
2 | GNU Mailutils -- a suite of utilities for electronic mail | 2 | GNU Mailutils -- a suite of utilities for electronic mail |
3 | Copyright (C) 2004 Free Software Foundation, Inc. | 3 | Copyright (C) 2004, 2006 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public |
... | @@ -12,9 +12,10 @@ | ... | @@ -12,9 +12,10 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. | 13 | Lesser General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Lesser General Public | 15 | You should have received a copy of the GNU Lesser General |
16 | License along with this library; if not, write to the Free Software | 16 | Public License along with this library; if not, write to the |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301 USA | ||
18 | */ | 19 | */ |
19 | 20 | ||
20 | #include <mailutils/cpp/header.h> | 21 | #include <mailutils/cpp/header.h> |
... | @@ -31,7 +32,7 @@ Header :: Header () | ... | @@ -31,7 +32,7 @@ Header :: Header () |
31 | { | 32 | { |
32 | } | 33 | } |
33 | 34 | ||
34 | Header :: Header (const header_t hdr) | 35 | Header :: Header (const mu_header_t hdr) |
35 | { | 36 | { |
36 | if (hdr == 0) | 37 | if (hdr == 0) |
37 | throw Exception ("Header::Header", EINVAL); | 38 | throw Exception ("Header::Header", EINVAL); |
... | @@ -40,13 +41,13 @@ Header :: Header (const header_t hdr) | ... | @@ -40,13 +41,13 @@ Header :: Header (const header_t hdr) |
40 | } | 41 | } |
41 | 42 | ||
42 | std::string | 43 | std::string |
43 | Header :: GetValue (const std::string& name) | 44 | Header :: getValue (const std::string& name) |
44 | { | 45 | { |
45 | char* c_val; | 46 | char* c_val; |
46 | 47 | ||
47 | int status = header_aget_value (hdr, name.c_str (), &c_val); | 48 | int status = mu_header_aget_value (hdr, name.c_str (), &c_val); |
48 | if (status) | 49 | if (status) |
49 | throw Exception ("Header::GetValue", status); | 50 | throw Exception ("Header::getValue", status); |
50 | 51 | ||
51 | std::string val (c_val); | 52 | std::string val (c_val); |
52 | free (c_val); | 53 | free (c_val); |
... | @@ -56,6 +57,6 @@ Header :: GetValue (const std::string& name) | ... | @@ -56,6 +57,6 @@ Header :: GetValue (const std::string& name) |
56 | std::string | 57 | std::string |
57 | Header :: operator [] (const std::string& name) | 58 | Header :: operator [] (const std::string& name) |
58 | { | 59 | { |
59 | return this->GetValue (name); | 60 | return this->getValue (name); |
60 | } | 61 | } |
61 | 62 | ... | ... |
1 | /* | 1 | /* |
2 | GNU Mailutils -- a suite of utilities for electronic mail | 2 | GNU Mailutils -- a suite of utilities for electronic mail |
3 | Copyright (C) 2004 Free Software Foundation, Inc. | 3 | Copyright (C) 2004, 2006 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public |
... | @@ -12,9 +12,10 @@ | ... | @@ -12,9 +12,10 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. | 13 | Lesser General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Lesser General Public | 15 | You should have received a copy of the GNU Lesser General |
16 | License along with this library; if not, write to the Free Software | 16 | Public License along with this library; if not, write to the |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301 USA | ||
18 | */ | 19 | */ |
19 | 20 | ||
20 | #include <mailutils/cpp/iterator.h> | 21 | #include <mailutils/cpp/iterator.h> |
... | @@ -29,14 +30,14 @@ using namespace mailutils; | ... | @@ -29,14 +30,14 @@ using namespace mailutils; |
29 | 30 | ||
30 | Iterator :: Iterator (const List& lst) | 31 | Iterator :: Iterator (const List& lst) |
31 | { | 32 | { |
32 | int status = list_get_iterator (lst.mu_list, &mu_iter); | 33 | int status = mu_list_get_iterator (lst.mu_list, &mu_iter); |
33 | if (status) | 34 | if (status) |
34 | throw Exception ("Iterator::Iterator", status); | 35 | throw Exception ("Iterator::Iterator", status); |
35 | 36 | ||
36 | this->pList = (List*) &lst; | 37 | this->pList = (List*) &lst; |
37 | } | 38 | } |
38 | 39 | ||
39 | Iterator :: Iterator (const iterator_t iter) | 40 | Iterator :: Iterator (const mu_iterator_t iter) |
40 | { | 41 | { |
41 | if (iter == 0) | 42 | if (iter == 0) |
42 | throw Exception ("Iterator::Iterator", EINVAL); | 43 | throw Exception ("Iterator::Iterator", EINVAL); |
... | @@ -47,70 +48,70 @@ Iterator :: Iterator (const iterator_t iter) | ... | @@ -47,70 +48,70 @@ Iterator :: Iterator (const iterator_t iter) |
47 | 48 | ||
48 | Iterator :: ~Iterator () | 49 | Iterator :: ~Iterator () |
49 | { | 50 | { |
50 | iterator_destroy (&mu_iter); | 51 | mu_iterator_destroy (&mu_iter); |
51 | } | 52 | } |
52 | 53 | ||
53 | void | 54 | void |
54 | Iterator :: First () | 55 | Iterator :: first () |
55 | { | 56 | { |
56 | iterator_first (mu_iter); | 57 | mu_iterator_first (mu_iter); |
57 | } | 58 | } |
58 | 59 | ||
59 | void | 60 | void |
60 | Iterator :: Next () | 61 | Iterator :: next () |
61 | { | 62 | { |
62 | iterator_next (mu_iter); | 63 | mu_iterator_next (mu_iter); |
63 | } | 64 | } |
64 | 65 | ||
65 | Iterator& | 66 | Iterator& |
66 | Iterator :: operator ++ (int) | 67 | Iterator :: operator ++ (int) |
67 | { | 68 | { |
68 | iterator_next (mu_iter); | 69 | mu_iterator_next (mu_iter); |
69 | return *this; | 70 | return *this; |
70 | } | 71 | } |
71 | 72 | ||
72 | void | 73 | void |
73 | Iterator :: Current (void** pitem) | 74 | Iterator :: current (void** pitem) |
74 | { | 75 | { |
75 | int status = iterator_current (mu_iter, pitem); | 76 | int status = mu_iterator_current (mu_iter, pitem); |
76 | if (status) | 77 | if (status) |
77 | throw Exception ("Iterator::Current", status); | 78 | throw Exception ("Iterator::current", status); |
78 | } | 79 | } |
79 | 80 | ||
80 | void* | 81 | void* |
81 | Iterator :: Current () | 82 | Iterator :: current () |
82 | { | 83 | { |
83 | void* pitem; | 84 | void* pitem; |
84 | 85 | ||
85 | int status = iterator_current (mu_iter, &pitem); | 86 | int status = mu_iterator_current (mu_iter, &pitem); |
86 | if (status) | 87 | if (status) |
87 | throw Exception ("Iterator::Current", status); | 88 | throw Exception ("Iterator::current", status); |
88 | 89 | ||
89 | return pitem; | 90 | return pitem; |
90 | } | 91 | } |
91 | 92 | ||
92 | bool | 93 | bool |
93 | Iterator :: IsDone () | 94 | Iterator :: isDone () |
94 | { | 95 | { |
95 | return (bool) iterator_is_done (mu_iter); | 96 | return (bool) mu_iterator_is_done (mu_iter); |
96 | } | 97 | } |
97 | 98 | ||
98 | List& | 99 | List& |
99 | Iterator :: GetList () | 100 | Iterator :: getList () |
100 | { | 101 | { |
101 | if (!pList) | 102 | if (!pList) |
102 | throw Exception ("Iterator::GetList", ENOTSUP); | 103 | throw Exception ("Iterator::getList", ENOTSUP); |
103 | return *pList; | 104 | return *pList; |
104 | } | 105 | } |
105 | 106 | ||
106 | void | 107 | void |
107 | Iterator :: Dup (Iterator*& piter, const Iterator& orig) | 108 | Iterator :: dup (Iterator*& piter, const Iterator& orig) |
108 | { | 109 | { |
109 | iterator_t iter; | 110 | mu_iterator_t iter; |
110 | 111 | ||
111 | int status = iterator_dup (&iter, orig.mu_iter); | 112 | int status = mu_iterator_dup (&iter, orig.mu_iter); |
112 | if (status) | 113 | if (status) |
113 | throw Exception ("Iterator::Dup", status); | 114 | throw Exception ("Iterator::dup", status); |
114 | 115 | ||
115 | piter->mu_iter = iter; | 116 | piter->mu_iter = iter; |
116 | } | 117 | } | ... | ... |
1 | /* | 1 | /* |
2 | GNU Mailutils -- a suite of utilities for electronic mail | 2 | GNU Mailutils -- a suite of utilities for electronic mail |
3 | Copyright (C) 2004 Free Software Foundation, Inc. | 3 | Copyright (C) 2004, 2006 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public |
... | @@ -12,9 +12,10 @@ | ... | @@ -12,9 +12,10 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. | 13 | Lesser General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Lesser General Public | 15 | You should have received a copy of the GNU Lesser General |
16 | License along with this library; if not, write to the Free Software | 16 | Public License along with this library; if not, write to the |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301 USA | ||
18 | */ | 19 | */ |
19 | 20 | ||
20 | #include <mailutils/cpp/list.h> | 21 | #include <mailutils/cpp/list.h> |
... | @@ -29,12 +30,12 @@ using namespace mailutils; | ... | @@ -29,12 +30,12 @@ using namespace mailutils; |
29 | 30 | ||
30 | List :: List () | 31 | List :: List () |
31 | { | 32 | { |
32 | int status = list_create (&mu_list); | 33 | int status = mu_list_create (&mu_list); |
33 | if (status) | 34 | if (status) |
34 | throw Exception ("List::List", status); | 35 | throw Exception ("List::List", status); |
35 | } | 36 | } |
36 | 37 | ||
37 | List :: List (const list_t lst) | 38 | List :: List (const mu_list_t lst) |
38 | { | 39 | { |
39 | if (lst == 0) | 40 | if (lst == 0) |
40 | throw Exception ("List::List", EINVAL); | 41 | throw Exception ("List::List", EINVAL); |
... | @@ -44,65 +45,65 @@ List :: List (const list_t lst) | ... | @@ -44,65 +45,65 @@ List :: List (const list_t lst) |
44 | 45 | ||
45 | List :: ~List () | 46 | List :: ~List () |
46 | { | 47 | { |
47 | list_destroy (&mu_list); | 48 | mu_list_destroy (&mu_list); |
48 | } | 49 | } |
49 | 50 | ||
50 | void | 51 | void |
51 | List :: Append (void* item) | 52 | List :: append (void* item) |
52 | { | 53 | { |
53 | int status = list_append (mu_list, item); | 54 | int status = mu_list_append (mu_list, item); |
54 | if (status) | 55 | if (status) |
55 | throw Exception ("List::Append", status); | 56 | throw Exception ("List::append", status); |
56 | } | 57 | } |
57 | 58 | ||
58 | void | 59 | void |
59 | List :: Prepend (void* item) | 60 | List :: prepend (void* item) |
60 | { | 61 | { |
61 | int status = list_prepend (mu_list, item); | 62 | int status = mu_list_prepend (mu_list, item); |
62 | if (status) | 63 | if (status) |
63 | throw Exception ("List::Prepend", status); | 64 | throw Exception ("List::prepend", status); |
64 | } | 65 | } |
65 | 66 | ||
66 | void | 67 | void |
67 | List :: Insert (void* item, void* new_item) | 68 | List :: insert (void* item, void* new_item, int insert_before) |
68 | { | 69 | { |
69 | int status = list_insert (mu_list, item, new_item); | 70 | int status = mu_list_insert (mu_list, item, new_item, insert_before); |
70 | if (status) | 71 | if (status) |
71 | throw Exception ("List::Insert", status); | 72 | throw Exception ("List::insert", status); |
72 | } | 73 | } |
73 | 74 | ||
74 | void | 75 | void |
75 | List :: Remove (void* item) | 76 | List :: remove (void* item) |
76 | { | 77 | { |
77 | int status = list_remove (mu_list, item); | 78 | int status = mu_list_remove (mu_list, item); |
78 | if (status) | 79 | if (status) |
79 | throw Exception ("List::Remove", status); | 80 | throw Exception ("List::remove", status); |
80 | } | 81 | } |
81 | 82 | ||
82 | void | 83 | void |
83 | List :: Replace (void* old_item, void* new_item) | 84 | List :: replace (void* old_item, void* new_item) |
84 | { | 85 | { |
85 | int status = list_replace (mu_list, old_item, new_item); | 86 | int status = mu_list_replace (mu_list, old_item, new_item); |
86 | if (status) | 87 | if (status) |
87 | throw Exception ("List::Replace", status); | 88 | throw Exception ("List::replace", status); |
88 | } | 89 | } |
89 | 90 | ||
90 | void | 91 | void |
91 | List :: Get (size_t index, void** pitem) | 92 | List :: get (size_t index, void** pitem) |
92 | { | 93 | { |
93 | int status = list_get (mu_list, index, pitem); | 94 | int status = mu_list_get (mu_list, index, pitem); |
94 | if (status) | 95 | if (status) |
95 | throw Exception ("List::Get", status); | 96 | throw Exception ("List::get", status); |
96 | } | 97 | } |
97 | 98 | ||
98 | void* | 99 | void* |
99 | List :: Get (size_t index) | 100 | List :: get (size_t index) |
100 | { | 101 | { |
101 | void* pitem; | 102 | void* pitem; |
102 | 103 | ||
103 | int status = list_get (mu_list, index, &pitem); | 104 | int status = mu_list_get (mu_list, index, &pitem); |
104 | if (status) | 105 | if (status) |
105 | throw Exception ("List::Get", status); | 106 | throw Exception ("List::get", status); |
106 | 107 | ||
107 | return pitem; | 108 | return pitem; |
108 | } | 109 | } |
... | @@ -110,62 +111,62 @@ List :: Get (size_t index) | ... | @@ -110,62 +111,62 @@ List :: Get (size_t index) |
110 | void* | 111 | void* |
111 | List :: operator [] (size_t index) | 112 | List :: operator [] (size_t index) |
112 | { | 113 | { |
113 | return this->Get (index); | 114 | return this->get (index); |
114 | } | 115 | } |
115 | 116 | ||
116 | void | 117 | void |
117 | List :: ToArray (void** array, size_t count, size_t* pcount) | 118 | List :: toArray (void** array, size_t count, size_t* pcount) |
118 | { | 119 | { |
119 | int status = list_to_array (mu_list, array, count, pcount); | 120 | int status = mu_list_to_array (mu_list, array, count, pcount); |
120 | if (status) | 121 | if (status) |
121 | throw Exception ("List::ToArray", status); | 122 | throw Exception ("List::toArray", status); |
122 | } | 123 | } |
123 | 124 | ||
124 | void | 125 | void |
125 | List :: Locate (void* item, void** ret_item) | 126 | List :: locate (void* item, void** ret_item) |
126 | { | 127 | { |
127 | int status = list_locate (mu_list, item, ret_item); | 128 | int status = mu_list_locate (mu_list, item, ret_item); |
128 | if (status) | 129 | if (status) |
129 | throw Exception ("List::Locate", status); | 130 | throw Exception ("List::locate", status); |
130 | } | 131 | } |
131 | 132 | ||
132 | bool | 133 | bool |
133 | List :: IsEmpty () | 134 | List :: isEmpty () |
134 | { | 135 | { |
135 | return (bool) list_is_empty (mu_list); | 136 | return (bool) mu_list_is_empty (mu_list); |
136 | } | 137 | } |
137 | 138 | ||
138 | size_t | 139 | size_t |
139 | List :: Count () | 140 | List :: count () |
140 | { | 141 | { |
141 | size_t count = 0; | 142 | size_t count = 0; |
142 | 143 | ||
143 | int status = list_count (mu_list, &count); | 144 | int status = mu_list_count (mu_list, &count); |
144 | if (status) | 145 | if (status) |
145 | throw Exception ("List::Count", status); | 146 | throw Exception ("List::count", status); |
146 | 147 | ||
147 | return count; | 148 | return count; |
148 | } | 149 | } |
149 | 150 | ||
150 | void | 151 | void |
151 | List :: Do (list_action_t* action, void* cbdata) | 152 | List :: apply (mu_list_action_t* action, void* cbdata) |
152 | { | 153 | { |
153 | int status = list_do (mu_list, action, cbdata); | 154 | int status = mu_list_do (mu_list, action, cbdata); |
154 | if (status) | 155 | if (status) |
155 | throw Exception ("List::Do", status); | 156 | throw Exception ("List::apply", status); |
156 | } | 157 | } |
157 | 158 | ||
158 | list_comparator_t | 159 | mu_list_comparator_t |
159 | List :: SetComparator (list_comparator_t comp) | 160 | List :: setComparator (mu_list_comparator_t comp) |
160 | { | 161 | { |
161 | return list_set_comparator (mu_list, comp); | 162 | return mu_list_set_comparator (mu_list, comp); |
162 | } | 163 | } |
163 | 164 | ||
164 | void | 165 | void |
165 | List :: SetDestroyItem (void (*destroy_item) (void *item)) | 166 | List :: setDestroyItem (void (*mu_destroy_item) (void *item)) |
166 | { | 167 | { |
167 | int status = list_set_destroy_item (mu_list, destroy_item); | 168 | int status = mu_list_set_destroy_item (mu_list, mu_destroy_item); |
168 | if (status) | 169 | if (status) |
169 | throw Exception ("List::SetDestroyItem", status); | 170 | throw Exception ("List::setDestroyItem", status); |
170 | } | 171 | } |
171 | 172 | ... | ... |
1 | /* | 1 | /* |
2 | GNU Mailutils -- a suite of utilities for electronic mail | 2 | GNU Mailutils -- a suite of utilities for electronic mail |
3 | Copyright (C) 2004 Free Software Foundation, Inc. | 3 | Copyright (C) 2004, 2006 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public |
... | @@ -12,9 +12,10 @@ | ... | @@ -12,9 +12,10 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. | 13 | Lesser General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Lesser General Public | 15 | You should have received a copy of the GNU Lesser General |
16 | License along with this library; if not, write to the Free Software | 16 | Public License along with this library; if not, write to the |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301 USA | ||
18 | */ | 19 | */ |
19 | 20 | ||
20 | #include <mailutils/cpp/mailbox.h> | 21 | #include <mailutils/cpp/mailbox.h> |
... | @@ -29,37 +30,37 @@ using namespace mailutils; | ... | @@ -29,37 +30,37 @@ using namespace mailutils; |
29 | // | 30 | // |
30 | 31 | ||
31 | void | 32 | void |
32 | MailboxBase :: Open (int flag) | 33 | MailboxBase :: open (int flag) |
33 | { | 34 | { |
34 | int status = mailbox_open (mbox, flag); | 35 | int status = mu_mailbox_open (mbox, flag); |
35 | if (status) | 36 | if (status) |
36 | throw Exception ("MailboxBase::Open", status); | 37 | throw Exception ("MailboxBase::open", status); |
37 | } | 38 | } |
38 | 39 | ||
39 | void | 40 | void |
40 | MailboxBase :: Close () | 41 | MailboxBase :: close () |
41 | { | 42 | { |
42 | int status = mailbox_close (mbox); | 43 | int status = mu_mailbox_close (mbox); |
43 | if (status) | 44 | if (status) |
44 | throw Exception ("MailboxBase::Close", status); | 45 | throw Exception ("MailboxBase::close", status); |
45 | } | 46 | } |
46 | 47 | ||
47 | size_t | 48 | size_t |
48 | MailboxBase :: MessagesCount () | 49 | MailboxBase :: messagesCount () |
49 | { | 50 | { |
50 | size_t total; | 51 | size_t total; |
51 | mailbox_messages_count (mbox, &total); | 52 | mu_mailbox_messages_count (mbox, &total); |
52 | return total; | 53 | return total; |
53 | } | 54 | } |
54 | 55 | ||
55 | Message& | 56 | Message& |
56 | MailboxBase :: GetMessage (size_t num) | 57 | MailboxBase :: getMessage (size_t num) |
57 | { | 58 | { |
58 | message_t c_msg; | 59 | mu_message_t c_msg; |
59 | 60 | ||
60 | int status = mailbox_get_message (mbox, num, &c_msg); | 61 | int status = mu_mailbox_get_message (mbox, num, &c_msg); |
61 | if (status) | 62 | if (status) |
62 | throw Exception ("MailboxBase::GetMessage", status); | 63 | throw Exception ("MailboxBase::getMessage", status); |
63 | 64 | ||
64 | return *new Message (c_msg); | 65 | return *new Message (c_msg); |
65 | } | 66 | } |
... | @@ -67,7 +68,7 @@ MailboxBase :: GetMessage (size_t num) | ... | @@ -67,7 +68,7 @@ MailboxBase :: GetMessage (size_t num) |
67 | Message& | 68 | Message& |
68 | MailboxBase :: operator [] (size_t num) | 69 | MailboxBase :: operator [] (size_t num) |
69 | { | 70 | { |
70 | return this->GetMessage (num); | 71 | return this->getMessage (num); |
71 | } | 72 | } |
72 | 73 | ||
73 | // | 74 | // |
... | @@ -76,12 +77,12 @@ MailboxBase :: operator [] (size_t num) | ... | @@ -76,12 +77,12 @@ MailboxBase :: operator [] (size_t num) |
76 | 77 | ||
77 | Mailbox :: Mailbox (const std::string& name) | 78 | Mailbox :: Mailbox (const std::string& name) |
78 | { | 79 | { |
79 | int status = mailbox_create (&mbox, name.c_str ()); | 80 | int status = mu_mailbox_create (&mbox, name.c_str ()); |
80 | if (status) | 81 | if (status) |
81 | throw Exception ("Mailbox::Mailbox", status); | 82 | throw Exception ("Mailbox::Mailbox", status); |
82 | } | 83 | } |
83 | 84 | ||
84 | Mailbox :: Mailbox (const mailbox_t mbox) | 85 | Mailbox :: Mailbox (const mu_mailbox_t mbox) |
85 | { | 86 | { |
86 | if (mbox == 0) | 87 | if (mbox == 0) |
87 | throw Exception ("Mailbox::Mailbox", EINVAL); | 88 | throw Exception ("Mailbox::Mailbox", EINVAL); |
... | @@ -91,7 +92,7 @@ Mailbox :: Mailbox (const mailbox_t mbox) | ... | @@ -91,7 +92,7 @@ Mailbox :: Mailbox (const mailbox_t mbox) |
91 | 92 | ||
92 | Mailbox :: ~Mailbox () | 93 | Mailbox :: ~Mailbox () |
93 | { | 94 | { |
94 | mailbox_destroy (&mbox); | 95 | mu_mailbox_destroy (&mbox); |
95 | } | 96 | } |
96 | 97 | ||
97 | // | 98 | // |
... | @@ -100,12 +101,12 @@ Mailbox :: ~Mailbox () | ... | @@ -100,12 +101,12 @@ Mailbox :: ~Mailbox () |
100 | 101 | ||
101 | MailboxDefault :: MailboxDefault (const std::string& name) | 102 | MailboxDefault :: MailboxDefault (const std::string& name) |
102 | { | 103 | { |
103 | int status = mailbox_create_default (&mbox, name.c_str ()); | 104 | int status = mu_mailbox_create_default (&mbox, name.c_str ()); |
104 | if (status) | 105 | if (status) |
105 | throw Exception ("MailboxDefault::MailboxDefault", status); | 106 | throw Exception ("MailboxDefault::MailboxDefault", status); |
106 | } | 107 | } |
107 | 108 | ||
108 | MailboxDefault :: MailboxDefault (const mailbox_t mbox) | 109 | MailboxDefault :: MailboxDefault (const mu_mailbox_t mbox) |
109 | { | 110 | { |
110 | if (mbox == 0) | 111 | if (mbox == 0) |
111 | throw Exception ("MailboxDefault::MailboxDefault", EINVAL); | 112 | throw Exception ("MailboxDefault::MailboxDefault", EINVAL); |
... | @@ -115,6 +116,6 @@ MailboxDefault :: MailboxDefault (const mailbox_t mbox) | ... | @@ -115,6 +116,6 @@ MailboxDefault :: MailboxDefault (const mailbox_t mbox) |
115 | 116 | ||
116 | MailboxDefault :: ~MailboxDefault () | 117 | MailboxDefault :: ~MailboxDefault () |
117 | { | 118 | { |
118 | mailbox_destroy (&mbox); | 119 | mu_mailbox_destroy (&mbox); |
119 | } | 120 | } |
120 | 121 | ... | ... |
1 | /* | 1 | /* |
2 | GNU Mailutils -- a suite of utilities for electronic mail | 2 | GNU Mailutils -- a suite of utilities for electronic mail |
3 | Copyright (C) 2004 Free Software Foundation, Inc. | 3 | Copyright (C) 2004, 2006 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public |
... | @@ -12,9 +12,10 @@ | ... | @@ -12,9 +12,10 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. | 13 | Lesser General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Lesser General Public | 15 | You should have received a copy of the GNU Lesser General |
16 | License along with this library; if not, write to the Free Software | 16 | Public License along with this library; if not, write to the |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301 USA | ||
18 | */ | 19 | */ |
19 | 20 | ||
20 | #include <mailutils/cpp/mailcap.h> | 21 | #include <mailutils/cpp/mailcap.h> |
... | @@ -49,23 +50,23 @@ Mailcap :: ~Mailcap () | ... | @@ -49,23 +50,23 @@ Mailcap :: ~Mailcap () |
49 | } | 50 | } |
50 | 51 | ||
51 | size_t | 52 | size_t |
52 | Mailcap :: GetCount () | 53 | Mailcap :: getCount () |
53 | { | 54 | { |
54 | size_t count = 0; | 55 | size_t count = 0; |
55 | int status = mu_mailcap_entries_count (mailcap, &count); | 56 | int status = mu_mailcap_entries_count (mailcap, &count); |
56 | if (status) | 57 | if (status) |
57 | throw Exception ("Mailcap::GetCount", status); | 58 | throw Exception ("Mailcap::getCount", status); |
58 | return count; | 59 | return count; |
59 | } | 60 | } |
60 | 61 | ||
61 | MailcapEntry& | 62 | MailcapEntry& |
62 | Mailcap :: GetEntry (size_t i) | 63 | Mailcap :: getEntry (size_t i) |
63 | { | 64 | { |
64 | mu_mailcap_entry_t c_entry; | 65 | mu_mailcap_entry_t c_entry; |
65 | 66 | ||
66 | int status = mu_mailcap_get_entry (mailcap, i, &c_entry); | 67 | int status = mu_mailcap_get_entry (mailcap, i, &c_entry); |
67 | if (status) | 68 | if (status) |
68 | throw Exception ("Mailcap::GetEntry", status); | 69 | throw Exception ("Mailcap::getEntry", status); |
69 | 70 | ||
70 | MailcapEntry* entry = new MailcapEntry (c_entry); | 71 | MailcapEntry* entry = new MailcapEntry (c_entry); |
71 | return *entry; | 72 | return *entry; |
... | @@ -84,42 +85,42 @@ MailcapEntry :: MailcapEntry (mu_mailcap_entry_t entry) | ... | @@ -84,42 +85,42 @@ MailcapEntry :: MailcapEntry (mu_mailcap_entry_t entry) |
84 | } | 85 | } |
85 | 86 | ||
86 | size_t | 87 | size_t |
87 | MailcapEntry :: FieldsCount () | 88 | MailcapEntry :: fieldsCount () |
88 | { | 89 | { |
89 | size_t count = 0; | 90 | size_t count = 0; |
90 | int status = mu_mailcap_entry_fields_count (entry, &count); | 91 | int status = mu_mailcap_entry_fields_count (entry, &count); |
91 | if (status) | 92 | if (status) |
92 | throw Exception ("MailcapEntry::FieldsCount", status); | 93 | throw Exception ("MailcapEntry::fieldsCount", status); |
93 | return count; | 94 | return count; |
94 | } | 95 | } |
95 | 96 | ||
96 | std::string | 97 | std::string |
97 | MailcapEntry :: GetField (size_t i) | 98 | MailcapEntry :: getField (size_t i) |
98 | { | 99 | { |
99 | int status = mu_mailcap_entry_get_field (entry, i, buf, | 100 | int status = mu_mailcap_entry_get_field (entry, i, buf, |
100 | sizeof (buf), NULL); | 101 | sizeof (buf), NULL); |
101 | if (status) | 102 | if (status) |
102 | throw Exception ("MailcapEntry::GetField", status); | 103 | throw Exception ("MailcapEntry::getField", status); |
103 | return std::string (buf); | 104 | return std::string (buf); |
104 | } | 105 | } |
105 | 106 | ||
106 | std::string | 107 | std::string |
107 | MailcapEntry :: GetTypeField () | 108 | MailcapEntry :: getTypeField () |
108 | { | 109 | { |
109 | int status = mu_mailcap_entry_get_typefield (entry, buf, | 110 | int status = mu_mailcap_entry_get_typefield (entry, buf, |
110 | sizeof (buf), NULL); | 111 | sizeof (buf), NULL); |
111 | if (status) | 112 | if (status) |
112 | throw Exception ("MailcapEntry::GetTypeField", status); | 113 | throw Exception ("MailcapEntry::getTypeField", status); |
113 | return std::string (buf); | 114 | return std::string (buf); |
114 | } | 115 | } |
115 | 116 | ||
116 | std::string | 117 | std::string |
117 | MailcapEntry :: GetViewCommand () | 118 | MailcapEntry :: getViewCommand () |
118 | { | 119 | { |
119 | int status = mu_mailcap_entry_get_viewcommand (entry, buf, | 120 | int status = mu_mailcap_entry_get_viewcommand (entry, buf, |
120 | sizeof (buf), NULL); | 121 | sizeof (buf), NULL); |
121 | if (status) | 122 | if (status) |
122 | throw Exception ("MailcapEntry::GetViewCommand", status); | 123 | throw Exception ("MailcapEntry::getViewCommand", status); |
123 | return std::string (buf); | 124 | return std::string (buf); |
124 | } | 125 | } |
125 | 126 | ... | ... |
1 | /* | 1 | /* |
2 | GNU Mailutils -- a suite of utilities for electronic mail | 2 | GNU Mailutils -- a suite of utilities for electronic mail |
3 | Copyright (C) 2004 Free Software Foundation, Inc. | 3 | Copyright (C) 2004, 2006 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public |
... | @@ -12,9 +12,10 @@ | ... | @@ -12,9 +12,10 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. | 13 | Lesser General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Lesser General Public | 15 | You should have received a copy of the GNU Lesser General |
16 | License along with this library; if not, write to the Free Software | 16 | Public License along with this library; if not, write to the |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301 USA | ||
18 | */ | 19 | */ |
19 | 20 | ||
20 | #include <mailutils/cpp/mailer.h> | 21 | #include <mailutils/cpp/mailer.h> |
... | @@ -28,12 +29,12 @@ using namespace mailutils; | ... | @@ -28,12 +29,12 @@ using namespace mailutils; |
28 | 29 | ||
29 | Mailer :: Mailer (const std::string& url) | 30 | Mailer :: Mailer (const std::string& url) |
30 | { | 31 | { |
31 | int status = mailer_create (&mailer, url.c_str ()); | 32 | int status = mu_mailer_create (&mailer, url.c_str ()); |
32 | if (status) | 33 | if (status) |
33 | throw Exception ("Mailer::Mailer", status); | 34 | throw Exception ("Mailer::Mailer", status); |
34 | } | 35 | } |
35 | 36 | ||
36 | Mailer :: Mailer (const mailer_t mailer) | 37 | Mailer :: Mailer (const mu_mailer_t mailer) |
37 | { | 38 | { |
38 | if (mailer == 0) | 39 | if (mailer == 0) |
39 | throw Exception ("Mailer::Mailer", EINVAL); | 40 | throw Exception ("Mailer::Mailer", EINVAL); |
... | @@ -43,32 +44,32 @@ Mailer :: Mailer (const mailer_t mailer) | ... | @@ -43,32 +44,32 @@ Mailer :: Mailer (const mailer_t mailer) |
43 | 44 | ||
44 | Mailer :: ~Mailer () | 45 | Mailer :: ~Mailer () |
45 | { | 46 | { |
46 | mailer_destroy (&mailer); | 47 | mu_mailer_destroy (&mailer); |
47 | } | 48 | } |
48 | 49 | ||
49 | void | 50 | void |
50 | Mailer :: Open (int flags) | 51 | Mailer :: open (int flags) |
51 | { | 52 | { |
52 | int status = mailer_open (mailer, flags); | 53 | int status = mu_mailer_open (mailer, flags); |
53 | if (status) | 54 | if (status) |
54 | throw Exception ("Mailer::Open", status); | 55 | throw Exception ("Mailer::open", status); |
55 | } | 56 | } |
56 | 57 | ||
57 | void | 58 | void |
58 | Mailer :: Close () | 59 | Mailer :: close () |
59 | { | 60 | { |
60 | int status = mailer_close (mailer); | 61 | int status = mu_mailer_close (mailer); |
61 | if (status) | 62 | if (status) |
62 | throw Exception ("Mailer::Close", status); | 63 | throw Exception ("Mailer::close", status); |
63 | } | 64 | } |
64 | 65 | ||
65 | void | 66 | void |
66 | Mailer :: SendMessage (const Message& msg, const Address& from, | 67 | Mailer :: sendMessage (const Message& msg, const Address& from, |
67 | const Address& to) | 68 | const Address& to) |
68 | { | 69 | { |
69 | int status = mailer_send_message (mailer, msg.msg, | 70 | int status = mu_mailer_send_message (mailer, msg.msg, |
70 | from.addr, to.addr); | 71 | from.addr, to.addr); |
71 | if (status) | 72 | if (status) |
72 | throw Exception ("Mailer::SendMessage", status); | 73 | throw Exception ("Mailer::sendMessage", status); |
73 | } | 74 | } |
74 | 75 | ... | ... |
1 | /* | 1 | /* |
2 | GNU Mailutils -- a suite of utilities for electronic mail | 2 | GNU Mailutils -- a suite of utilities for electronic mail |
3 | Copyright (C) 2004 Free Software Foundation, Inc. | 3 | Copyright (C) 2004, 2006 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public |
... | @@ -12,9 +12,10 @@ | ... | @@ -12,9 +12,10 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. | 13 | Lesser General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Lesser General Public | 15 | You should have received a copy of the GNU Lesser General |
16 | License along with this library; if not, write to the Free Software | 16 | Public License along with this library; if not, write to the |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301 USA | ||
18 | */ | 19 | */ |
19 | 20 | ||
20 | #include <mailutils/cpp/message.h> | 21 | #include <mailutils/cpp/message.h> |
... | @@ -32,7 +33,7 @@ Message :: Message () | ... | @@ -32,7 +33,7 @@ Message :: Message () |
32 | { | 33 | { |
33 | } | 34 | } |
34 | 35 | ||
35 | Message :: Message (const message_t msg) | 36 | Message :: Message (const mu_message_t msg) |
36 | { | 37 | { |
37 | if (msg == 0) | 38 | if (msg == 0) |
38 | throw Exception ("Message::Message", EINVAL); | 39 | throw Exception ("Message::Message", EINVAL); |
... | @@ -41,13 +42,13 @@ Message :: Message (const message_t msg) | ... | @@ -41,13 +42,13 @@ Message :: Message (const message_t msg) |
41 | } | 42 | } |
42 | 43 | ||
43 | Header& | 44 | Header& |
44 | Message :: GetHeader () | 45 | Message :: getHeader () |
45 | { | 46 | { |
46 | header_t c_hdr; | 47 | mu_header_t c_hdr; |
47 | 48 | ||
48 | int status = message_get_header (msg, &c_hdr); | 49 | int status = mu_message_get_header (msg, &c_hdr); |
49 | if (status) | 50 | if (status) |
50 | throw Exception ("Message::GetHeader", status); | 51 | throw Exception ("Message::getHeader", status); |
51 | 52 | ||
52 | return *new Header (c_hdr); | 53 | return *new Header (c_hdr); |
53 | } | 54 | } | ... | ... |
1 | /* | 1 | /* |
2 | GNU Mailutils -- a suite of utilities for electronic mail | 2 | GNU Mailutils -- a suite of utilities for electronic mail |
3 | Copyright (C) 2004 Free Software Foundation, Inc. | 3 | Copyright (C) 2004, 2006 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public |
... | @@ -12,9 +12,10 @@ | ... | @@ -12,9 +12,10 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. | 13 | Lesser General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Lesser General Public | 15 | You should have received a copy of the GNU Lesser General |
16 | License along with this library; if not, write to the Free Software | 16 | Public License along with this library; if not, write to the |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301 USA | ||
18 | */ | 19 | */ |
19 | 20 | ||
20 | #include <mailutils/cpp/pop3.h> | 21 | #include <mailutils/cpp/pop3.h> |
... | @@ -51,214 +52,214 @@ Pop3 :: ~Pop3 () | ... | @@ -51,214 +52,214 @@ Pop3 :: ~Pop3 () |
51 | } | 52 | } |
52 | 53 | ||
53 | void | 54 | void |
54 | Pop3 :: SetCarrier (const Stream& carrier) | 55 | Pop3 :: setCarrier (const Stream& carrier) |
55 | { | 56 | { |
56 | int status = mu_pop3_set_carrier (pop3, carrier.stm); | 57 | int status = mu_pop3_set_carrier (pop3, carrier.stm); |
57 | if (status) | 58 | if (status) |
58 | throw Exception ("Pop3::SetCarrier", status); | 59 | throw Exception ("Pop3::setCarrier", status); |
59 | 60 | ||
60 | this->pStream = (Stream*) &carrier; | 61 | this->pStream = (Stream*) &carrier; |
61 | } | 62 | } |
62 | 63 | ||
63 | Stream& | 64 | Stream& |
64 | Pop3 :: GetCarrier () | 65 | Pop3 :: getCarrier () |
65 | { | 66 | { |
66 | return *pStream; | 67 | return *pStream; |
67 | } | 68 | } |
68 | 69 | ||
69 | void | 70 | void |
70 | Pop3 :: Connect () | 71 | Pop3 :: connect () |
71 | { | 72 | { |
72 | int status = mu_pop3_connect (pop3); | 73 | int status = mu_pop3_connect (pop3); |
73 | if (status) | 74 | if (status) |
74 | throw Exception ("Pop3::Connect", status); | 75 | throw Exception ("Pop3::connect", status); |
75 | } | 76 | } |
76 | 77 | ||
77 | void | 78 | void |
78 | Pop3 :: Disconnect () | 79 | Pop3 :: disconnect () |
79 | { | 80 | { |
80 | int status = mu_pop3_disconnect (pop3); | 81 | int status = mu_pop3_disconnect (pop3); |
81 | if (status) | 82 | if (status) |
82 | throw Exception ("Pop3::Disconnect", status); | 83 | throw Exception ("Pop3::disconnect", status); |
83 | } | 84 | } |
84 | 85 | ||
85 | void | 86 | void |
86 | Pop3 :: SetTimeout (int timeout) | 87 | Pop3 :: setTimeout (int timeout) |
87 | { | 88 | { |
88 | int status = mu_pop3_set_timeout (pop3, timeout); | 89 | int status = mu_pop3_set_timeout (pop3, timeout); |
89 | if (status) | 90 | if (status) |
90 | throw Exception ("Pop3::SetTimeout", status); | 91 | throw Exception ("Pop3::setTimeout", status); |
91 | } | 92 | } |
92 | 93 | ||
93 | int | 94 | int |
94 | Pop3 :: GetTimeout () | 95 | Pop3 :: getTimeout () |
95 | { | 96 | { |
96 | int timeout; | 97 | int timeout; |
97 | 98 | ||
98 | int status = mu_pop3_get_timeout (pop3, &timeout); | 99 | int status = mu_pop3_get_timeout (pop3, &timeout); |
99 | if (status) | 100 | if (status) |
100 | throw Exception ("Pop3::GetTimeout", status); | 101 | throw Exception ("Pop3::getTimeout", status); |
101 | 102 | ||
102 | return timeout; | 103 | return timeout; |
103 | } | 104 | } |
104 | 105 | ||
105 | void | 106 | void |
106 | Pop3 :: Stls () | 107 | Pop3 :: stls () |
107 | { | 108 | { |
108 | int status = mu_pop3_stls (pop3); | 109 | int status = mu_pop3_stls (pop3); |
109 | if (status) | 110 | if (status) |
110 | throw Exception ("Pop3::Stls", status); | 111 | throw Exception ("Pop3::stls", status); |
111 | } | 112 | } |
112 | 113 | ||
113 | Iterator& | 114 | Iterator& |
114 | Pop3 :: Capa () | 115 | Pop3 :: capa () |
115 | { | 116 | { |
116 | iterator_t mu_itr; | 117 | mu_iterator_t mu_itr; |
117 | 118 | ||
118 | int status = mu_pop3_capa (pop3, &mu_itr); | 119 | int status = mu_pop3_capa (pop3, &mu_itr); |
119 | if (status) | 120 | if (status) |
120 | throw Exception ("Pop3::Capa", status); | 121 | throw Exception ("Pop3::capa", status); |
121 | 122 | ||
122 | return *new Iterator (mu_itr); | 123 | return *new Iterator (mu_itr); |
123 | } | 124 | } |
124 | 125 | ||
125 | void | 126 | void |
126 | Pop3 :: Dele (unsigned int msgno) | 127 | Pop3 :: dele (unsigned int msgno) |
127 | { | 128 | { |
128 | int status = mu_pop3_dele (pop3, msgno); | 129 | int status = mu_pop3_dele (pop3, msgno); |
129 | if (status) | 130 | if (status) |
130 | throw Exception ("Pop3::Dele", status); | 131 | throw Exception ("Pop3::dele", status); |
131 | } | 132 | } |
132 | 133 | ||
133 | size_t | 134 | size_t |
134 | Pop3 :: List (unsigned int msgno) | 135 | Pop3 :: list (unsigned int msgno) |
135 | { | 136 | { |
136 | size_t msg_octet; | 137 | size_t msg_octet; |
137 | 138 | ||
138 | int status = mu_pop3_list (pop3, msgno, &msg_octet); | 139 | int status = mu_pop3_list (pop3, msgno, &msg_octet); |
139 | if (status) | 140 | if (status) |
140 | throw Exception ("Pop3::List", status); | 141 | throw Exception ("Pop3::list", status); |
141 | 142 | ||
142 | return msg_octet; | 143 | return msg_octet; |
143 | } | 144 | } |
144 | 145 | ||
145 | Iterator& | 146 | Iterator& |
146 | Pop3 :: ListAll () | 147 | Pop3 :: listAll () |
147 | { | 148 | { |
148 | iterator_t mu_itr; | 149 | mu_iterator_t mu_itr; |
149 | 150 | ||
150 | int status = mu_pop3_list_all (pop3, &mu_itr); | 151 | int status = mu_pop3_list_all (pop3, &mu_itr); |
151 | if (status) | 152 | if (status) |
152 | throw Exception ("Pop3::ListAll", status); | 153 | throw Exception ("Pop3::listAll", status); |
153 | 154 | ||
154 | return *new Iterator (mu_itr); | 155 | return *new Iterator (mu_itr); |
155 | } | 156 | } |
156 | 157 | ||
157 | void | 158 | void |
158 | Pop3 :: Noop () | 159 | Pop3 :: noop () |
159 | { | 160 | { |
160 | int status = mu_pop3_noop (pop3); | 161 | int status = mu_pop3_noop (pop3); |
161 | if (status) | 162 | if (status) |
162 | throw Exception ("Pop3::Noop", status); | 163 | throw Exception ("Pop3::noop", status); |
163 | } | 164 | } |
164 | 165 | ||
165 | void | 166 | void |
166 | Pop3 :: Pass (const char* pass) | 167 | Pop3 :: pass (const char* pass) |
167 | { | 168 | { |
168 | int status = mu_pop3_pass (pop3, pass); | 169 | int status = mu_pop3_pass (pop3, pass); |
169 | if (status) | 170 | if (status) |
170 | throw Exception ("Pop3::Pass", status); | 171 | throw Exception ("Pop3::pass", status); |
171 | } | 172 | } |
172 | 173 | ||
173 | void | 174 | void |
174 | Pop3 :: Quit () | 175 | Pop3 :: quit () |
175 | { | 176 | { |
176 | int status = mu_pop3_quit (pop3); | 177 | int status = mu_pop3_quit (pop3); |
177 | if (status) | 178 | if (status) |
178 | throw Exception ("Pop3::Quit", status); | 179 | throw Exception ("Pop3::quit", status); |
179 | } | 180 | } |
180 | 181 | ||
181 | Stream& | 182 | Stream& |
182 | Pop3 :: Retr (unsigned int msgno) | 183 | Pop3 :: retr (unsigned int msgno) |
183 | { | 184 | { |
184 | stream_t c_stm; | 185 | mu_stream_t c_stm; |
185 | 186 | ||
186 | int status = mu_pop3_retr (pop3, msgno, &c_stm); | 187 | int status = mu_pop3_retr (pop3, msgno, &c_stm); |
187 | if (status) | 188 | if (status) |
188 | throw Exception ("Pop3::Retr", status); | 189 | throw Exception ("Pop3::retr", status); |
189 | 190 | ||
190 | return *new Stream (c_stm); | 191 | return *new Stream (c_stm); |
191 | } | 192 | } |
192 | 193 | ||
193 | void | 194 | void |
194 | Pop3 :: Rset () | 195 | Pop3 :: rset () |
195 | { | 196 | { |
196 | int status = mu_pop3_rset (pop3); | 197 | int status = mu_pop3_rset (pop3); |
197 | if (status) | 198 | if (status) |
198 | throw Exception ("Pop3::Rset", status); | 199 | throw Exception ("Pop3::rset", status); |
199 | } | 200 | } |
200 | 201 | ||
201 | void | 202 | void |
202 | Pop3 :: Stat (unsigned int* count, size_t* octets) | 203 | Pop3 :: stat (unsigned int* count, size_t* octets) |
203 | { | 204 | { |
204 | int status = mu_pop3_stat (pop3, count, octets); | 205 | int status = mu_pop3_stat (pop3, count, octets); |
205 | if (status) | 206 | if (status) |
206 | throw Exception ("Pop3::Stat", status); | 207 | throw Exception ("Pop3::stat", status); |
207 | } | 208 | } |
208 | 209 | ||
209 | Stream& | 210 | Stream& |
210 | Pop3 :: Top (unsigned int msgno, unsigned int lines) | 211 | Pop3 :: top (unsigned int msgno, unsigned int lines) |
211 | { | 212 | { |
212 | stream_t c_stm; | 213 | mu_stream_t c_stm; |
213 | 214 | ||
214 | int status = mu_pop3_top (pop3, msgno, lines, &c_stm); | 215 | int status = mu_pop3_top (pop3, msgno, lines, &c_stm); |
215 | if (status) | 216 | if (status) |
216 | throw Exception ("Pop3::Top", status); | 217 | throw Exception ("Pop3::top", status); |
217 | 218 | ||
218 | return *new Stream (c_stm); | 219 | return *new Stream (c_stm); |
219 | } | 220 | } |
220 | 221 | ||
221 | void | 222 | void |
222 | Pop3 :: User (const char* user) | 223 | Pop3 :: user (const char* user) |
223 | { | 224 | { |
224 | int status = mu_pop3_user (pop3, user); | 225 | int status = mu_pop3_user (pop3, user); |
225 | if (status) | 226 | if (status) |
226 | throw Exception ("Pop3::User", status); | 227 | throw Exception ("Pop3::user", status); |
227 | } | 228 | } |
228 | 229 | ||
229 | size_t | 230 | size_t |
230 | Pop3 :: ReadLine (char* buf, size_t buflen) | 231 | Pop3 :: readLine (char* buf, size_t buflen) |
231 | { | 232 | { |
232 | size_t nread; | 233 | size_t nread; |
233 | 234 | ||
234 | int status = mu_pop3_readline (pop3, buf, buflen, &nread); | 235 | int status = mu_pop3_readline (pop3, buf, buflen, &nread); |
235 | if (status) | 236 | if (status) |
236 | throw Exception ("Pop3::ReadLine", status); | 237 | throw Exception ("Pop3::readLine", status); |
237 | } | 238 | } |
238 | 239 | ||
239 | size_t | 240 | size_t |
240 | Pop3 :: Response (char* buf, size_t buflen) | 241 | Pop3 :: response (char* buf, size_t buflen) |
241 | { | 242 | { |
242 | size_t nread; | 243 | size_t nread; |
243 | 244 | ||
244 | int status = mu_pop3_response (pop3, buf, buflen, &nread); | 245 | int status = mu_pop3_response (pop3, buf, buflen, &nread); |
245 | if (status) | 246 | if (status) |
246 | throw Exception ("Pop3::Response", status); | 247 | throw Exception ("Pop3::response", status); |
247 | } | 248 | } |
248 | 249 | ||
249 | void | 250 | void |
250 | Pop3 :: SendLine (const char* line) | 251 | Pop3 :: sendLine (const char* line) |
251 | { | 252 | { |
252 | int status = mu_pop3_sendline (pop3, line); | 253 | int status = mu_pop3_sendline (pop3, line); |
253 | if (status) | 254 | if (status) |
254 | throw Exception ("Pop3::SendLine", status); | 255 | throw Exception ("Pop3::sendLine", status); |
255 | } | 256 | } |
256 | 257 | ||
257 | void | 258 | void |
258 | Pop3 :: Send () | 259 | Pop3 :: send () |
259 | { | 260 | { |
260 | int status = mu_pop3_send (pop3); | 261 | int status = mu_pop3_send (pop3); |
261 | if (status) | 262 | if (status) |
262 | throw Exception ("Pop3::Send", status); | 263 | throw Exception ("Pop3::send", status); |
263 | } | 264 | } |
264 | 265 | ... | ... |
1 | /* | 1 | /* |
2 | GNU Mailutils -- a suite of utilities for electronic mail | 2 | GNU Mailutils -- a suite of utilities for electronic mail |
3 | Copyright (C) 2004 Free Software Foundation, Inc. | 3 | Copyright (C) 2004, 2006 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public |
... | @@ -12,9 +12,10 @@ | ... | @@ -12,9 +12,10 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. | 13 | Lesser General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Lesser General Public | 15 | You should have received a copy of the GNU Lesser General |
16 | License along with this library; if not, write to the Free Software | 16 | Public License along with this library; if not, write to the |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301 USA | ||
18 | */ | 19 | */ |
19 | 20 | ||
20 | #include <mailutils/cpp/stream.h> | 21 | #include <mailutils/cpp/stream.h> |
... | @@ -33,7 +34,7 @@ Stream :: Stream () | ... | @@ -33,7 +34,7 @@ Stream :: Stream () |
33 | reference (); | 34 | reference (); |
34 | } | 35 | } |
35 | 36 | ||
36 | Stream :: Stream (const stream_t stm) | 37 | Stream :: Stream (const mu_stream_t stm) |
37 | { | 38 | { |
38 | if (stm == 0) | 39 | if (stm == 0) |
39 | throw Exception ("Stream::Stream", EINVAL); | 40 | throw Exception ("Stream::Stream", EINVAL); |
... | @@ -53,112 +54,112 @@ Stream :: ~Stream () | ... | @@ -53,112 +54,112 @@ Stream :: ~Stream () |
53 | { | 54 | { |
54 | if (dereference ()) | 55 | if (dereference ()) |
55 | { | 56 | { |
56 | Close (); | 57 | close (); |
57 | if (this->stm) | 58 | if (this->stm) |
58 | stream_destroy (&stm, NULL); | 59 | mu_stream_destroy (&stm, NULL); |
59 | } | 60 | } |
60 | } | 61 | } |
61 | 62 | ||
62 | void | 63 | void |
63 | Stream :: Open () | 64 | Stream :: open () |
64 | { | 65 | { |
65 | int status = stream_open (stm); | 66 | int status = mu_stream_open (stm); |
66 | if (status == EAGAIN) | 67 | if (status == EAGAIN) |
67 | throw Stream::EAgain ("Stream::Open", status); | 68 | throw Stream::EAgain ("Stream::open", status); |
68 | else if (status) | 69 | else if (status) |
69 | throw Exception ("Stream::Open", status); | 70 | throw Exception ("Stream::open", status); |
70 | 71 | ||
71 | this->opened = true; | 72 | this->opened = true; |
72 | } | 73 | } |
73 | 74 | ||
74 | void | 75 | void |
75 | Stream :: Close () | 76 | Stream :: close () |
76 | { | 77 | { |
77 | if (this->opened) | 78 | if (this->opened) |
78 | { | 79 | { |
79 | int status = stream_close (stm); | 80 | int status = mu_stream_close (stm); |
80 | if (status) | 81 | if (status) |
81 | throw Exception ("Stream::Close", status); | 82 | throw Exception ("Stream::close", status); |
82 | 83 | ||
83 | this->opened = false; | 84 | this->opened = false; |
84 | } | 85 | } |
85 | } | 86 | } |
86 | 87 | ||
87 | void | 88 | void |
88 | Stream :: SetWaitFlags (int flags) | 89 | Stream :: setWaitFlags (int flags) |
89 | { | 90 | { |
90 | this->wflags = flags; | 91 | this->wflags = flags; |
91 | } | 92 | } |
92 | 93 | ||
93 | void | 94 | void |
94 | Stream :: Wait () | 95 | Stream :: wait () |
95 | { | 96 | { |
96 | int status = stream_wait (stm, &wflags, NULL); | 97 | int status = mu_stream_wait (stm, &wflags, NULL); |
97 | if (status) | 98 | if (status) |
98 | throw Exception ("Stream::Wait", status); | 99 | throw Exception ("Stream::wait", status); |
99 | } | 100 | } |
100 | 101 | ||
101 | void | 102 | void |
102 | Stream :: Wait (int flags) | 103 | Stream :: wait (int flags) |
103 | { | 104 | { |
104 | this->wflags = flags; | 105 | this->wflags = flags; |
105 | int status = stream_wait (stm, &wflags, NULL); | 106 | int status = mu_stream_wait (stm, &wflags, NULL); |
106 | if (status) | 107 | if (status) |
107 | throw Exception ("Stream::Wait", status); | 108 | throw Exception ("Stream::wait", status); |
108 | } | 109 | } |
109 | 110 | ||
110 | void | 111 | void |
111 | Stream :: Read (char* rbuf, size_t size, off_t offset) | 112 | Stream :: read (char* rbuf, size_t size, off_t offset) |
112 | { | 113 | { |
113 | int status = stream_read (stm, rbuf, size, offset, &readn); | 114 | int status = mu_stream_read (stm, rbuf, size, offset, &readn); |
114 | if (status == EAGAIN) | 115 | if (status == EAGAIN) |
115 | throw Stream::EAgain ("Stream::Read", status); | 116 | throw Stream::EAgain ("Stream::read", status); |
116 | else if (status) | 117 | else if (status) |
117 | throw Exception ("Stream::Read", status); | 118 | throw Exception ("Stream::read", status); |
118 | } | 119 | } |
119 | 120 | ||
120 | void | 121 | void |
121 | Stream :: Write (const std::string& wbuf, size_t size, off_t offset) | 122 | Stream :: write (const std::string& wbuf, size_t size, off_t offset) |
122 | { | 123 | { |
123 | int status = stream_write (stm, wbuf.c_str (), size, offset, &writen); | 124 | int status = mu_stream_write (stm, wbuf.c_str (), size, offset, &writen); |
124 | if (status == EAGAIN) | 125 | if (status == EAGAIN) |
125 | throw Stream::EAgain ("Stream::Write", status); | 126 | throw Stream::EAgain ("Stream::write", status); |
126 | else if (status) | 127 | else if (status) |
127 | throw Exception ("Stream::Write", status); | 128 | throw Exception ("Stream::write", status); |
128 | } | 129 | } |
129 | 130 | ||
130 | void | 131 | void |
131 | Stream :: ReadLine (char* rbuf, size_t size, off_t offset) | 132 | Stream :: readLine (char* rbuf, size_t size, off_t offset) |
132 | { | 133 | { |
133 | int status = stream_readline (stm, rbuf, size, offset, &readn); | 134 | int status = mu_stream_readline (stm, rbuf, size, offset, &readn); |
134 | if (status == EAGAIN) | 135 | if (status == EAGAIN) |
135 | throw Stream::EAgain ("Stream::ReadLine", status); | 136 | throw Stream::EAgain ("Stream::readLine", status); |
136 | else if (status) | 137 | else if (status) |
137 | throw Exception ("Stream::ReadLine", status); | 138 | throw Exception ("Stream::readLine", status); |
138 | } | 139 | } |
139 | 140 | ||
140 | void | 141 | void |
141 | Stream :: SequentialReadLine (char* rbuf, size_t size) | 142 | Stream :: sequentialReadLine (char* rbuf, size_t size) |
142 | { | 143 | { |
143 | int status = stream_sequential_readline (stm, rbuf, size, &readn); | 144 | int status = mu_stream_sequential_readline (stm, rbuf, size, &readn); |
144 | if (status) | 145 | if (status) |
145 | throw Exception ("Stream::SequentialReadLine", status); | 146 | throw Exception ("Stream::sequentialReadLine", status); |
146 | } | 147 | } |
147 | 148 | ||
148 | void | 149 | void |
149 | Stream :: SequentialWrite (const std::string& wbuf, size_t size) | 150 | Stream :: sequentialWrite (const std::string& wbuf, size_t size) |
150 | { | 151 | { |
151 | int status = stream_sequential_write (stm, wbuf.c_str (), size); | 152 | int status = mu_stream_sequential_write (stm, wbuf.c_str (), size); |
152 | if (status) | 153 | if (status) |
153 | throw Exception ("Stream::SequentialWrite", status); | 154 | throw Exception ("Stream::sequentialWrite", status); |
154 | } | 155 | } |
155 | 156 | ||
156 | void | 157 | void |
157 | Stream :: Flush () | 158 | Stream :: flush () |
158 | { | 159 | { |
159 | int status = stream_flush (stm); | 160 | int status = mu_stream_flush (stm); |
160 | if (status) | 161 | if (status) |
161 | throw Exception ("Stream::Flush", status); | 162 | throw Exception ("Stream::flush", status); |
162 | } | 163 | } |
163 | 164 | ||
164 | namespace mailutils | 165 | namespace mailutils |
... | @@ -166,7 +167,7 @@ namespace mailutils | ... | @@ -166,7 +167,7 @@ namespace mailutils |
166 | Stream& | 167 | Stream& |
167 | operator << (Stream& stm, const std::string& wbuf) | 168 | operator << (Stream& stm, const std::string& wbuf) |
168 | { | 169 | { |
169 | stm.Write (wbuf, wbuf.length (), 0); | 170 | stm.write (wbuf, wbuf.length (), 0); |
170 | return stm; | 171 | return stm; |
171 | } | 172 | } |
172 | 173 | ||
... | @@ -174,7 +175,7 @@ namespace mailutils | ... | @@ -174,7 +175,7 @@ namespace mailutils |
174 | operator >> (Stream& stm, std::string& rbuf) | 175 | operator >> (Stream& stm, std::string& rbuf) |
175 | { | 176 | { |
176 | char tmp[1024]; | 177 | char tmp[1024]; |
177 | stm.Read (tmp, sizeof (tmp), 0); | 178 | stm.read (tmp, sizeof (tmp), 0); |
178 | rbuf = std::string (tmp); | 179 | rbuf = std::string (tmp); |
179 | return stm; | 180 | return stm; |
180 | } | 181 | } |
... | @@ -186,7 +187,7 @@ namespace mailutils | ... | @@ -186,7 +187,7 @@ namespace mailutils |
186 | 187 | ||
187 | TcpStream :: TcpStream (const std::string& host, int port, int flags) | 188 | TcpStream :: TcpStream (const std::string& host, int port, int flags) |
188 | { | 189 | { |
189 | int status = tcp_stream_create (&stm, host.c_str (), port, flags); | 190 | int status = mu_tcp_stream_create (&stm, host.c_str (), port, flags); |
190 | if (status) | 191 | if (status) |
191 | throw Exception ("TcpStream::TcpStream", status); | 192 | throw Exception ("TcpStream::TcpStream", status); |
192 | } | 193 | } |
... | @@ -197,7 +198,7 @@ TcpStream :: TcpStream (const std::string& host, int port, int flags) | ... | @@ -197,7 +198,7 @@ TcpStream :: TcpStream (const std::string& host, int port, int flags) |
197 | 198 | ||
198 | FileStream :: FileStream (const std::string& filename, int flags) | 199 | FileStream :: FileStream (const std::string& filename, int flags) |
199 | { | 200 | { |
200 | int status = file_stream_create (&stm, filename.c_str (), flags); | 201 | int status = mu_file_stream_create (&stm, filename.c_str (), flags); |
201 | if (status) | 202 | if (status) |
202 | throw Exception ("FileStream::FileStream", status); | 203 | throw Exception ("FileStream::FileStream", status); |
203 | } | 204 | } |
... | @@ -208,7 +209,7 @@ FileStream :: FileStream (const std::string& filename, int flags) | ... | @@ -208,7 +209,7 @@ FileStream :: FileStream (const std::string& filename, int flags) |
208 | 209 | ||
209 | StdioStream :: StdioStream (FILE* fp, int flags) | 210 | StdioStream :: StdioStream (FILE* fp, int flags) |
210 | { | 211 | { |
211 | int status = stdio_stream_create (&stm, fp, flags); | 212 | int status = mu_stdio_stream_create (&stm, fp, flags); |
212 | if (status) | 213 | if (status) |
213 | throw Exception ("StdioStream::StdioStream", status); | 214 | throw Exception ("StdioStream::StdioStream", status); |
214 | } | 215 | } |
... | @@ -219,7 +220,7 @@ StdioStream :: StdioStream (FILE* fp, int flags) | ... | @@ -219,7 +220,7 @@ StdioStream :: StdioStream (FILE* fp, int flags) |
219 | 220 | ||
220 | ProgStream :: ProgStream (const std::string& progname, int flags) | 221 | ProgStream :: ProgStream (const std::string& progname, int flags) |
221 | { | 222 | { |
222 | int status = prog_stream_create (&stm, progname.c_str (), flags); | 223 | int status = mu_prog_stream_create (&stm, progname.c_str (), flags); |
223 | if (status) | 224 | if (status) |
224 | throw Exception ("ProgStream::ProgStream", status); | 225 | throw Exception ("ProgStream::ProgStream", status); |
225 | } | 226 | } |
... | @@ -231,8 +232,8 @@ ProgStream :: ProgStream (const std::string& progname, int flags) | ... | @@ -231,8 +232,8 @@ ProgStream :: ProgStream (const std::string& progname, int flags) |
231 | FilterProgStream :: FilterProgStream (const std::string& progname, | 232 | FilterProgStream :: FilterProgStream (const std::string& progname, |
232 | Stream& input) | 233 | Stream& input) |
233 | { | 234 | { |
234 | int status = filter_prog_stream_create (&stm, progname.c_str (), | 235 | int status = mu_filter_prog_stream_create (&stm, progname.c_str (), |
235 | input.stm); | 236 | input.stm); |
236 | this->input = new Stream (input); | 237 | this->input = new Stream (input); |
237 | if (status) | 238 | if (status) |
238 | throw Exception ("FilterProgStream::FilterProgStream", status); | 239 | throw Exception ("FilterProgStream::FilterProgStream", status); |
... | @@ -241,8 +242,8 @@ FilterProgStream :: FilterProgStream (const std::string& progname, | ... | @@ -241,8 +242,8 @@ FilterProgStream :: FilterProgStream (const std::string& progname, |
241 | FilterProgStream :: FilterProgStream (const std::string& progname, | 242 | FilterProgStream :: FilterProgStream (const std::string& progname, |
242 | Stream* input) | 243 | Stream* input) |
243 | { | 244 | { |
244 | int status = filter_prog_stream_create (&stm, progname.c_str (), | 245 | int status = mu_filter_prog_stream_create (&stm, progname.c_str (), |
245 | input->stm); | 246 | input->stm); |
246 | this->input = new Stream (*input); | 247 | this->input = new Stream (*input); |
247 | if (status) | 248 | if (status) |
248 | throw Exception ("FilterProgStream::FilterProgStream", status); | 249 | throw Exception ("FilterProgStream::FilterProgStream", status); | ... | ... |
1 | /* | 1 | /* |
2 | GNU Mailutils -- a suite of utilities for electronic mail | 2 | GNU Mailutils -- a suite of utilities for electronic mail |
3 | Copyright (C) 2004 Free Software Foundation, Inc. | 3 | Copyright (C) 2004, 2006 Free Software Foundation, Inc. |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Lesser General Public | 6 | modify it under the terms of the GNU Lesser General Public |
... | @@ -12,9 +12,10 @@ | ... | @@ -12,9 +12,10 @@ |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Lesser General Public License for more details. | 13 | Lesser General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Lesser General Public | 15 | You should have received a copy of the GNU Lesser General |
16 | License along with this library; if not, write to the Free Software | 16 | Public License along with this library; if not, write to the |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301 USA | ||
18 | */ | 19 | */ |
19 | 20 | ||
20 | #include <mailutils/cpp/url.h> | 21 | #include <mailutils/cpp/url.h> |
... | @@ -29,19 +30,19 @@ using namespace mailutils; | ... | @@ -29,19 +30,19 @@ using namespace mailutils; |
29 | 30 | ||
30 | Url :: Url (const std::string& str) | 31 | Url :: Url (const std::string& str) |
31 | { | 32 | { |
32 | int status = url_create (&url, str.c_str ()); | 33 | int status = mu_url_create (&url, str.c_str ()); |
33 | if (status) | 34 | if (status) |
34 | throw Exception ("Url::Url", status); | 35 | throw Exception ("Url::Url", status); |
35 | } | 36 | } |
36 | 37 | ||
37 | Url :: Url (const char* str) | 38 | Url :: Url (const char* str) |
38 | { | 39 | { |
39 | int status = url_create (&url, str); | 40 | int status = mu_url_create (&url, str); |
40 | if (status) | 41 | if (status) |
41 | throw Exception ("Url::Url", status); | 42 | throw Exception ("Url::Url", status); |
42 | } | 43 | } |
43 | 44 | ||
44 | Url :: Url (const url_t url) | 45 | Url :: Url (const mu_url_t url) |
45 | { | 46 | { |
46 | if (url == 0) | 47 | if (url == 0) |
47 | throw Exception ("Url::Url", EINVAL); | 48 | throw Exception ("Url::Url", EINVAL); |
... | @@ -51,87 +52,87 @@ Url :: Url (const url_t url) | ... | @@ -51,87 +52,87 @@ Url :: Url (const url_t url) |
51 | 52 | ||
52 | Url :: ~Url () | 53 | Url :: ~Url () |
53 | { | 54 | { |
54 | url_destroy (&url); | 55 | mu_url_destroy (&url); |
55 | } | 56 | } |
56 | 57 | ||
57 | void | 58 | void |
58 | Url :: Parse () | 59 | Url :: parse () |
59 | { | 60 | { |
60 | int status = url_parse (url); | 61 | int status = mu_url_parse (url); |
61 | if (status) | 62 | if (status) |
62 | throw Exception ("Url::Parse", status); | 63 | throw Exception ("Url::parse", status); |
63 | } | 64 | } |
64 | 65 | ||
65 | long | 66 | long |
66 | Url :: GetPort () | 67 | Url :: getPort () |
67 | { | 68 | { |
68 | long port; | 69 | long port; |
69 | int status = url_get_port (url, &port); | 70 | int status = mu_url_get_port (url, &port); |
70 | if (status) | 71 | if (status) |
71 | throw Exception ("Url::GetPort", status); | 72 | throw Exception ("Url::getPort", status); |
72 | return port; | 73 | return port; |
73 | } | 74 | } |
74 | 75 | ||
75 | std::string | 76 | std::string |
76 | Url :: GetScheme () | 77 | Url :: getScheme () |
77 | { | 78 | { |
78 | int status = url_get_scheme (url, buf, sizeof (buf), NULL); | 79 | int status = mu_url_get_scheme (url, buf, sizeof (buf), NULL); |
79 | if (status) | 80 | if (status) |
80 | throw Exception ("Url::GetScheme", status); | 81 | throw Exception ("Url::getScheme", status); |
81 | return std::string (buf); | 82 | return std::string (buf); |
82 | } | 83 | } |
83 | 84 | ||
84 | std::string | 85 | std::string |
85 | Url :: GetUser () | 86 | Url :: getUser () |
86 | { | 87 | { |
87 | int status = url_get_user (url, buf, sizeof (buf), NULL); | 88 | int status = mu_url_get_user (url, buf, sizeof (buf), NULL); |
88 | if (status) | 89 | if (status) |
89 | throw Exception ("Url::GetUser", status); | 90 | throw Exception ("Url::getUser", status); |
90 | return std::string (buf); | 91 | return std::string (buf); |
91 | } | 92 | } |
92 | 93 | ||
93 | std::string | 94 | std::string |
94 | Url :: GetPasswd () | 95 | Url :: getPasswd () |
95 | { | 96 | { |
96 | int status = url_get_passwd (url, buf, sizeof (buf), NULL); | 97 | int status = mu_url_get_passwd (url, buf, sizeof (buf), NULL); |
97 | if (status) | 98 | if (status) |
98 | throw Exception ("Url::GetPasswd", status); | 99 | throw Exception ("Url::getPasswd", status); |
99 | return std::string (buf); | 100 | return std::string (buf); |
100 | } | 101 | } |
101 | 102 | ||
102 | std::string | 103 | std::string |
103 | Url :: GetAuth () | 104 | Url :: getAuth () |
104 | { | 105 | { |
105 | int status = url_get_auth (url, buf, sizeof (buf), NULL); | 106 | int status = mu_url_get_auth (url, buf, sizeof (buf), NULL); |
106 | if (status) | 107 | if (status) |
107 | throw Exception ("Url::GetAuth", status); | 108 | throw Exception ("Url::getAuth", status); |
108 | return std::string (buf); | 109 | return std::string (buf); |
109 | } | 110 | } |
110 | 111 | ||
111 | std::string | 112 | std::string |
112 | Url :: GetHost () | 113 | Url :: getHost () |
113 | { | 114 | { |
114 | int status = url_get_host (url, buf, sizeof (buf), NULL); | 115 | int status = mu_url_get_host (url, buf, sizeof (buf), NULL); |
115 | if (status) | 116 | if (status) |
116 | throw Exception ("Url::GetHost", status); | 117 | throw Exception ("Url::getHost", status); |
117 | return std::string (buf); | 118 | return std::string (buf); |
118 | } | 119 | } |
119 | 120 | ||
120 | std::string | 121 | std::string |
121 | Url :: GetPath () | 122 | Url :: getPath () |
122 | { | 123 | { |
123 | int status = url_get_path (url, buf, sizeof (buf), NULL); | 124 | int status = mu_url_get_path (url, buf, sizeof (buf), NULL); |
124 | if (status) | 125 | if (status) |
125 | throw Exception ("Url::GetPath", status); | 126 | throw Exception ("Url::getPath", status); |
126 | return std::string (buf); | 127 | return std::string (buf); |
127 | } | 128 | } |
128 | 129 | ||
129 | std::string | 130 | std::string |
130 | Url :: GetQuery () | 131 | Url :: getQuery () |
131 | { | 132 | { |
132 | int status = url_get_query (url, buf, sizeof (buf), NULL); | 133 | int status = mu_url_get_query (url, buf, sizeof (buf), NULL); |
133 | if (status) | 134 | if (status) |
134 | throw Exception ("Url::GetQuery", status); | 135 | throw Exception ("Url::getQuery", status); |
135 | return std::string (buf); | 136 | return std::string (buf); |
136 | } | 137 | } |
137 | 138 | ... | ... |
-
Please register or sign in to post a comment