[Evolution-hackers] Remove duplicate

2009-10-14 Thread ritz
Hi

  wrt http://bugzilla.gnome.org/show_bug.cgi?id=587011 , I have written
a patch ( attached ) . I am not sure, where to stick the menu option
( above Expuge ? ), and believe that the plugin should select and mark
the message as deleted. Is there any good reason to not do so ?


-- 
Ritesh Khadgaray
Linux and Desktop
Ph: +919970164885
blog: http://khadgaray.blogspot.com
Eat Right, Exercise, Die Anyway.
diff --git a/modules/mail/Makefile.am b/modules/mail/Makefile.am
index 962fc61..f304577 100644
--- a/modules/mail/Makefile.am
+++ b/modules/mail/Makefile.am
@@ -1,3 +1,9 @@
+error_DATA = remove-duplicates.error
+errordir = $(privdatadir)/errors
+
+# provides error rule
+...@evo_plugin_rule@
+
 module_LTLIBRARIES = libevolution-module-mail.la
 
 libevolution_module_mail_la_CPPFLAGS =	\
@@ -58,7 +64,14 @@ libevolution_module_mail_la_LIBADD =	\
 	$(top_builddir)/mail/importers/libevolution-mail-importers.la	\
 	$(GNOME_PLATFORM_LIBS)
 
-libevolution_module_mail_la_LDFLAGS =	\
+EXTRA_DIST =  remove-duplicates.error.xml
+
+BUILT_SOURCES = $(error_DATA)
+CLEANFILES = $(BUILT_SOURCES)
 	-avoid-version -module $(NO_UNDEFINED)
 
+
 -include $(top_srcdir)/git.mk
+
+
+
diff --git a/modules/mail/e-mail-shell-view-actions.c b/modules/mail/e-mail-shell-view-actions.c
index 22aa88e..9849e6d 100644
--- a/modules/mail/e-mail-shell-view-actions.c
+++ b/modules/mail/e-mail-shell-view-actions.c
@@ -18,8 +18,11 @@
  * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
  *
  */
+#include libedataserver/md5-utils.h
+#include camel/camel-stream-mem.h
 
 #include e-mail-shell-view-private.h
