Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
John McEleney
/
mailutils
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit
6457912a
...
6457912abc3dc926a1607013da3fdcf50795d698
authored
2006-01-27 15:15:55 +0000
by
Sergey Poznyakoff
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
(mh_draft_message): New function
1 parent
7163b426
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
mh/mh_init.c
mh/mh_init.c
View file @
6457912
...
...
@@ -20,6 +20,7 @@
/* Initialize MH applications. */
#include <mh.h>
#include <mailutils/url.h>
#include <pwd.h>
#include <sys/types.h>
#include <sys/stat.h>
...
...
@@ -917,3 +918,65 @@ mh_expand_aliases (mu_message_t msg,
}
}
}
int
mh_draft_message
(
const
char
*
name
,
const
char
*
msgspec
,
char
**
pname
)
{
mu_url_t
url
;
size_t
uid
;
int
rc
;
const
char
*
urlstr
;
mu_mailbox_t
mbox
;
mbox
=
mh_open_folder
(
name
,
0
);
if
(
!
mbox
)
return
1
;
mu_mailbox_get_url
(
mbox
,
&
url
);
urlstr
=
mu_url_to_string
(
url
);
if
(
strcmp
(
msgspec
,
"new"
)
==
0
)
{
rc
=
mu_mailbox_uidnext
(
mbox
,
&
uid
);
if
(
rc
)
mu_error
(
_
(
"Cannot obtain sequence number for the new message"
),
mu_strerror
(
rc
));
}
else
{
char
*
argv
[
2
];
mh_msgset_t
msgset
;
argv
[
0
]
=
(
char
*
)
msgspec
;
argv
[
1
]
=
NULL
;
rc
=
mh_msgset_parse
(
mbox
,
&
msgset
,
1
,
argv
,
"cur"
);
if
(
rc
)
mu_error
(
_
(
"Invalid message number: %s"
),
msgspec
);
else
if
(
msgset
.
count
>
1
)
mu_error
(
_
(
"only one message at a time!"
));
else
uid
=
msgset
.
list
[
0
];
mh_msgset_free
(
&
msgset
);
}
if
(
rc
==
0
)
{
const
char
*
dir
;
const
char
*
msg
;
size_t
len
;
dir
=
urlstr
+
3
;
/* FIXME */
msg
=
mu_umaxtostr
(
0
,
uid
);
len
=
strlen
(
dir
)
+
1
+
strlen
(
msg
)
+
1
;
*
pname
=
xmalloc
(
len
);
strcpy
(
*
pname
,
dir
);
strcat
(
*
pname
,
"/"
);
strcat
(
*
pname
,
msg
);
}
mu_mailbox_close
(
mbox
);
mu_mailbox_destroy
(
&
mbox
);
return
rc
;
}
...
...
Please
register
or
sign in
to post a comment