aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c65
1 files changed, 40 insertions, 25 deletions
diff --git a/src/main.c b/src/main.c
index 649d79f1..2e5bc15a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -146,6 +146,7 @@ static void migrate_old_config (void);
static void open_compose_new (const gchar *address,
GPtrArray *attach_files);
+static void open_message (const gchar *path);
static void send_queue (void);
@@ -1253,36 +1254,12 @@ static gboolean lock_socket_input_cb(GIOChannel *source, GIOCondition condition,
g_free(status);
if (folders) g_ptr_array_free(folders, TRUE);
} else if (!strncmp(buf, "open", 4)) {
- gchar *path;
- gchar *id;
- gchar *msg;
- gint num;
- FolderItem *item;
- MsgInfo *msginfo;
- MessageView *msgview;
-
strretchomp(buf);
if (strlen(buf) < 6 || buf[4] != ' ') {
fd_close(sock);
return TRUE;
}
-
- path = buf + 5;
- id = g_path_get_dirname(path);
- msg = g_path_get_basename(path);
- num = to_number(msg);
- item = folder_find_item_from_identifier(id);
- debug_print("open folder id: %s (msg %d)\n", id, num);
- if (num > 0 && item) {
- msginfo = folder_item_get_msginfo(item, num);
- if (msginfo) {
- msgview = messageview_create_with_new_window();
- messageview_show(msgview, msginfo, FALSE);
- } else
- debug_print("message %d not found\n", num);
- }
- g_free(msg);
- g_free(id);
+ open_message(buf + 5);
} else if (!strncmp(buf, "exit", 4)) {
fd_close(sock);
app_will_exit(TRUE);
@@ -1320,6 +1297,9 @@ static void remote_command_exec(void)
if (cmd.send)
send_queue();
+
+ if (cmd.open_msg)
+ open_message(cmd.open_msg);
}
if (cmd.attach_files) {
@@ -1335,6 +1315,10 @@ static void remote_command_exec(void)
g_ptr_array_free(cmd.status_full_folders, TRUE);
cmd.status_full_folders = NULL;
}
+ if (cmd.open_msg) {
+ g_free(cmd.open_msg);
+ cmd.open_msg = NULL;
+ }
if (cmd.exit) {
app_will_exit(TRUE);
}
@@ -1460,6 +1444,37 @@ static void open_compose_new(const gchar *address, GPtrArray *attach_files)
g_free(utf8addr);
}
+static void open_message(const gchar *path)
+{
+ gchar *id;
+ gchar *msg;
+ gint num;
+ FolderItem *item;
+ MsgInfo *msginfo;
+ MessageView *msgview;
+
+ if (gtkut_window_modal_exist())
+ return;
+
+ id = g_path_get_dirname(path);
+ msg = g_path_get_basename(path);
+ num = to_number(msg);
+ item = folder_find_item_from_identifier(id);
+ debug_print("open folder id: %s (msg %d)\n", id, num);
+
+ if (num > 0 && item) {
+ msginfo = folder_item_get_msginfo(item, num);
+ if (msginfo) {
+ msgview = messageview_create_with_new_window();
+ messageview_show(msgview, msginfo, FALSE);
+ } else
+ debug_print("message %d not found\n", num);
+ }
+
+ g_free(msg);
+ g_free(id);
+}
+
static void send_queue(void)
{
GList *list;