/usr/share/doc/libsylph-dev/examples/libsylph-compose.c is in libsylph-dev 1.1.0-13.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /* gcc -Wall -g -o libsylph-compose libsylph-compose.c -lsylph `pkg-config glib-2.0 --cflags --libs` */
#include <sylph/sylmain.h>
#include <sylph/prefs_common.h>
#include <sylph/account.h>
#include <sylph/folder.h>
#include <sylph/compose.h>
void do_compose(const gchar *to, const gchar *subject, const gchar *body)
{
ComposeInfo *compose;
PrefsAccount *ac;
ac = account_get_current_account();
compose = compose_info_new(ac, COMPOSE_NEW);
compose_set_headers(compose, to, NULL, NULL, NULL, subject);
compose_set_body(compose, body);
compose_set_encoding(compose, CS_UTF_8, NULL);
compose_write_to_file(compose, "mail.txt", NULL);
compose_info_free(compose);
}
int main(int argc, char *argv[])
{
GList *alist;
gchar *to, *subject, *body;
syl_init();
if (argc < 4) {
g_print("Usage: %s to subject body\n", argv[0]);
return 1;
}
to = argv[1];
subject = argv[2];
body = argv[3];
set_debug_mode(TRUE);
prefs_common_read_config();
account_read_config_all();
if (folder_read_list() < 0) {
g_warning("folder_read_list: error");
return 1;
}
alist = account_get_list();
if (!alist) {
g_warning("no account found");
return 1;
}
g_print("\n");
do_compose(to, subject, body);
syl_cleanup();
return 0;
}
|