📄 natural-selection-0.3.diff
字号:
--- camel/camel-mime-message.c.orig 2003-02-13 17:31:53.000000000 +0100+++ camel/camel-mime-message.c 2003-02-13 17:32:12.000000000 +0100@@ -608,7 +608,6 @@ parent_class->parent_class.remove_header (medium, header_name); } -typedef gboolean (*CamelPartFunc)(CamelMimeMessage *, CamelMimePart *, void *data); static gboolean message_foreach_part_rec (CamelMimeMessage *msg, CamelMimePart *part, CamelPartFunc callback, void *data)@@ -642,7 +641,7 @@ /* dont make this public yet, it might need some more thinking ... */ /* MPZ */-static void+void camel_mime_message_foreach_part (CamelMimeMessage *msg, CamelPartFunc callback, void *data) { message_foreach_part_rec (msg, (CamelMimePart *)msg, callback, data);--- camel/camel-mime-message.h.orig 2003-02-13 17:31:53.000000000 +0100+++ camel/camel-mime-message.h 2003-02-13 17:32:12.000000000 +0100@@ -131,6 +131,11 @@ CamelMimePart *camel_mime_message_get_part_by_content_id (CamelMimeMessage *message, const char *content_id); +typedef gboolean (*CamelPartFunc)(CamelMimeMessage *, CamelMimePart *, void *data);++void+camel_mime_message_foreach_part (CamelMimeMessage *msg, CamelPartFunc callback, void *data);+ #ifdef __cplusplus } #endif /* __cplusplus */--- mail/Makefile.am.orig 2003-02-13 17:31:53.000000000 +0100+++ mail/Makefile.am 2003-02-13 17:32:12.000000000 +0100@@ -145,6 +145,12 @@ message-tag-followup.h \ subscribe-dialog.c \ subscribe-dialog.h \+ protocol_c.c \+ protocol_c.h \+ select.c \+ select.h \+ select-bar.c \+ select-bar.h \ mail.h # needs gtkhtml prop manager ported--- mail/folder-browser.c.orig 2003-02-13 17:31:53.000000000 +0100+++ mail/folder-browser.c 2003-02-13 17:32:12.000000000 +0100@@ -72,6 +72,11 @@ #include "mail-local.h" #include "mail-config.h" +#include "select.h"+#include "select-bar.h"++#include "mail-config.h"+ #include <camel/camel-mime-message.h> #include <camel/camel-stream-mem.h> @@ -198,6 +203,11 @@ folder_browser->view_menus = NULL; } + if (folder_browser->select_bar) {+ gtk_widget_destroy (GTK_WIDGET (folder_browser->select_bar));+ folder_browser->select_bar = NULL;+ }+ /* wait for all outstanding async events against us */ mail_async_event_destroy (folder_browser->async_event); @@ -907,6 +917,13 @@ if (fb->uicomp) folder_browser_ui_set_selection_state (fb, FB_SELSTATE_NONE); + if (fb->folder == mail_tool_get_local_inbox (NULL)) {+ fb->select_bar = SELECT_BAR (select_bar_new (fb));+ gtk_box_pack_end (GTK_BOX (fb->vbox),+ GTK_WIDGET (fb->select_bar),+ FALSE, FALSE, 0);+ }+ done: g_signal_emit (fb, folder_browser_signals[FOLDER_LOADED], 0, fb->uri); g_object_unref (fb);@@ -2361,7 +2378,14 @@ gconf = gconf_client_get_default (); paned_size = gconf_client_get_int (gconf, "/apps/evolution/mail/display/paned_size", NULL);- gtk_paned_add2 (GTK_PANED (fb->vpaned), GTK_WIDGET (fb->mail_display));+ //gtk_paned_add2 (GTK_PANED (fb->vpaned), GTK_WIDGET (fb->mail_display));+ fb->vbox = gtk_vbox_new (FALSE, 0);+ gtk_box_pack_end (GTK_BOX (fb->vbox), GTK_WIDGET (fb->mail_display),+ TRUE, TRUE, 0);+ + gtk_widget_show (fb->vbox);+ gtk_paned_add2 (GTK_PANED (fb->vpaned), fb->vbox);+ gtk_paned_set_position (GTK_PANED (fb->vpaned), paned_size); gtk_widget_show (GTK_WIDGET (fb->mail_display)); gtk_widget_show (GTK_WIDGET (fb));@@ -2422,6 +2446,9 @@ fb->loaded_uid = fb->loading_uid; fb->loading_uid = NULL; + if (fb->select_bar)+ select_classify (msg, fb->select_bar);+ folder_browser_ui_message_loaded (fb); /* if we are still on the same message, do the 'idle read' thing */--- mail/folder-browser.h.orig 2003-02-13 17:31:53.000000000 +0100+++ mail/folder-browser.h 2003-02-13 17:32:12.000000000 +0100@@ -66,6 +66,8 @@ MessageList *message_list; MailDisplay *mail_display;+ SelectBar *select_bar;+ GtkWidget *vbox; GtkWidget *vpaned; EFilterBar *search;--- mail/mail-ops.c.orig 2003-02-13 17:31:53.000000000 +0100+++ mail/mail-ops.c 2003-02-13 17:32:12.000000000 +0100@@ -50,6 +50,8 @@ #include "mail-mt.h" #include "mail-folder-cache.h" +#include "select.h"+ #define w(x) #define d(x) @@ -932,6 +934,7 @@ { struct _transfer_msg *m = (struct _transfer_msg *)mm; CamelFolder *dest;+ int i; dest = mail_tool_uri_to_folder (m->dest_uri, m->dest_flags, &mm->ex); if (camel_exception_is_set (&mm->ex))@@ -943,6 +946,16 @@ return; } + for (i = 0; i < m->uids->len; i++) {+ CamelMimeMessage *msg;++ msg = camel_folder_get_message (m->source,+ (char *)m->uids->pdata[i],+ NULL);+ select_learn (msg, dest);+ //camel_object_unref (CAMEL_OBJECT (msg));+ }+ camel_folder_freeze (m->source); camel_folder_freeze (dest); --- mail/mail-types.h.orig 2003-02-13 17:31:53.000000000 +0100+++ mail/mail-types.h 2003-02-13 17:32:12.000000000 +0100@@ -32,6 +32,7 @@ typedef struct _SubscribeDialog SubscribeDialog; typedef struct _MessageList MessageList; typedef struct _MailDisplay MailDisplay;+typedef struct _SelectBar SelectBar; #ifdef __cplusplus }--- mail/protocol_c.c.orig 1970-01-01 01:00:00.000000000 +0100+++ mail/protocol_c.c 2003-02-13 17:32:12.000000000 +0100@@ -0,0 +1,569 @@+/* Copyright (C) 2002 Mikael Ylikoski+ *+ * This program is free software; you can redistribute it and/or modify+ * it under the terms of the GNU General Public License, Version 2 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.+ */+/**+ * @file+ * Classification daemon protocol, client side.+ * Helper functions for Select clients.+ *+ * \todo Check for buffer overruns (pd->bp >= pd->buf + pd->len).+ *+ * @author Mikael Ylikoski+ * @date 2002+ */++#include <stdio.h>+#include <stdlib.h>+#include <string.h>+#include <sys/socket.h>+#include <sys/un.h>+#include <unistd.h>+#include "protocol_c.h"+++/**+ * Client protocol data.+ */+struct protocol_c_data_ {+ int sockfd; /**< Socket file descriptor */+ char *buf; /**< Input/Output buffer */+ char *bp; /**< Input/Output buffer pointer */+ int blen; /**< Input/Output buffer length */+ int len; /**< Currently used input buffer length */+ struct sockaddr_un addr; /**< Socket address */+};+++/**+ * Create a new protocol session data structure.+ */+protocol_c_data *+protocol_c_new (int len, const char *addr) {+ int i;+ protocol_c_data *pd;++ pd = malloc (sizeof(protocol_c_data));+ if (!pd)+ return NULL;+ pd->buf = malloc (len + 1);+ if (!pd->buf) {+ free (pd);+ return NULL;+ }+ pd->bp = pd->buf;+ pd->blen = len;+ pd->len = 0;+ pd->sockfd = -1;++ pd->addr.sun_family = AF_UNIX;+ memset (pd->addr.sun_path, 0, sizeof(pd->addr.sun_path));++ if (!addr)+ addr = "@my_select_classifier";++ i = strlen (addr);+ if (i > sizeof(pd->addr.sun_path) - 1)+ i = sizeof(pd->addr.sun_path) - 1;+ memcpy (pd->addr.sun_path, addr, i);+ if (pd->addr.sun_path[0] == '@')+ pd->addr.sun_path[0] = 0;++ return pd;+}+++/**+ * Free protocol data.+ *+ * @param pd protocol data to free+ */+void+protocol_c_free (protocol_c_data *pd) {+ if (pd->sockfd >= 0)+ close (pd->sockfd);+ free (pd->buf);+ free (pd);+}+++/**+ * Send a message.+ *+ * @param pd protocol session data+ * @return Zero if ok, or nonzero otherwise.+ */+static int+protocol_send (protocol_c_data *pd) {+ int i, j;++ //pd->bp[0] = '\0';+ //printf ("send<%s>\n", pd->buf);++ *pd->bp = '\n';+ j = pd->bp - pd->buf + 1;+ i = send (pd->sockfd, pd->buf, j, 0);+ pd->bp = pd->buf;+ pd->len = 0;+ if (i == j)+ return 0;+ return -1;+}+++/**+ * Receive a message.+ *+ * @param pd protocol session data+ * @return Zero if ok, or nonzero otherwise.+ */+static int+protocol_receive (protocol_c_data *pd) {+ int i;++ /*+ if (pd->bp - pd->buf < pd->len)+ return 0;+ */+ pd->bp = pd->buf;+ i = recv (pd->sockfd, pd->bp, pd->blen, 0);+ if (i < 1) {+ fprintf (stderr, "Error: No data!\n");+ return -1;+ }+ pd->len = i;+ if (pd->len == pd->blen) {+ fprintf (stderr, "Error: Too much data!\n");+ return -1;+ }+ pd->buf[pd->len] = '\0';++ //printf ("recv<%s>\n", pd->buf);++ return 0;+}+++/**+ * Make an open request.+ *+ * @param pd protocol session data+ * @return Zero if ok, or nonzero otherwise.+ */+int+protocol_c_open (protocol_c_data *pd) {+ int i;++ pd->bp = pd->buf;+ pd->bp += sprintf (pd->buf, "open");+ pd->len = 0;++ pd->sockfd = socket (PF_UNIX, SOCK_STREAM, 0);+ if (pd->sockfd == -1) {+ fprintf (stderr, "Error creating socket\n");+ return -1;+ }+ i = connect (pd->sockfd, (struct sockaddr *)&pd->addr, sizeof(pd->addr));+ if (i) {+ fprintf (stderr, "Error connecting socket\n");+ return -1;+ }+ i = protocol_send (pd);+ if (i) {+ fprintf (stderr, "Error sending message\n");+ return -1;+ }++ /* Receive ack */+ //protocol_wait_ok (pd);++ return 0;+}+++/**+ * Send a close request.+ *+ * @param pd protocol session data+ * @return Zero if ok, or nonzero otherwise.+ */+int+protocol_c_close (protocol_c_data *pd) {+ pd->bp = pd->buf;+ pd->bp += sprintf (pd->bp, "close\n");+ protocol_send (pd);++ close (pd->sockfd);+ pd->sockfd = -1;++ return 0;+}+++int+protocol_c_part (protocol_c_data *pd, const char *type, const char *charset,+ const char *string, int len) {+ int i;++ pd->bp = pd->buf;+ pd->bp += sprintf (pd->bp, "part:");++ /* type */+ i = strlen (type);+ memcpy (pd->bp, type, i);+ pd->bp += i;+ *pd->bp = ':';+ pd->bp++;++ /* charset */+ if (charset) {+ i = strlen (charset);+ memcpy (pd->bp, charset, i);+ pd->bp += i;+ }+ *pd->bp = ':';+ pd->bp++;++ /* len */+ pd->bp += sprintf (pd->bp, "%d", len);+ *pd->bp = ':';+ pd->bp++;++ /* string */+ memcpy (pd->bp, string, len);+ pd->bp += len;++ return protocol_send (pd);+}+++int+protocol_c_learn (protocol_c_data *pd, int class) {+ pd->bp = pd->buf;+ pd->bp += sprintf (pd->bp, "learn:%d", class);+ return protocol_send (pd);+}+++int+protocol_c_learn_folder (protocol_c_data *pd, const char *class) {+ pd->bp = pd->buf;+ pd->bp += sprintf (pd->bp, "learn:\"%s\"", class);+ return protocol_send (pd);+}+++int+protocol_c_unlearn (protocol_c_data *pd, int class) {+ pd->bp = pd->buf;+ pd->bp += sprintf (pd->bp, "unlearn:%d", class);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -