for (curr = attach_files ; curr != NULL ; curr = curr->next) {
ainfo = (AttachInfo *) curr->data;
- compose_attach_append(compose, ainfo->file, ainfo->file,
+ if (ainfo->insert)
+ compose_insert_file(compose, ainfo->file);
+ else
+ compose_attach_append(compose, ainfo->file, ainfo->file,
ainfo->content_type, ainfo->charset);
}
}
cmd.subscribe = TRUE;
cmd.subscribe_uri = p;
}
- } else if (!strncmp(argv[i], "--attach", 8)) {
+ } else if (!strncmp(argv[i], "--attach", 8) || !strncmp(argv[i], "--insert", 8)) {
const gchar *p = (i+1 < argc)?argv[i+1]:NULL;
gchar *file = NULL;
+ gboolean insert = !strncmp(argv[i], "--insert", 8);
while (p && *p != '\0' && *p != '-') {
if ((file = g_filename_from_uri(p, NULL, NULL)) != NULL) {
} else if (file == NULL) {
file = g_strdup(p);
}
+
ainfo = g_new0(AttachInfo, 1);
ainfo->file = file;
+ ainfo->insert = insert;
cmd.attach_files = g_list_append(cmd.attach_files, ainfo);
i++;
p = (i+1 < argc)?argv[i+1]:NULL;
g_print("%s\n", _(" --attach file1 [file2]...\n"
" open composition window with specified files\n"
" attached"));
+ g_print("%s\n", _(" --insert file1 [file2]...\n"
+ " open composition window with specified files\n"
+ " inserted"));
g_print("%s\n", _(" --receive receive new messages"));
g_print("%s\n", _(" --receive-all receive new messages of all accounts"));
g_print("%s\n", _(" --cancel-receiving cancel receiving of messages"));
for (curr = cmd.attach_files; curr != NULL ; curr = curr->next) {
str = (gchar *) ((AttachInfo *)curr->data)->file;
+ if (((AttachInfo *)curr->data)->insert)
+ fd_write_all(uxsock, "insert ", strlen("insert "));
+ else
+ fd_write_all(uxsock, "attach ", strlen("attach "));
fd_write_all(uxsock, str, strlen(str));
fd_write_all(uxsock, "\n", 1);
}
strretchomp(buf);
if (!strcmp2(buf, "."))
break;
-
+
ainfo = g_new0(AttachInfo, 1);
- ainfo->file = g_strdup(buf);
+ ainfo->file = g_strdup(strstr(buf, " ") + 1);
+ ainfo->insert = !strncmp(buf, "insert ", 7);
files = g_list_append(files, ainfo);
}
open_compose_new(mailto, files);