aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2003-12-03 08:27:52 +0800
committerMichael Zucci <zucchi@src.gnome.org>2003-12-03 08:27:52 +0800
commit33efd90a82fbbbfb3f7645a149cfbfed471596fb (patch)
tree585cb9db9a30643a658bcf7564ded0b2d7cb928e /mail
parentccd5cdcf82c299aba622da4f5f87347aea93d99c (diff)
downloadgsoc2013-evolution-33efd90a82fbbbfb3f7645a149cfbfed471596fb.tar.gz
gsoc2013-evolution-33efd90a82fbbbfb3f7645a149cfbfed471596fb.tar.zst
gsoc2013-evolution-33efd90a82fbbbfb3f7645a149cfbfed471596fb.zip
changed to setup the rule part properly, it could never have worked. Bug
2003-12-03 Not Zed <NotZed@Ximian.com> * mail-autofilter.c (rule_match_thread): changed to setup the rule part properly, it could never have worked. Bug #51601. * em-popup.c (emp_uri_popup_address_add): implement. * em-folder-view.c (emfv_popup_add_sender): implement. (emfv_add_sender_addressbook): hook up to above func. * em-utils.c (em_utils_add_address): implementation to add an email address to the addressbook. (emu_add_address_cb): callback required for funny api. Bug #51321. svn path=/trunk/; revision=23592
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog15
-rw-r--r--mail/em-folder-view.c23
-rw-r--r--mail/em-popup.c14
-rw-r--r--mail/em-utils.c42
-rw-r--r--mail/em-utils.h2
-rw-r--r--mail/mail-autofilter.c5
6 files changed, 88 insertions, 13 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index b56c17c16f..bf7b82db4b 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,18 @@
+2003-12-03 Not Zed <NotZed@Ximian.com>
+
+ * mail-autofilter.c (rule_match_thread): changed to setup the rule
+ part properly, it could never have worked. Bug #51601.
+
+ * em-popup.c (emp_uri_popup_address_add): implement.
+
+ * em-folder-view.c (emfv_popup_add_sender): implement.
+ (emfv_add_sender_addressbook): hook up to above func.
+
+ * em-utils.c (em_utils_add_address): implementation to add an
+ email address to the addressbook.
+ (emu_add_address_cb): callback required for funny api. Bug
+ #51321.
+
2003-12-02 Jeffrey Stedfast <fejj@ximian.com>
* em-folder-tree-model.c (drop_uid_list): Moved here.
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 602993e8f9..ca3df84be6 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -630,8 +630,17 @@ emfv_popup_label_set(GtkWidget *w, struct _emfv_label_item *item)
static void
emfv_popup_add_sender(GtkWidget *w, EMFolderView *emfv)
{
- /* FIXME */
- printf("UNIMPLEMENTED: add sender to addressbook\n");
+ GPtrArray *uids = message_list_get_selected(emfv->list);
+ CamelMessageInfo *info;
+ const char *addr;
+
+ if (uids->len == 1
+ && (info = camel_folder_get_message_info(emfv->folder, uids->pdata[0])) != NULL
+ && (addr = camel_message_info_from(info)) != NULL
+ && addr[0] != 0)
+ em_utils_add_address((GtkWidget *)emfv, addr);
+
+ em_utils_uids_free(uids);
}
static void
@@ -824,6 +833,7 @@ from(BonoboUIComponent *uid, void *data, const char *path) \
to(NULL, (EMFolderView *)data); \
}
+EMFV_MAP_CALLBACK(emfv_add_sender_addressbook, emfv_popup_add_sender)
EMFV_MAP_CALLBACK(emfv_message_apply_filters, emfv_popup_apply_filters)
EMFV_MAP_CALLBACK(emfv_message_copy, emfv_popup_copy)
EMFV_MAP_CALLBACK(emfv_message_move, emfv_popup_move)
@@ -934,15 +944,6 @@ emfv_mail_previous_unread(BonoboUIComponent *uid, void *data, const char *path)
}
static void
-emfv_add_sender_addressbook(BonoboUIComponent *uid, void *data, const char *path)
-{
- EMFolderView *emfv = data;
-
- emfv = emfv;
- /* FIXME: need to find out what the new addressbook API is for this... */
-}
-
-static void
emfv_message_forward_attached (BonoboUIComponent *uic, void *data, const char *path)
{
EMFolderView *emfv = data;
diff --git a/mail/em-popup.c b/mail/em-popup.c
index 760aed48d5..8312be3770 100644
--- a/mail/em-popup.c
+++ b/mail/em-popup.c
@@ -22,6 +22,7 @@
#include <camel/camel-folder.h>
#include <camel/camel-mime-message.h>
#include <camel/camel-string-utils.h>
+#include <camel/camel-url.h>
static void emp_standard_menu_factory(EMPopup *emp, EMPopupTarget *target, void *data);
@@ -678,7 +679,18 @@ emp_uri_popup_address_send (GtkWidget *w, EMPopupTarget *t)
static void
emp_uri_popup_address_add(GtkWidget *w, EMPopupTarget *t)
{
- printf("UNIMPLEMENTED: Add address '%s'\n", t->data.uri);
+ CamelURL *url;
+
+ url = camel_url_new(t->data.uri, NULL);
+ if (url == NULL) {
+ g_warning("cannot parse url '%s'", t->data.uri);
+ return;
+ }
+
+ if (url->path && url->path[0])
+ em_utils_add_address(w, url->path);
+
+ camel_url_free(url);
}
static EMPopupItem emp_standard_uri_popups[] = {
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 6a0712d311..e2da2fa6d3 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -1443,6 +1443,48 @@ em_utils_save_messages (GtkWidget *parent, CamelFolder *folder, GPtrArray *uids)
gtk_widget_show((GtkWidget *)filesel);
}
+/* ********************************************************************** */
+
+static void
+emu_add_address_cb(BonoboListener *listener, const char *name, const CORBA_any *any, CORBA_Environment *ev, void *data)
+{
+ char *type = bonobo_event_subtype(name);
+
+ if (!strcmp(type, "Destroy"))
+ gtk_widget_destroy((GtkWidget *)data);
+
+ g_free(type);
+}
+
+/**
+ * em_utils_add_address:
+ * @parent:
+ * @email:
+ *
+ * Add address @email to the addressbook.
+ **/
+void em_utils_add_address(struct _GtkWidget *parent, const char *email)
+{
+ GtkWidget *win;
+ GtkWidget *control;
+ /*GtkWidget *socket;*/
+
+ win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title((GtkWindow *)win, _("Add address"));
+
+ control = bonobo_widget_new_control("OAFIID:GNOME_Evolution_Addressbook_AddressPopup:" BASE_VERSION, CORBA_OBJECT_NIL);
+ bonobo_widget_set_property((BonoboWidget *)control, "email", TC_CORBA_string, email, NULL);
+
+ bonobo_event_source_client_add_listener(bonobo_widget_get_objref((BonoboWidget *)control), emu_add_address_cb, NULL, NULL, win);
+
+ /*socket = find_socket (GTK_CONTAINER (control));
+ g_object_weak_ref ((GObject *) socket, (GWeakNotify) gtk_widget_destroy, win);*/
+
+ gtk_container_add((GtkContainer *)win, control);
+ gtk_widget_show_all(win);
+}
+
+/* ********************************************************************** */
/* Flag-for-Followup... */
/* tag-editor callback data */
diff --git a/mail/em-utils.h b/mail/em-utils.h
index 6befbd6fe9..502b52e19d 100644
--- a/mail/em-utils.h
+++ b/mail/em-utils.h
@@ -88,6 +88,8 @@ void em_utils_post_reply_to_message_by_uid (struct _CamelFolder *folder, const c
void em_utils_save_part(struct _GtkWidget *parent, const char *prompt, struct _CamelMimePart *part);
void em_utils_save_messages (struct _GtkWidget *parent, struct _CamelFolder *folder, GPtrArray *uids);
+void em_utils_add_address(struct _GtkWidget *parent, const char *email);
+
void em_utils_flag_for_followup (struct _GtkWidget *parent, struct _CamelFolder *folder, GPtrArray *uids);
void em_utils_flag_for_followup_clear (struct _GtkWidget *parent, struct _CamelFolder *folder, GPtrArray *uids);
void em_utils_flag_for_followup_completed (struct _GtkWidget *parent, struct _CamelFolder *folder, GPtrArray *uids);
diff --git a/mail/mail-autofilter.c b/mail/mail-autofilter.c
index 17d5f485d8..79ab30f5dd 100644
--- a/mail/mail-autofilter.c
+++ b/mail/mail-autofilter.c
@@ -236,8 +236,11 @@ rule_match_thread (RuleContext *context, FilterRule *rule, const char *msgid)
element = filter_part_find_element (part, "header-type");
filter_option_set_current ((FilterOption *) element, "contains");
+
+ element = filter_part_find_element (part, "header-field");
+ filter_input_set_value ((FilterInput *) element, "References");
- element = filter_part_find_element (part, "header");
+ element = filter_part_find_element (part, "word");
filter_input_set_value ((FilterInput *) element, msgid);
}