aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/groupwise-status-tracking
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/groupwise-status-tracking')
-rw-r--r--plugins/groupwise-status-tracking/Changelog3
-rw-r--r--plugins/groupwise-status-tracking/Makefile.am15
-rw-r--r--plugins/groupwise-status-tracking/org-gnome-status-track.eplug.in25
-rw-r--r--plugins/groupwise-status-tracking/status-track.c237
4 files changed, 280 insertions, 0 deletions
diff --git a/plugins/groupwise-status-tracking/Changelog b/plugins/groupwise-status-tracking/Changelog
new file mode 100644
index 0000000000..48d92a1184
--- /dev/null
+++ b/plugins/groupwise-status-tracking/Changelog
@@ -0,0 +1,3 @@
+2005-01-20 Parthasarathi Susarla <sparthasarathi@novell.com> Chenthill Palanisamy <pchenthill@novell.com>
+
+ * first commit of the status tracking plugin
diff --git a/plugins/groupwise-status-tracking/Makefile.am b/plugins/groupwise-status-tracking/Makefile.am
new file mode 100644
index 0000000000..cc1aeac51c
--- /dev/null
+++ b/plugins/groupwise-status-tracking/Makefile.am
@@ -0,0 +1,15 @@
+INCLUDES = \
+ -I$(top_srcdir) \
+ $(CAMEL_GROUPWISE_CFLAGS) \
+ $(EVOLUTION_MAIL_CFLAGS)
+
+@EVO_PLUGIN_RULE@
+
+plugin_DATA = org-gnome-status-track.eplug
+plugin_LTLIBRARIES = liborg-gnome-status-track.la
+
+liborg_gnome_status_track_la_SOURCES = status-track.c
+liborg_gnome_status_track_la_LIBADD = $(CAMEL_GROUPWISE_LIBS)
+liborg_gnome_status_track_la_LDFLAGS = -module -avoid-version
+
+EXTRA_DIST = org-gnome-status-track.eplug.in
diff --git a/plugins/groupwise-status-tracking/org-gnome-status-track.eplug.in b/plugins/groupwise-status-tracking/org-gnome-status-track.eplug.in
new file mode 100644
index 0000000000..a2d3d4bee4
--- /dev/null
+++ b/plugins/groupwise-status-tracking/org-gnome-status-track.eplug.in
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<e-plugin-list>
+ <e-plugin
+ type="shlib"
+ id="org.gnome.evolution.plugin.status.track"
+ location="@PLUGINDIR@/liborg-gnome-status-track.so"
+ name="Track status of a sent mail in a groupwise account">
+ <description>A plugin which allows status tracking. This is applicable for groupwise mailboxes only</description>
+ <author name="Parthasarathi Susarla" email="sparthasarathi@novell.com"/>
+
+ <!-- hook into the uri popup menu -->
+ <hook class="org.gnome.evolution.mail.popup:1.0">
+ <menu id="org.gnome.evolution.mail.folderview.popup" target="select">
+ <item
+ type="item"
+ path="21.gw_status_tracking"
+ label="Track Message Status"
+ enable="one"
+ visible="one"
+ activate="org_gnome_track_status"/>
+ </menu>
+ </hook>
+ </e-plugin>
+</e-plugin-list>
+
diff --git a/plugins/groupwise-status-tracking/status-track.c b/plugins/groupwise-status-tracking/status-track.c
new file mode 100644
index 0000000000..e4b208a812
--- /dev/null
+++ b/plugins/groupwise-status-tracking/status-track.c
@@ -0,0 +1,237 @@
+/*
+ * Copyright (C) 2004 Novell, Inc.
+ *
+ * Author(s): Chenthill Palanisamy <pchenthill@novell.com>
+ * Parthasarathi Susarla <sparthasarathi@novell.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <glib/gi18n-lib.h>
+#include <string.h>
+#include <stdio.h>
+#include <time.h>
+#include <gtk/gtk.h>
+
+#include "camel/camel-folder.h"
+#include "camel/camel-medium.h"
+#include "camel/camel-mime-message.h"
+#include "mail/em-popup.h"
+
+#include <e-gw-connection.h>
+
+
+void org_gnome_track_status (void *ep, EMPopupTargetSelect *t) ;
+void add_recipient (GtkTable *table, char *recp, int row) ;
+int add_detail (GtkTable *table, char *label, char *value, int row) ;
+
+void
+add_recipient (GtkTable *table, char *recp, int row)
+{
+ GtkWidget *widget ;
+
+ widget = gtk_label_new (recp) ;
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_table_attach (table, widget , 0, 1, row, row + 1, GTK_FILL, 0, 0, 0);
+}
+
+int
+add_detail (GtkTable *table, char *label, char *value, int row)
+{
+ GtkWidget *widget ;
+ time_t time = e_gw_connection_get_date_from_string (value) ;
+ char *str = ctime (&time) ;
+
+ str [strlen(str)-1] = '\0' ;
+
+ widget = gtk_label_new (label);
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0);
+ widget = gtk_label_new (str);
+ gtk_table_attach (table, widget , 2, 3, row, row + 1, GTK_FILL, 0, 0, 0);
+ row++;
+ return row ;
+}
+/*
+ * The format for the options is:
+ * 0 1 2 3 4 5 6 7 8 9
+ * X-gw-status-opt: /TO/CC/BCC;name;email;delivered;opened;accepted;deleted;declined;completed;undelivered::
+ */
+void org_gnome_track_status (void *ep, EMPopupTargetSelect *t)
+{
+ CamelMimeMessage *msg = NULL ;
+ const CamelInternetAddress *from ;
+ const char *namep, *addp ;
+
+ GtkDialog *d ;
+ GtkTable *table ;
+ GtkWidget *widget;
+ GtkScrolledWindow *win;
+ GtkVBox *vbox;
+
+ time_t time ;
+ char *time_str ;
+
+ const char *status = NULL ;
+ char **temp1 = NULL, **temp2 = NULL , **ptr = NULL, *str = NULL ;
+
+ int row = 0;
+
+ /*check if it is a groupwise account*/
+ str = strstr (t->uri, "groupwise") ;
+ if (!str) {
+ g_warning ("Status tracking available for groupwise account only") ;
+ return ;
+ }
+ str = strstr (t->uri, "Sent Items") ;
+ if (!str) {
+ g_warning ("Status tracking available for a sent folder only") ;
+ return ;
+ }
+
+ /*Get message*/
+ msg = camel_folder_get_message (t->folder, g_ptr_array_index (t->uids, 0), NULL);
+ if (!msg) {
+ g_print ("Error!! No message\n") ;
+ return ;
+ }
+ status = camel_medium_get_header ( CAMEL_MEDIUM(msg), "X-gw-status-opt") ;
+ if (!status) {
+ g_print ("Error!! No header\n") ;
+ return ;
+ }
+
+ /*Create the dialog*/
+ d = (GtkDialog *) gtk_dialog_new ();
+ gtk_dialog_add_button (d, GTK_STOCK_OK, GTK_RESPONSE_OK);
+ gtk_window_set_title (GTK_WINDOW (d), "Message Status");
+
+ table = (GtkTable *) gtk_table_new (1, 2, FALSE);
+ win = (GtkScrolledWindow *) gtk_scrolled_window_new (NULL, NULL);
+ gtk_container_add (GTK_CONTAINER (GTK_DIALOG(d)->vbox), GTK_WIDGET (win));
+ vbox = (GtkVBox *) gtk_vbox_new (FALSE, 12);
+ gtk_scrolled_window_add_with_viewport (win, GTK_WIDGET(vbox));
+ gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (table), FALSE, TRUE, 0);
+ gtk_scrolled_window_set_policy (win, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+
+ gtk_table_set_col_spacings (table ,12);
+ gtk_table_set_row_spacings (table, 6);
+
+ /*Subject*/
+ widget = gtk_label_new ("<b>Subject</b> :");
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
+ gtk_table_attach (table, widget , 0, 1, row, row + 1, GTK_FILL, 0, 0, 0);
+ widget = gtk_label_new (camel_mime_message_get_subject(msg));
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0);
+ row++;
+
+ /*From*/
+ from = camel_mime_message_get_from (msg) ;
+ camel_internet_address_get (from, 0, &namep, &addp) ;
+ widget = gtk_label_new ("<b>From</b> :");
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
+ gtk_table_attach (table, widget , 0, 1, row, row + 1, GTK_FILL, 0, 0, 0);
+ widget = gtk_label_new (namep);
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0);
+ row++;
+
+ /*creation date*/
+ time = camel_mime_message_get_date (msg, NULL) ;
+ time_str = ctime (&time) ;
+ time_str[strlen(time_str)-1] = '\0' ;
+ widget = gtk_label_new ("<b>Creation date</b> :");
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
+ gtk_table_attach (table, widget , 0, 1, row, row + 1, GTK_FILL, 0, 0, 0);
+ widget = gtk_label_new (time_str);
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0);
+ row++;
+
+ /*spacing*/
+ widget = gtk_label_new ("");
+ gtk_table_attach (table, widget, 0, 1, row, row + 1, GTK_FILL, 0, 0, 0);
+ row++;
+
+ /*Table headers*/
+ row = 0;
+ table = (GtkTable *) gtk_table_new (1, 3, FALSE);
+ gtk_table_set_col_spacings (table ,12);
+ gtk_table_set_row_spacings (table, 6);
+ gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (table), FALSE, TRUE, 0);
+ widget = gtk_label_new ("<b>Recipients </b>");
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
+ gtk_table_attach (table, widget , 0, 1, row, row + 1, GTK_FILL, 0, 0, 0);
+ widget = gtk_label_new ("<b>Action</b>");
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
+ gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0);
+ widget = gtk_label_new ("<b>Date and Time</b>");
+ gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
+ gtk_label_set_use_markup (GTK_LABEL (widget), TRUE);
+ gtk_table_attach (table, widget , 2, 3, row, row + 1, GTK_FILL, 0, 0, 0);
+ row++;
+
+
+ temp1 = g_strsplit (status, "::", -1) ;
+ ptr = temp1 ;
+ str = *ptr ;
+ while (str) {
+ temp2 = g_strsplit (str, ";", -1) ;
+ if (*temp2) {
+ if (strlen(temp2[0]));
+ if (strlen(temp2[1]))
+ add_recipient (table, temp2[1], row) ;
+ if (strlen(temp2[2]));
+ if (strlen(temp2[3]))
+ row = add_detail (table,"delivered" , temp2[3], row) ;
+ if (strlen(temp2[4]))
+ row = add_detail (table,"opened" , temp2[3], row) ;
+ if (strlen(temp2[5]))
+ row = add_detail (table,"accepted" , temp2[3], row) ;
+ if (strlen(temp2[6]))
+ row = add_detail (table,"deleted" , temp2[3], row) ;
+ if (strlen(temp2[7]))
+ row = add_detail (table,"declined" , temp2[3], row) ;
+ if (strlen(temp2[8]))
+ row = add_detail (table,"completed" , temp2[3], row) ;
+ if (strlen(temp2[9]))
+ row = add_detail (table,"undelivered" , temp2[3], row) ;
+ }
+ str = *(++ptr) ;
+ g_strfreev (temp2) ;
+ }
+
+ /*set size and display the dialog*/
+ gtk_widget_set_usize (GTK_WIDGET (win), 400, 300);
+ gtk_widget_show_all (GTK_WIDGET (d));
+ if (gtk_dialog_run (d) == GTK_RESPONSE_OK)
+ gtk_widget_destroy (GTK_WIDGET (d));
+ else
+ gtk_widget_destroy (GTK_WIDGET (d));
+
+
+ g_strfreev (temp1) ;
+
+}