[Commits] [SCM] claws branch, gtk2, updated. 3.20.0-87-g3c2994dc3
wwp at claws-mail.org
wwp at claws-mail.org
Mon May 13 14:48:28 UTC 2024
The branch, gtk2 has been updated
via 3c2994dc3809c1cd779990d8a1aae7dd8162a716 (commit)
from a1d4f569cbf0738abd267eb794819aac426567c4 (commit)
Summary of changes:
claws-mail.desktop | 15 +++++++++++++--
doc/man/claws-mail.1 | 4 +++-
src/import.c | 16 ++++++++++------
src/import.h | 7 +++----
src/main.c | 22 +++++++++++++++++++++-
src/mainwindow.c | 13 ++++++++++++-
src/mainwindow.h | 4 +++-
7 files changed, 65 insertions(+), 16 deletions(-)
- Log -----------------------------------------------------------------
commit 3c2994dc3809c1cd779990d8a1aae7dd8162a716
Author: Ricardo Mones <ricardo at mones.org>
Date: Sun May 12 01:30:36 2024 +0200
Import mboxes from command line
diff --git a/claws-mail.desktop b/claws-mail.desktop
index 692d16a65..412abb610 100644
--- a/claws-mail.desktop
+++ b/claws-mail.desktop
@@ -44,10 +44,10 @@ Comment[tr]=GTK+ temelli hafif ve hızlı bir E-posta İstemcisi
Terminal=false
Type=Application
StartupNotify=true
-MimeType=x-scheme-handler/mailto;
+MimeType=application/mbox;x-scheme-handler/mailto;
X-Info=Claws Mail
-Actions=GetMail;ComposeMail;SendFile;
+Actions=GetMail;ComposeMail;SendFile;ImportMbox;
[Desktop Action GetMail]
Exec=claws-mail --receive-all
@@ -84,3 +84,14 @@ Name[pl]=Wyślij plik...
Name[pt]=Enviar ficheiro...
Name[ru]=Отправить файл...
Name[tr]=Ekli e-posta yaz...
+
+[Desktop Action ImportMbox]
+Exec=claws-mail --import-mbox %f
+Name=Import mbox file...
+Name[ca]=Importar arxiu mbox...
+Name[es]=Importar fichero mbox...
+Name[fr]=Importer un fichier mbox...
+Name[he]=ייבוא קובץ mbox...
+Name[pt]=Importar ficheiro mbox...
+Name[ru]=Импорт mbox файла...
+Name[tr]=mbox dosyasını içe aktar...
diff --git a/doc/man/claws-mail.1 b/doc/man/claws-mail.1
index a0d55c38f..e61d4722f 100644
--- a/doc/man/claws-mail.1
+++ b/doc/man/claws-mail.1
@@ -1,4 +1,4 @@
-.TH "CLAWS MAIL" "1" "January 16, 2021" "The Claws Mail team" "User Manuals"
+.TH "CLAWS MAIL" "1" "February 17, 2024" "The Claws Mail team" "User Manuals"
.SH "NAME"
.LP
@@ -103,6 +103,8 @@ This list is not complete.
.br
\fB \-\-insert\fR file1 [file2]...\fR
.br
+\fB \-\-import-mbox\fR file\fR
+.br
\fB \-\-receive\fR
.br
\fB \-\-receive\-all\fR
diff --git a/src/import.c b/src/import.c
index a5a116207..7a6504318 100644
--- a/src/import.c
+++ b/src/import.c
@@ -1,6 +1,6 @@
/*
- * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2020 the Claws Mail team and Hiroyuki Yamamoto
+ * Claws Mail -- a GTK based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2024 the Claws Mail team and Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -59,7 +59,7 @@ static void import_destsel_cb(GtkWidget *widget, gpointer data);
static gint delete_event(GtkWidget *widget, GdkEventAny *event, gpointer data);
static gboolean key_pressed(GtkWidget *widget, GdkEventKey *event, gpointer data);
-gint import_mbox(FolderItem *default_dest)
+gint import_mbox(FolderItem *default_dest, const gchar* mbox_file)
/* return values: -2 skipped/cancelled, -1 error, 0 OK */
{
gchar *dest_id = NULL;
@@ -86,7 +86,10 @@ gint import_mbox(FolderItem *default_dest)
} else {
gtk_entry_set_text(GTK_ENTRY(dest_entry), "");
}
- gtk_entry_set_text(GTK_ENTRY(file_entry), "");
+ if (mbox_file)
+ gtk_entry_set_text(GTK_ENTRY(file_entry), mbox_file);
+ else
+ gtk_entry_set_text(GTK_ENTRY(file_entry), "");
gtk_widget_grab_focus(file_entry);
manage_window_set_transient(GTK_WINDOW(window));
@@ -111,6 +114,7 @@ static void import_create(void)
window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "import");
gtk_window_set_title(GTK_WINDOW(window), _("Import mbox file"));
+ gtk_window_set_modal(GTK_WINDOW(window), TRUE);
gtk_container_set_border_width(GTK_CONTAINER(window), 5);
gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
@@ -235,13 +239,13 @@ static void import_ok_cb(GtkWidget *widget, gpointer data)
g_free(mbox);
- if (gtk_main_level() > 1)
+ if (gtk_main_level() > 0)
gtk_main_quit();
}
static void import_cancel_cb(GtkWidget *widget, gpointer data)
{
- if (gtk_main_level() > 1)
+ if (gtk_main_level() > 0)
gtk_main_quit();
}
diff --git a/src/import.h b/src/import.h
index bc99cdce4..33eb733c8 100644
--- a/src/import.h
+++ b/src/import.h
@@ -1,6 +1,6 @@
/*
- * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2012 Hiroyuki Yamamoto and the Claws Mail team
+ * Claws Mail -- a GTK based, lightweight, and fast e-mail client
+ * Copyright (C) 1999-2024 Hiroyuki Yamamoto and the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -14,7 +14,6 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
*/
#ifndef __IMPORT_H__
@@ -24,6 +23,6 @@
#include "folder.h"
-gint import_mbox(FolderItem *default_dest);
+gint import_mbox(FolderItem *default_dest, const gchar* mbox_file);
#endif /* __IMPORT_H__ */
diff --git a/src/main.c b/src/main.c
index 356f50ad1..786fe67e7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,6 +1,6 @@
/*
* Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2023 the Claws Mail team and Hiroyuki Yamamoto
+ * Copyright (C) 1999-2024 the Claws Mail team and Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -205,6 +205,7 @@ static struct RemoteCmd {
const gchar *target;
gboolean debug;
const gchar *geometry;
+ const gchar *import_mbox;
} cmd;
SessionStats session_stats;
@@ -1519,6 +1520,10 @@ int main(int argc, char *argv[])
folderview_thaw(mainwin->folderview);
main_window_cursor_normal(mainwin);
+ if (cmd.import_mbox) {
+ mainwindow_import_mbox(cmd.import_mbox);
+ }
+
if (!cmd.target && prefs_common.goto_folder_on_startup &&
folder_find_item_from_identifier(prefs_common.startup_folder) != NULL &&
!claws_crashed()) {
@@ -2008,6 +2013,7 @@ static void parse_cmd_opt(int argc, char *argv[])
g_print("%s\n", _(" --reset-statistics reset session statistics"));
g_print("%s\n", _(" --select folder[/msg] jump to the specified folder/message\n"
" folder is a folder id like 'folder/sub_folder', a file:// uri or an absolute path"));
+ g_print("%s\n", _(" --import-mbox file import the specified mbox file\n"));
g_print("%s\n", _(" --online switch to online mode"));
g_print("%s\n", _(" --offline switch to offline mode"));
g_print("%s\n", _(" --exit --quit -q exit Claws Mail"));
@@ -2057,6 +2063,13 @@ static void parse_cmd_opt(int argc, char *argv[])
} else {
parse_cmd_opt_error(_("Missing folder argument for option %s"), argv[i]);
}
+ } else if (!strcmp(argv[i], "--import-mbox")) {
+ if (i+1 < argc) {
+ cmd.import_mbox = argv[i+1];
+ i++;
+ } else {
+ parse_cmd_opt_error(_("Missing file argument for option %s"), argv[i]);
+ }
} else if (i == 1 && argc == 2) {
/* only one parameter. Do something intelligent about it */
if ((strstr(argv[i], "@") || !STRNCMP(argv[i], "mailto:")) && !strstr(argv[i], "://")) {
@@ -2463,6 +2476,10 @@ static gint prohibit_duplicate_launch(void)
gchar *str = g_strdup_printf("select %s\n", cmd.target);
CM_FD_WRITE_ALL(str);
g_free(str);
+ } else if (cmd.import_mbox) {
+ gchar *str = g_strdup_printf("import %s\n", cmd.import_mbox);
+ CM_FD_WRITE_ALL(str);
+ g_free(str);
} else if (cmd.search) {
gchar buf[BUFFSIZE];
gchar *str =
@@ -2704,6 +2721,9 @@ static void lock_socket_input_cb(gpointer data,
} else if (!STRNCMP(buf, "select ")) {
const gchar *target = buf+7;
mainwindow_jump_to(target, TRUE);
+ } else if (!STRNCMP(buf, "import ")) {
+ const gchar *mbox_file = buf + 7;
+ mainwindow_import_mbox(mbox_file);
} else if (!STRNCMP(buf, "search ")) {
FolderItem* folderItem = NULL;
GSList *messages = NULL;
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 4c7c49a73..8956abc19 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -3997,7 +3997,7 @@ static void import_mbox_cb(GtkAction *action, gpointer data)
{
MainWindow *mainwin = (MainWindow *)data;
/* only notify if import has failed */
- if (import_mbox(mainwin->summaryview->folder_item) == -1) {
+ if (import_mbox(mainwin->summaryview->folder_item, NULL) == -1) {
alertpanel_error(_("Mbox import has failed."));
}
}
@@ -5633,3 +5633,14 @@ static void goto_prev_part_cb(GtkAction *action, gpointer data)
&& mainwin->messageview->mimeview)
mimeview_select_prev_part(mainwin->messageview->mimeview);
}
+
+void mainwindow_import_mbox(const gchar* mbox_file)
+{
+ MainWindow *mainwin = mainwindow_get_mainwindow();
+
+ strcrlftrunc((gchar *) mbox_file);
+ /* only notify if import has failed */
+ if (import_mbox(mainwin->summaryview->folder_item, mbox_file) == -1) {
+ alertpanel_error(_("Mbox import has failed."));
+ }
+}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 4648b54f9..2b2ec3caf 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -1,6 +1,6 @@
/*
* Claws Mail -- a GTK based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2023 the Claws Mail team and Hiroyuki Yamamoto
+ * Copyright (C) 1999-2024 the Claws Mail team and Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -227,4 +227,6 @@ void mainwindow_reset_paned (GtkPaned *paned);
void mainwin_accel_changed_cb (GtkAccelGroup *accelgroup, guint keyval, GdkModifierType modifier,
GClosure *closure, GtkMenuItem *item);
+void mainwindow_import_mbox(const gchar* mbox_file);
+
#endif /* __MAINWINDOW_H__ */
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list