- for(i=0; i < items; i++) {
- if( ! is_selected(i) && i != list_current_item() )
- continue;
- get_first_email(email, i);
- tmp = mkstr("%s \"%s\"", cmd, database[i][NAME]);
- my_free(cmd);
- if( *database[i][EMAIL] ) {
- cmd = mkstr("%s <%s>", tmp, email);
+void
+print_stderr(int item)
+{
+ fprintf (stderr, "%c", '\n');
+
+ if( is_valid_item(item) )
+ muttq_print_item(stderr, item);
+ else {
+ struct db_enumerator e = init_db_enumerator(ENUM_SELECTED);
+ db_enumerate_items(e) {
+ muttq_print_item(stderr, e.item);
+ }
+ }
+
+}
+
+void
+launch_mutt(int item)
+{
+ char *cmd = NULL, *mailstr = NULL;
+ char *mutt_command = options_get_str("mutt_command");
+
+ if(mutt_command == NULL || !*mutt_command)
+ return;
+
+ if( is_valid_item(item) )
+ mailstr = make_mailstr(item);
+ else {
+ struct db_enumerator e = init_db_enumerator(ENUM_SELECTED);
+ char *tmp = NULL;
+ db_enumerate_items(e) {
+ tmp = mailstr;
+ mailstr = tmp ?
+ strconcat(tmp, ",", make_mailstr(e.item), NULL):
+ strconcat(make_mailstr(e.item), NULL);