aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2011-06-08 02:20:00 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2011-06-08 02:20:00 +0000
commit68b391b5c17420988118f2152d90832472bbfc0b (patch)
tree071ca7de27edf78e7d82522bd6b9c92265a45dda /src
parent17399356e839cf4a4d6ca12d52086fe01b857881 (diff)
added a new plug-in API: 'compose-send'.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2886 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'src')
-rw-r--r--src/compose.c24
-rw-r--r--src/plugin-marshal.list1
-rw-r--r--src/plugin.c15
-rw-r--r--src/plugin.h9
4 files changed, 48 insertions, 1 deletions
diff --git a/src/compose.c b/src/compose.c
index 79e2fd91..32858e15 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -3444,6 +3444,7 @@ static gint compose_send(Compose *compose)
{
gchar tmp[MAXPATHLEN + 1];
gint ok = 0;
+ gboolean ack = TRUE;
if (compose->lock_count > 0)
return 1;
@@ -3490,6 +3491,14 @@ static gint compose_send(Compose *compose)
g_warning(_("can't get recipient list."));
g_unlink(tmp);
compose_unlock(compose);
+ return 1;
+ }
+
+ syl_plugin_signal_emit("compose-send", compose, compose->mode, 0,
+ tmp, compose->to_list, &ack);
+ if (ack == FALSE) {
+ g_unlink(tmp);
+ compose_unlock(compose);
return -1;
}
@@ -7204,6 +7213,7 @@ static void compose_send_later_cb(gpointer data, guint action,
Compose *compose = (Compose *)data;
FolderItem *queue;
gchar tmp[MAXPATHLEN + 1];
+ gboolean ack = TRUE;
if (compose_check_entries(compose) == FALSE)
return;
@@ -7236,8 +7246,22 @@ static void compose_send_later_cb(gpointer data, guint action,
}
}
+ if (!compose->to_list && !compose->newsgroup_list) {
+ g_warning("can't get recipient list.");
+ g_unlink(tmp);
+ return;
+ }
+
+ syl_plugin_signal_emit("compose-send", compose, compose->mode, 1,
+ tmp, compose->to_list, &ack);
+ if (ack == FALSE) {
+ g_unlink(tmp);
+ return;
+ }
+
if (compose_queue(compose, tmp) < 0) {
alertpanel_error(_("Can't queue the message."));
+ g_unlink(tmp);
return;
}
diff --git a/src/plugin-marshal.list b/src/plugin-marshal.list
index 3eb1e2b6..2f6032ae 100644
--- a/src/plugin-marshal.list
+++ b/src/plugin-marshal.list
@@ -1,2 +1,3 @@
VOID:POINTER
VOID:POINTER,POINTER,STRING,STRING,POINTER
+BOOLEAN:POINTER,INT,INT,STRING,POINTER
diff --git a/src/plugin.c b/src/plugin.c
index 8b5ea643..9e152cd1 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -36,6 +36,7 @@ enum {
COMPOSE_CREATED,
COMPOSE_DESTROY,
TEXTVIEW_MENU_POPUP,
+ COMPOSE_SEND,
LAST_SIGNAL
};
@@ -172,6 +173,20 @@ static void syl_plugin_class_init(SylPluginClass *klass)
G_TYPE_STRING,
G_TYPE_STRING,
G_TYPE_POINTER);
+ plugin_signals[COMPOSE_SEND] =
+ g_signal_new("compose-send",
+ G_TYPE_FROM_CLASS(gobject_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET(SylPluginClass, compose_send),
+ NULL, NULL,
+ syl_plugin_marshal_BOOLEAN__POINTER_INT_INT_STRING_POINTER,
+ G_TYPE_BOOLEAN,
+ 5,
+ G_TYPE_POINTER,
+ G_TYPE_INT,
+ G_TYPE_INT,
+ G_TYPE_STRING,
+ G_TYPE_POINTER);
}
void syl_plugin_signal_connect(const gchar *name, GCallback callback,
diff --git a/src/plugin.h b/src/plugin.h
index 26b03242..65497882 100644
--- a/src/plugin.h
+++ b/src/plugin.h
@@ -45,7 +45,7 @@ typedef void (*SylPluginLoadFunc) (void);
typedef void (*SylPluginUnloadFunc) (void);
typedef void (*SylPluginCallbackFunc) (void);
-#define SYL_PLUGIN_INTERFACE_VERSION 0x0107
+#define SYL_PLUGIN_INTERFACE_VERSION 0x0108
struct _SylPlugin
{
@@ -71,6 +71,13 @@ struct _SylPluginClass
const gchar *uri,
const gchar *selected_text,
MsgInfo *msginfo);
+
+ gboolean (* compose_send) (GObject *obj,
+ gpointer compose,
+ gint compose_mode,
+ gint send_mode,
+ const gchar *msg_file,
+ GSList *to_list);
};
struct _SylPluginInfo