+#include e-util/e-error.h
 
 static void
 action_gal_save_custom_view_cb (GtkAction *action,
@@ -396,6 +399,140 @@ action_mail_folder_select_all_cb (GtkAction *action,
 		action_mail_folder_select_all_timeout_cb (message_list);
 }
 
+
+/* Helper for action_mail_folder_select_all_cb() */
+static const int hbucket = 16;
+
+static gint
+run_dialog (gint n_duplicates)
+{
+  gchar *str;
+  gint response;
+
+  str = g_strdup_printf (%i, n_duplicates);
+  response = e_error_run (NULL, remove-duplicates:delete-duplicates, str, NULL);
+  g_free (str);
+
+  return response;
+}
+
+static void
+delete_message_foreach (gpointer value, gpointer data)
+{
+  gchar *uid = value;
+  CamelFolder *folder = data;
+
+  camel_folder_delete_message (folder, uid);
+}
+
+static guchar*
+get_message_md5 (CamelFolder *folder,
+ const gchar *uid)
+{
+	CamelMimeMessage *msg;
+	CamelExceptionex;
+	CamelDataWrapper *content;
+	CamelStream  *mem;
+	guchar   *digest = NULL;
+
+	camel_exception_init (ex);
+	msg = camel_folder_get_message (folder, uid, ex);
+
+	if (camel_exception_is_set (ex)) {
+		camel_exception_clear (ex);
+		return NULL;
+	}
+
+	/* get message contents */
+	content = camel_medium_get_content_object ((CamelMedium *) msg);
+	if (!content)
+		return NULL;
+
+	/* calculate MD5 */
+	mem = camel_stream_mem_new ();
+	camel_data_wrapper_decode_to_stream (content, mem);
+	digest = g_new0 (guchar, hbucket);
+
+	md5_get_digest (((CamelStreamMem *) mem)-buffer-data,
+		((CamelStreamMem *) mem)-buffer-len, digest);
+
+	camel_object_unref (mem);
+	camel_object_unref (msg);
+
+	return digest;
+}
+
+static gboolean
+message_is_duplicated (GHashTable *messages, guint64 id, guchar *digest)
+{
+  guchar *hash_digest;
+  int i;
+
+  hash_digest = g_hash_table_lookup (messages, id);
+
+  if (!hash_digest)
+return FALSE;
+
+  for (i = 0; i  hbucket; i++)
+if (digest[i] != hash_digest[i])
+  return FALSE;
+
+  return TRUE;
+}
+
+static void
+action_mail_folder_select_duplicate (GtkAction *action,
+  EMailShellView *mail_shell_view)
+{
+	EShellView *shell_view;
+EShellContent *shell_content;
+EMailReader *reader;
+MessageList *message_list;
+GPtrArray *uids;
+	CamelFolder *folder;
+	GHashTable *messages;
+	GSList *duplicates = NULL;
+	gint i, n_duplicates;
+
+shell_view = E_SHELL_VIEW (mail_shell_view);
+shell_content = e_shell_view_get_shell_content (shell_view);
+
+reader = (EMailReader *) (shell_content);
+message_list = e_mail_reader_get_message_list (reader);
+uids = message_list_get_uids(message_list);
+	folder = message_list-folder;
+
+	messages = g_hash_table_new_full (g_int_hash, g_int_equal, g_free, g_free);
+
+	for (i = 0; i  uids-len; i++) {
+	CamelMessageInfo *msg_info = camel_folder_get_message_info (folder, uids-pdata[i]);
+	const CamelSummaryMessageID *mid = camel_message_info_message_id (msg_info);
+	guchar *digest = get_message_md5 (folder, uids-pdata[i]);
+	guint32 flags = camel_message_info_flags (msg_info);
+
+		if (!(flags  CAMEL_MESSAGE_DELETED)) {
+			if (message_is_duplicated (messages, mid-id.id, digest)) {
+duplicates = g_slist_prepend (duplicates, g_strdup (uids-pdata[i]));
+			} else {
+guint64 *id;
+id = g_new0 (guint64, 1);
+*id = mid-id.id;

Re: [Evolution-hackers] Evolution: Taking forward...

2008-09-16 Thread ritz
Hello

On Mon, 2008-09-15 at 12:35 +0100, Ross Burton wrote:
 On Fri, 2008-07-11 at 04:21 -0600, Srinivasa Ragavan wrote:
  It would be really helpful if you can post a public/explicit mail with
  permissions to do it, or code pointers - if you think you wrote a
  piece of Evolution code  object.
 

I have submitted very tiny bits, sorry, i do not remember which ones :(
Permission granted for any code I've produced.

 
 Ross
 ___
 Evolution-hackers mailing list
 Evolution-hackers@gnome.org
 http://mail.gnome.org/mailman/listinfo/evolution-hackers
-- 
Ritesh Khadgaray
Ph: +919970164885
Desktop LinuX N Stuff, RHCE
Software Maintenance Engineer, Pune, Red Hat
ॐ मणि पद्मे हूँ
Eat Right, Exercise, Die Anyway.


___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


Re: [Evolution-hackers] Error storing summary.

2008-05-12 Thread ritz
Hello

 sorry to barge in.

On Mon, 2008-05-12 at 15:34 +0530, Srinivasa Ragavan wrote:
 Sankar,
 
 Yet another solution for this problem will be to (re)write the local
 backend using the camel-offline-folder model, where every mail in the
 folder is stored in a distributed fashion, avoiding one huge mbox or
 huge files in a directory and also solves issues like unlink the file to
 delete a mail etc.
Is there any plan to implement this, or maildir format ? I am currently
approaching close to a gig, wrt, mbox file size which aint so good for
backup :(

 
 -Srini
 On Mon, 2008-05-12 at 14:51 +0530, Sankar P wrote:
  On Fri, 2008-05-09 at 23:57 +0200, Andre Klapper wrote:
   OK, so i managed to fuck up my POP Inbox for the third time in a few
   weeks, means: every time i switch to another folder i now get an Error
   storing summary (or something like that). i've seen some reports about
   this in bugzilla, e.g.
   http://bugzilla.gnome.org/show_bug.cgi?id=532049 . the last time i ran
   into this psankar told me to manually edit the mbox file and remove the
   offending email that misses the From line. this is not fun anymore when
   having a 600MB inbox file. a normal user is not willing to learn vim and
   emacs, me neither. 
  
  I guess there should have been some recent commit which catalyzes this
  break-up-of-mbox. So, we need to just analyze and find out on what
  scenarios this is caused.
  
  Earlier, we used to get a folder-summary-mismatch and will not proceed
  at all. I have seen some heavy users being saved from that trouble, once
  we put in the code to auto-fix the .summary file.
  
  Broken mboxes are one scenario which we have not handled so far and it
  will be fixed. May be we will provide: evolution-fix-broken-mbox which
  will handle them. (/me remembers fejj's mail sent 2 days back)
  
  However, there are certain important things than fixing broken mboxes,
  like moving the summary to a db so that you don't have to hold every
  msginfo etc. which we are currently working on. So, operations like mbox
  recovery will have to wait for some time.  We will try to identify why
  this has started happening frequently for you and will fix this soon,
  probably tracked in a bgo bug.
  
  
  
  Philip,
  
  Converting the local store from mbox to maildir will be a better option
  for the local accounts. It might create new problems and I will analyze
  about this and will come up with a fix if it does not cause any issue. 
  
  And sqlite databases disk-blocks aren't spectacularly closely-written,
  when I last iogrinded (ground?) them. And mboxes/maildir are readable by
  all sane mail clients and hence makes sense to stick to some common
  standard than a single-filed-db. May be I will make a study of this
  after the db-based summary work is done.
  
  
   if nobody's working on a fix i should consider
   switching to thunderbird.
  
  We will fix this bug as it is critical and comes from a long time user,
  whom we want to keep happy :-) However, mail is a hog that tends to bite
  if it exceeds a limit, no matter which application we use and we will
  try to tame the beast.
  
   
   andre
  
 
 ___
 Evolution-hackers mailing list
 Evolution-hackers@gnome.org
 http://mail.gnome.org/mailman/listinfo/evolution-hackers
-- 
Ritesh Khadgaray
Ph: +919970164885
Desktop LinuX N Stuff, RHCE
Software Maintenance Engineer, Pune, Red Hat
ॐ मणि पद्मे हूँ
Eat Right, Exercise, Die Anyway.


___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


Re: [Evolution-hackers] Fedora/ ZimbraEvolution: e-shell.h called by es-event.h, but not available with evolution-devel on

2008-01-13 Thread ritz
Hello

On Thu, 2007-11-29 at 15:14 -0500, Matthew Barnes wrote:
 On Fri, 2007-11-30 at 01:21 +0530, ritz wrote:
  e-shell.h is included by es-event.h, but not available with
  evolution-devel on Fedora8.i386
 
 Try applying the patch here:
 http://bugzilla.gnome.org/show_bug.cgi?id=499920
 
 I'm in the process of adding it to the Rawhide package now.  I can also
 add it to Fedora 8 if there's sufficient demand.

Filed a bug report at :
https://bugzilla.redhat.com/show_bug.cgi?id=428558

 
 Matthew Barnes
 
-- 
Ritesh Khadgaray
ॐ मणि पद्मे हूँ
Desktop LinuX N Stuff
Ph: +919970164885
Eat Right, Exercise, Die Anyway.
Fedora is the best of what works today.  Enterprise Linux is the best of
what will work consistently for the next seven years.

___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


[Evolution-hackers] Fedora/ ZimbraEvolution: e-shell.h called by es-event.h, but not available with evolution-devel on

2007-11-29 Thread ritz
Hello

  I am currently trying to build ZimbraEvoltuion from
http://zimbra.svn.sourceforge.net/svnroot/zimbra/trunk/ZimbraEvolution/ .

 Unfortunately, i am hitting a few bugs

1. Zimbra is hardcoded against Evolution 2.6/2.8, and not 2.12 
( hacked around )
2. Zimbra has issues when using intltool m4 macro on Fedora8.
( hacked around )

3. The one where i am stuck

e-shell.h is included by es-event.h, but not available with
evolution-devel on Fedora8.i386

$ grep e-shell /usr/include/evolution-2.12/shell/es-event.h
#include e-shell.h

$ rpm -qf /usr/include/evolution-2.12/shell/es-event.h
evolution-devel-2.12.1-3.fc8

$ rpm -ql evolution-devel|grep e-shell
/usr/include/evolution-2.12/shell/e-shell-utils.h


From what i am able to see, e-shell.h is a part of gnome 2.20
http://svn.gnome.org/viewvc/evolution/branches/gnome-2-20/shell/


$ yum -y update evolution\*
Setting up Update Process
Could not find update match for evolution*
No Packages marked for Update


-- 
Ritesh Khadgaray
ॐ मणि पद्मे हूँ
Desktop LinuX N Stuff
Ph: +919970164885
Eat Right, Exercise, Die Anyway.
Fedora is the best of what works today.  Enterprise Linux is the best of
what will work consistently for the next seven years.

___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


Re: [Evolution-hackers] Fedora/ ZimbraEvolution: e-shell.h called by es-event.h, but not available with evolution-devel on

2007-11-29 Thread ritz
Hello


On Thu, 2007-11-29 at 15:32 -0500, Matthew Barnes wrote:
 On Fri, 2007-11-30 at 01:21 +0530, ritz wrote:
I am currently trying to build ZimbraEvoltuion from
  http://zimbra.svn.sourceforge.net/svnroot/zimbra/trunk/ZimbraEvolution/ .
 
 Oh also, I learned that [1] is a more up-to-date repo.
 
 [1] https://zimbraevo.svn.sourceforge.net/svnroot/zimbraevo
Thanks, this seems  to be for Evo 2.10. Will hack this up for Evo2.12 .


 
 Matthew Barnes
 
-- 
Ritesh Khadgaray
ॐ मणि पद्मे हूँ
Desktop LinuX N Stuff
Ph: +919970164885
Eat Right, Exercise, Die Anyway.
Fedora is the best of what works today.  Enterprise Linux is the best of
what will work consistently for the next seven years.

___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers


Re: [Evolution-hackers] Evolution 2.11.6(.1), Evolution-Data-Server 1.11.6(.1), GtkHTML 3.15.6 and Evolution-Exchange 2.11.6(.1) released

2007-08-09 Thread ritz
Hello


On Wed, 2007-08-08 at 18:15 +0100, William John Murray wrote:
 On Wed, 2007-08-08 at 07:34 -0400, Matthew Barnes wrote:
  On Wed, 2007-08-08 at 12:03 +0100, William John Murray wrote:
I tried to build this release on F7, and got into a mess with
   gtkhtml. It has internal references to version 3.14, in
   configure/configure.in and lower down, and is I change these to 3.15.6
   it never seems to work.
  Are these supposed to be 3.14? What is the RIGHT way to fix them?
  
  It might be easier to just install packages from Fedora's development
  repository (soon to be Fedora 8).
  
  http://download.fedora.redhat.com/pub/fedora/linux/development/
  
  Matthew Barnes
  
 
 Thanks Matthew - except that on F7 there seems to be a packaging
 problem. If I yum update evolution --enablerepo=development (and add
 evolution-exchange via rpm) I get:
 undefined symbol:  g_once_init_enter_impl

 $ yum update glib2\*  --enablerepo=development


 errors on starting evolution.
 I will try a liveCD of f8 and see if evo 2.11 works nicely before
 installing it. 
  Bill
 
 ___
 Evolution-hackers mailing list
 Evolution-hackers@gnome.org
 http://mail.gnome.org/mailman/listinfo/evolution-hackers
-- 
Ritesh Khadgaray
ॐ मणि पद्मे हूँ
Desktop LinuX N Stuff
Ph: +919970164885
Eat Right, Exercise, Die Anyway.


smime.p7s
Description: S/MIME cryptographic signature
___
Evolution-hackers mailing list
Evolution-hackers@gnome.org
http://mail.gnome.org/mailman/listinfo/evolution-hackers