summaryrefslogtreecommitdiff
path: root/mailbox2/message.c
blob: 5c3702890975c775d177755cd953780609148032 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/* GNU mailutils - a suite of utilities for electronic mail
   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Library Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program 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 Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#include <stdlib.h>
#include <mailutils/error.h>
#include <mailutils/sys/message.h>

int
message_ref (message_t msg)
{
  if (msg == NULL || msg->vtable == NULL
      || msg->vtable->ref == NULL)
    return MU_ERROR_NOT_SUPPORTED;
  return msg->vtable->ref (msg);
}

void
message_destroy (message_t *pmsg)
{
  if (pmsg && *pmsg)
    {
      message_t msg = *pmsg;
      if (msg->vtable && msg->vtable->destroy)
	msg->vtable->destroy (pmsg);
      *pmsg = NULL;
    }
}

int
message_is_modified (message_t msg)
{
  if (msg == NULL || msg->vtable == NULL
      || msg->vtable->is_modified == NULL)
    return MU_ERROR_NOT_SUPPORTED;
  return msg->vtable->is_modified (msg);
}

int
message_clear_modified (message_t msg)
{
  if (msg == NULL || msg->vtable == NULL
      || msg->vtable->clear_modified == NULL)
    return MU_ERROR_NOT_SUPPORTED;
  return msg->vtable->clear_modified (msg);
}

int
message_get_mailbox (message_t msg, mailbox_t *mbox)
{
  if (msg == NULL || msg->vtable == NULL
      || msg->vtable->get_mailbox == NULL)
    return MU_ERROR_NOT_SUPPORTED;
  return msg->vtable->get_mailbox (msg, mbox);
}

int
message_get_envelope (message_t msg, envelope_t *envelope)
{
  if (msg == NULL || msg->vtable == NULL
      || msg->vtable->get_envelope == NULL)
    return MU_ERROR_NOT_SUPPORTED;
  return msg->vtable->get_envelope (msg, envelope);
}

int
message_get_header (message_t msg, header_t *header)
{
  if (msg == NULL || msg->vtable == NULL
      || msg->vtable->get_header == NULL)
    return MU_ERROR_NOT_SUPPORTED;
  return msg->vtable->get_header (msg, header);
}

int
message_get_body (message_t msg, body_t *body)
{
  if (msg == NULL || msg->vtable == NULL
      || msg->vtable->get_body == NULL)
    return MU_ERROR_NOT_SUPPORTED;
  return msg->vtable->get_body (msg, body);
}

int
message_get_attribute (message_t msg, attribute_t *attribute)
{
  if (msg == NULL || msg->vtable == NULL
      || msg->vtable->get_attribute == NULL)
    return MU_ERROR_NOT_SUPPORTED;
  return msg->vtable->get_attribute (msg, attribute);
}

int
message_get_stream (message_t msg, stream_t *stream)
{
  if (msg == NULL || msg->vtable == NULL
      || msg->vtable->get_stream == NULL)
    return MU_ERROR_NOT_SUPPORTED;
  return msg->vtable->get_stream (msg, stream);
}

int
message_get_property (message_t msg, property_t *property)
{
  if (msg == NULL || msg->vtable == NULL
      || msg->vtable->get_property == NULL)
    return MU_ERROR_NOT_SUPPORTED;
  return msg->vtable->get_property (msg, property);
}

int
message_is_multipart (message_t msg, int *ismulti)
{
  if (msg == NULL || msg->vtable == NULL
      || msg->vtable->is_multipart == NULL)
    return MU_ERROR_NOT_SUPPORTED;
  return msg->vtable->is_multipart (msg, ismulti);
}

int
message_get_size (message_t msg, size_t *size)
{
  if (msg == NULL || msg->vtable == NULL
      || msg->vtable->get_size == NULL)
    return MU_ERROR_NOT_SUPPORTED;
  return msg->vtable->get_size (msg, size);
}

int
message_get_lines (message_t msg, size_t *lines)
{
  if (msg == NULL || msg->vtable == NULL
      || msg->vtable->get_lines == NULL)
    return MU_ERROR_NOT_SUPPORTED;
  return msg->vtable->get_lines (msg, lines);
}

int
message_get_num_parts (message_t msg, size_t *nparts)
{
  if (msg == NULL || msg->vtable == NULL
      || msg->vtable->get_num_parts == NULL)
    return MU_ERROR_NOT_SUPPORTED;
  return msg->vtable->get_num_parts (msg, nparts);
}

int
message_get_part (message_t msg, size_t partno, message_t *submsg)
{
  if (msg == NULL || msg->vtable == NULL
      || msg->vtable->get_part == NULL)
    return MU_ERROR_NOT_SUPPORTED;
  return msg->vtable->get_part (msg, partno, submsg);
}

int
message_get_uidl (message_t msg, char *uidl, size_t len, size_t *plen)
{
  if (msg == NULL || msg->vtable == NULL
      || msg->vtable->get_uidl == NULL)
    return MU_ERROR_NOT_SUPPORTED;
  return msg->vtable->get_uidl (msg, uidl, len, plen);
}

int
message_get_uid (message_t msg, size_t *uid)
{
  if (msg == NULL || msg->vtable == NULL
      || msg->vtable->get_uid == NULL)
    return MU_ERROR_NOT_SUPPORTED;
  return msg->vtable->get_uid (msg, uid);
}

Return to:

Send suggestions and report system problems to the System administrator.