CVS: sylpheed-claws/src compose.c,1.382.2.269,1.382.2.270 compose.h,1.50.2.24,1.50.2.25 main.c,1.115.2.83,1.115.2.84 mh.c,1.79.2.24,1.79.2.25
Colin Leroy <[email protected]>
| Newsgroups | gmane.mail.sylpheed.claws.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/sylpheed-claws/sylpheed-claws/src
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv23794/src
Modified Files:
Tag: gtk2
compose.c compose.h main.c mh.c
Log Message:
2006-05-12 [colin] 2.2.0cvs4
* src/compose.c
* src/compose.h
Let From be editable
* src/main.c
* src/mh.c
Full support of .mh_sequences' Unseen seq
Index: compose.c
===================================================================
RCS file: /cvsroot/sylpheed-claws/sylpheed-claws/src/compose.c,v
retrieving revision 1.382.2.269
retrieving revision 1.382.2.270
diff -u -r1.382.2.269 -r1.382.2.270
--- compose.c 25 Apr 2006 16:59:46 -0000 1.382.2.269
+++ compose.c 12 May 2006 17:46:08 -0000 1.382.2.270
@@ -2645,6 +2645,7 @@
g_return_if_fail(msginfo != NULL);
SET_ENTRY(subject_entry, msginfo->subject);
+ SET_ENTRY(from_name, msginfo->from);
SET_ADDRESS(COMPOSE_TO, msginfo->to);
SET_ADDRESS(COMPOSE_CC, compose->cc);
SET_ADDRESS(COMPOSE_BCC, compose->bcc);
@@ -3772,15 +3773,84 @@
return ac;
}
+#define QUOTE_IF_REQUIRED(out, str) \
+{ \
+ if (*str != '"' && strpbrk(str, ",.[]<>")) { \
+ gchar *__tmp; \
+ gint len; \
+ \
+ len = strlen(str) + 3; \
+ if ((__tmp = alloca(len)) == NULL) { \
+ g_warning("can't allocate memory\n"); \
+ g_string_free(header, TRUE); \
+ return NULL; \
+ } \
+ g_snprintf(__tmp, len, "\"%s\"", str); \
+ out = __tmp; \
+ } else { \
+ gchar *__tmp; \
+ \
+ if ((__tmp = alloca(strlen(str) + 1)) == NULL) { \
+ g_warning("can't allocate memory\n"); \
+ g_string_free(header, TRUE); \
+ return NULL; \
+ } else \
+ strcpy(__tmp, str); \
+ \
+ out = __tmp; \
+ } \
+}
+
+#define QUOTE_IF_REQUIRED_NORMAL(out, str, errret) \
+{ \
+ if (*str != '"' && strpbrk(str, ",.[]<>")) { \
+ gchar *__tmp; \
+ gint len; \
+ \
+ len = strlen(str) + 3; \
+ if ((__tmp = alloca(len)) == NULL) { \
+ g_warning("can't allocate memory\n"); \
+ errret; \
+ } \
+ g_snprintf(__tmp, len, "\"%s\"", str); \
+ out = __tmp; \
+ } else { \
+ gchar *__tmp; \
+ \
+ if ((__tmp = alloca(strlen(str) + 1)) == NULL) { \
+ g_warning("can't allocate memory\n"); \
+ errret; \
+ } else \
+ strcpy(__tmp, str); \
+ \
+ out = __tmp; \
+ } \
+}
+
static void compose_select_account(Compose *compose, PrefsAccount *account,
gboolean init)
{
GtkItemFactory *ifactory;
+ gchar *from = NULL;
g_return_if_fail(account != NULL);
compose->account = account;
+ if (account->name && *account->name) {
+ gchar *buf;
+ QUOTE_IF_REQUIRED_NORMAL(buf, account->name, return);
+ from = g_strdup_printf("%s <%s>",
+ buf, account->address);
+ gtk_entry_set_text(GTK_ENTRY(compose->from_name), from);
+ } else {
+ from = g_strdup_printf("<%s>",
+ account->address);
+ gtk_entry_set_text(GTK_ENTRY(compose->from_name), from);
+ }
+
+ g_free(from);
+
compose_set_title(compose);
ifactory = gtk_item_factory_from_widget(compose->menubar);
@@ -4637,6 +4707,7 @@
if (newsac)
fprintf(fp, "NAID:%d\n", newsac->account_id);
+
if (compose->privacy_system != NULL) {
fprintf(fp, "X-Sylpheed-Privacy-System:%s\n", compose->privacy_system);
fprintf(fp, "X-Sylpheed-Sign:%d\n", compose->use_signing);
@@ -4819,34 +4890,6 @@
} while (gtk_tree_model_iter_next(model, &iter));
}
-#define QUOTE_IF_REQUIRED(out, str) \
-{ \
- if (*str != '"' && strpbrk(str, ",.[]<>")) { \
- gchar *__tmp; \
- gint len; \
- \
- len = strlen(str) + 3; \
- if ((__tmp = alloca(len)) == NULL) { \
- g_warning("can't allocate memory\n"); \
- g_string_free(header, TRUE); \
- return NULL; \
- } \
- g_snprintf(__tmp, len, "\"%s\"", str); \
- out = __tmp; \
- } else { \
- gchar *__tmp; \
- \
- if ((__tmp = alloca(strlen(str) + 1)) == NULL) { \
- g_warning("can't allocate memory\n"); \
- g_string_free(header, TRUE); \
- return NULL; \
- } else \
- strcpy(__tmp, str); \
- \
- out = __tmp; \
- } \
-}
-
#define IS_IN_CUSTOM_HEADER(header) \
(compose->account->add_customhdr && \
custom_header_find(compose->account->customhdr_list, header) != NULL)
@@ -4915,6 +4958,8 @@
GSList *list;
gchar *std_headers[] = {"To:", "Cc:", "Bcc:", "Newsgroups:", "Reply-To:", "Followup-To:", NULL};
GString *header;
+ gchar *from_name = NULL, *from_address = NULL;
+ gchar *tmp;
g_return_val_if_fail(compose->account != NULL, NULL);
g_return_val_if_fail(compose->account->address != NULL, NULL);
@@ -4928,16 +4973,52 @@
}
/* From */
+
if (compose->account->name && *compose->account->name) {
+ gchar *buf;
+ QUOTE_IF_REQUIRED(buf, compose->account->name);
+ tmp = g_strdup_printf("%s <%s>",
+ buf, compose->account->address);
+ } else {
+ tmp = g_strdup_printf("%s",
+ compose->account->address);
+ }
+ if (!strcmp(gtk_entry_get_text(GTK_ENTRY(compose->from_name)), tmp)
+ || strlen(gtk_entry_get_text(GTK_ENTRY(compose->from_name))) == 0) {
+ /* use default */
+ from_name = compose->account->name ? g_strdup(compose->account->name):NULL;
+ from_address = g_strdup(compose->account->address);
+ } else {
+ gchar *spec = gtk_editable_get_chars(GTK_EDITABLE(compose->from_name), 0, -1);
+ /* extract name and address */
+ if (strstr(spec, " <") && strstr(spec, ">")) {
+ from_address = g_strdup(strrchr(spec, '<')+1);
+ *(strrchr(from_address, '>')) = '\0';
+ from_name = g_strdup(spec);
+ *(strrchr(from_name, '<')) = '\0';
+ } else {
+ from_name = NULL;
+ from_address = g_strdup(spec);
+ }
+ g_free(spec);
+ }
+ g_free(tmp);
+
+
+ if (from_name && *from_name) {
compose_convert_header
- (compose, buf, sizeof(buf), compose->account->name,
+ (compose, buf, sizeof(buf), from_name,
strlen("From: "), TRUE);
QUOTE_IF_REQUIRED(name, buf);
+
g_string_append_printf(header, "From: %s <%s>\n",
- name, compose->account->address);
+ name, from_address);
} else
- g_string_append_printf(header, "From: %s\n", compose->account->address);
+ g_string_append_printf(header, "From: %s\n", from_address);
+ g_free(from_name);
+ g_free(from_address);
+
/* To */
compose_add_headerfield_from_headerlist(compose, header, "To", ", ");
@@ -5238,6 +5319,8 @@
/* Entry field */
entry = gtk_entry_new();
gtk_widget_show(entry);
+ gtk_tooltips_set_tip(compose->tooltips, entry,
+ _("Use <tab> to autocomplete from addressbook"), NULL);
gtk_table_attach(GTK_TABLE(compose->header_table), entry, 1, 2, compose->header_nextrow, compose->header_nextrow+1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
g_signal_connect(G_OBJECT(entry), "key-press-event",
@@ -5307,11 +5390,11 @@
hbox = gtk_hbox_new(FALSE, 0);
label = gtk_label_new(prefs_common.trans_hdr ? _("From:") : "From:");
gtk_box_pack_end(GTK_BOX(hbox), label, FALSE, FALSE, 0);
- gtk_table_attach(GTK_TABLE(header_table), hbox, 0, 1, count, count + 1,
- GTK_FILL, 0, 2, 0);
+ //gtk_table_attach(GTK_TABLE(header_table), hbox, 0, 1, count, count + 1,
+ // GTK_FILL, 0, 2, 0);
from_optmenu_hbox = compose_account_option_menu_create(compose);
gtk_table_attach(GTK_TABLE(header_table), from_optmenu_hbox,
- 1, 2, count, count + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
+ 0, 2, count, count + 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0);
count++;
compose->header_table = header_table;
@@ -5666,6 +5749,8 @@
compose->mutex = g_mutex_new();
compose->set_cursor_pos = -1;
+ compose->tooltips = gtk_tooltips_new();
+
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_resizable(GTK_WINDOW(window), TRUE);
gtk_widget_set_size_request(window, -1, prefs_common.compose_height);
@@ -6018,45 +6103,56 @@
static GtkWidget *compose_account_option_menu_create(Compose *compose)
{
GList *accounts;
+ GtkWidget *hbox;
GtkWidget *optmenu;
GtkWidget *menu;
- gint num = 0, def_menu = 0;
+ GtkWidget *from_name = NULL;
+ gint num = 0, def_menu = 0;
+
accounts = account_get_list();
g_return_val_if_fail(accounts != NULL, NULL);
optmenu = gtk_option_menu_new();
menu = gtk_menu_new();
+ hbox = gtk_hbox_new(FALSE, 6);
+ from_name = gtk_entry_new();
+
for (; accounts != NULL; accounts = accounts->next, num++) {
PrefsAccount *ac = (PrefsAccount *)accounts->data;
GtkWidget *menuitem;
- gchar *name;
+ gchar *name, *from = NULL;
if (ac == compose->account) def_menu = num;
- if (prefs_common.compose_no_markup) {
- if (ac->name)
- name = g_markup_printf_escaped("%s : %s <%s>",
- ac->account_name,
- ac->name, ac->address);
- else
- name = g_markup_printf_escaped("%s : <%s>",
- ac->account_name, ac->address);
+ if (ac->name) {
+ name = g_markup_printf_escaped("From: <i>%s</i>",
+ ac->account_name);
} else {
- if (ac->name)
- name = g_markup_printf_escaped("<i>%s</i> : %s <<b>%s</b>>",
- ac->account_name,
- ac->name, ac->address);
- else
- name = g_markup_printf_escaped("<i>%s</i> : <<b>%s</b>>",
- ac->account_name, ac->address);
+ name = g_markup_printf_escaped("From: <i>%s</i>",
+ ac->account_name);
+ }
+
+ if (ac == compose->account) {
+ if (ac->name && *ac->name) {
+ gchar *buf;
+ QUOTE_IF_REQUIRED_NORMAL(buf, ac->name, return NULL);
+ from = g_strdup_printf("%s <%s>",
+ buf, ac->address);
+ gtk_entry_set_text(GTK_ENTRY(from_name), from);
+ } else {
+ from = g_strdup_printf("%s",
+ ac->address);
+ gtk_entry_set_text(GTK_ENTRY(from_name), from);
+ }
}
MENUITEM_ADD(menu, menuitem, name, ac->account_id);
gtk_label_set_use_markup (
GTK_LABEL (gtk_bin_get_child (GTK_BIN (menuitem))),
TRUE);
g_free(name);
+ g_free(from);
g_signal_connect(G_OBJECT(menuitem), "activate",
G_CALLBACK(account_activated),
compose);
@@ -6065,7 +6161,17 @@
gtk_option_menu_set_menu(GTK_OPTION_MENU(optmenu), menu);
gtk_option_menu_set_history(GTK_OPTION_MENU(optmenu), def_menu);
- return optmenu;
+ gtk_box_pack_start(GTK_BOX(hbox), optmenu, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), from_name, TRUE, TRUE, 0);
+
+ gtk_tooltips_set_tip(compose->tooltips, optmenu,
+ _("Account to use for this email"), NULL);
+ gtk_tooltips_set_tip(compose->tooltips, from_name,
+ _("Sender address to be used"), NULL);
+
+ compose->from_name = from_name;
+
+ return hbox;
}
static void compose_set_priority_cb(gpointer data,
@@ -7431,6 +7537,7 @@
/* Save draft infos */
fprintf(fp, "X-Sylpheed-Account-Id:%d\n", compose->account->account_id);
fprintf(fp, "S:%s\n", compose->account->address);
+
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(compose->savemsg_checkbtn))) {
gchar *savefolderid;
Index: compose.h
===================================================================
RCS file: /cvsroot/sylpheed-claws/sylpheed-claws/src/compose.h,v
retrieving revision 1.50.2.24
retrieving revision 1.50.2.25
diff -u -r1.50.2.24 -r1.50.2.25
--- compose.h 19 Apr 2006 17:28:39 -0000 1.50.2.24
+++ compose.h 12 May 2006 17:46:08 -0000 1.50.2.25
@@ -98,23 +98,7 @@
/* Header */
GtkWidget *table_vbox;
GtkWidget *table;
-/*
- GtkWidget *to_hbox;
- GtkWidget *to_entry;
- GtkWidget *newsgroups_hbox;
- GtkWidget *newsgroups_entry;
-*/
GtkWidget *subject_entry;
-/*
- GtkWidget *cc_hbox;
- GtkWidget *cc_entry;
- GtkWidget *bcc_hbox;
- GtkWidget *bcc_entry;
- GtkWidget *reply_hbox;
- GtkWidget *reply_entry;
- GtkWidget *followup_hbox;
- GtkWidget *followup_entry;
-*/
GtkWidget *paned;
/* Attachments */
@@ -131,6 +115,8 @@
GtkWidget *ruler;
GtkWidget *scrolledwin;
GtkWidget *text;
+ GtkWidget *from_name;
+ GtkTooltips *tooltips;
GtkWidget *focused_editable;
Index: main.c
===================================================================
RCS file: /cvsroot/sylpheed-claws/sylpheed-claws/src/main.c,v
retrieving revision 1.115.2.83
retrieving revision 1.115.2.84
diff -u -r1.115.2.83 -r1.115.2.84
--- main.c 5 May 2006 16:17:37 -0000 1.115.2.83
+++ main.c 12 May 2006 17:46:08 -0000 1.115.2.84
@@ -917,7 +917,7 @@
void app_will_exit(GtkWidget *widget, gpointer data)
{
MainWindow *mainwin = data;
-
+
if (compose_get_compose_list()) {
gint val = alertpanel(_("Really quit?"),
_("Composing message exists."),
@@ -945,7 +945,8 @@
}
sock_cleanup();
-
+ if (folderview_get_selected_item(mainwin->folderview))
+ folder_item_close(folderview_get_selected_item(mainwin->folderview));
gtk_main_quit();
}
Index: mh.c
===================================================================
RCS file: /cvsroot/sylpheed-claws/sylpheed-claws/src/mh.c,v
retrieving revision 1.79.2.24
retrieving revision 1.79.2.25
diff -u -r1.79.2.24 -r1.79.2.25
--- mh.c 1 Mar 2006 18:38:23 -0000 1.79.2.24
+++ mh.c 12 May 2006 17:46:09 -0000 1.79.2.25
@@ -126,6 +126,11 @@
static gboolean mh_scan_required (Folder *folder,
FolderItem *item);
+static int mh_item_close (Folder *folder,
+ FolderItem *item);
+static gint mh_get_flags (Folder *folder, FolderItem *item,
+ MsgInfoList *msginfo_list, GRelation *msgflags);
+static void mh_write_sequences (FolderItem *item);
static FolderClass mh_class;
@@ -151,7 +156,9 @@
mh_class.remove_folder = mh_remove_folder;
mh_class.get_num_list = mh_get_num_list;
mh_class.scan_required = mh_scan_required;
-
+ mh_class.close = mh_item_close;
+ mh_class.get_flags = mh_get_flags;
+
/* Message functions */
mh_class.get_msginfo = mh_get_msginfo;
mh_class.fetch_msg = mh_fetch_msg;
@@ -421,7 +428,7 @@
g_free(destfile);
dest->last_num++;
}
-
+ mh_write_sequences(dest);
return dest->last_num;
}
@@ -527,6 +534,8 @@
dest_need_scan = mh_scan_required(dest->folder, dest);
if (!dest_need_scan)
dest->mtime = time(NULL);
+ else
+ mh_write_sequences(dest);
return dest->last_num;
}
@@ -568,6 +577,8 @@
val = remove_all_numbered_files(path);
g_free(path);
+ mh_write_sequences(item);
+
return val;
}
@@ -997,22 +1008,6 @@
#endif
item->mtime = time(NULL);
-
-/*
- if (item->path) {
- gint new, unread, total, min, max;
-
- procmsg_get_mark_sum(item->path, &new, &unread, &total,
- &min, &max, 0);
- if (n_msg > total) {
- new += n_msg - total;
- unread += n_msg - total;
- }
- item->new = new;
- item->unread = unread;
- item->total = n_msg;
- }
-*/
}
static gboolean mh_rename_folder_func(GNode *node, gpointer data)
@@ -1066,3 +1061,215 @@
return utf8path;
}
+
+static gint sort_cache_list_by_msgnum(gconstpointer a, gconstpointer b)
+{
+ MsgInfo *msginfo_a = (MsgInfo *) a;
+ MsgInfo *msginfo_b = (MsgInfo *) b;
+
+ return (msginfo_a->msgnum - msginfo_b->msgnum);
+}
+
+static gchar *get_unseen_seq_name(void)
+{
+ static gchar *seq_name = NULL;
+ if (!seq_name) {
+ gchar buf[BUFFSIZE];
+ gchar *tmp;
+ gchar *profile_path = g_strconcat(
+ g_get_home_dir(), G_DIR_SEPARATOR_S,
+ ".mh_profile", NULL);
+ FILE *fp = g_fopen(profile_path, "r");
+ if (fp) {
+ while (fgets(buf, sizeof(buf), fp) != NULL) {
+ if (!strncmp(buf, "Unseen-Sequence:", strlen("Unseen-Sequence:"))) {
+ gchar *seq_tmp = buf+strlen("Unseen-Sequence:");
+ while (*seq_tmp == ' ')
+ seq_tmp++;
+ seq_name = g_strdup(seq_tmp);
+ seq_name = strretchomp(seq_name);
+ break;
+ }
+ }
+ fclose(fp);
+ }
+ if (!seq_name)
+ seq_name = g_strdup("unseen");
+ tmp = g_strdup_printf("%s:", seq_name);
+ g_free(seq_name);
+ seq_name = tmp;
+ }
+ return seq_name;
+}
+
+static gint mh_get_flags(Folder *folder, FolderItem *item,
+ MsgInfoList *msginfo_list, GRelation *msgflags)
+{
+ gchar *mh_sequences_filename;
+ FILE *mh_sequences_file;
+ gchar buf[BUFFSIZE];
+ gchar *unseen_list = NULL;
+ gchar *path;
+ MsgInfoList *mcur = NULL;
+/*
+ GTimer *timer = g_timer_new();
+ g_timer_start(timer);
+*/
+ if (!item)
+ return 0;
+ path = folder_item_get_path(item);
+
+ mh_sequences_filename = g_strconcat(path, G_DIR_SEPARATOR_S,
+ ".mh_sequences", NULL);
+ g_free(path);
+ if ((mh_sequences_file = g_fopen(mh_sequences_filename, "r+b")) != NULL) {
+ while (fgets(buf, sizeof(buf), mh_sequences_file) != NULL) {
+ if (!strncmp(buf, get_unseen_seq_name(), strlen(get_unseen_seq_name()))) {
+ unseen_list = g_strdup(buf+strlen(get_unseen_seq_name()));
+ break;
+ }
+ }
+ fclose(mh_sequences_file);
+ }
+ if (unseen_list) {
+ gchar *cur = NULL;
+ gchar *token = NULL, *next = NULL, *boundary = NULL;
+ gint num = 0;
+ GHashTable *unseen_table = g_hash_table_new(g_direct_hash, g_direct_equal);
+
+ cur = unseen_list = strretchomp(unseen_list);
+ debug_print("found unseen list in .mh_sequences: %s\n", unseen_list);
+next_token:
+ while (*cur && *cur == ' ')
+ cur++;
+
+ if ((next = strchr(cur, ' ')) != NULL) {
+ token = cur;
+ cur = next+1;
+ *next = '\0';
+ } else {
+ token = cur;
+ cur = NULL;
+ }
+
+ if ((boundary = strchr(token, '-')) != NULL) {
+ gchar *start, *end;
+ int i;
+ start = token;
+ end = boundary+1;
+ *boundary='\0';
+ for (i = atoi(start); i <= atoi(end); i++) {
+ g_hash_table_insert(unseen_table, GINT_TO_POINTER(i), GINT_TO_POINTER(1));
+ }
+ } else if ((num = atoi(token)) > 0) {
+ g_hash_table_insert(unseen_table, GINT_TO_POINTER(num), GINT_TO_POINTER(1));
+ }
+
+ if (cur)
+ goto next_token;
+ for (mcur = msginfo_list; mcur; mcur = mcur->next) {
+ MsgInfo *msginfo = (MsgInfo *)mcur->data;
+ MsgPermFlags flags = msginfo->flags.perm_flags;
+ if (g_hash_table_lookup(unseen_table, GINT_TO_POINTER(msginfo->msgnum))) {
+ flags |= MSG_UNREAD;
+ } else if (!(flags & MSG_NEW)) { /* don't mark new msgs as read */
+ flags &= ~(MSG_UNREAD);
+ }
+ if (flags != msginfo->flags.perm_flags)
+ g_relation_insert(msgflags, msginfo, GINT_TO_POINTER(flags));
+ }
+ g_hash_table_destroy(unseen_table);
+ g_free(unseen_list);
+ }
+/*
+ g_timer_stop(timer);
+ printf("mh_get_flags: %f secs\n", g_timer_elapsed(timer, NULL));
+ g_timer_destroy(timer);
+*/
+ return 0;
+}
+
+static void mh_write_sequences(FolderItem *item)
+{
+ gchar *mh_sequences_old, *mh_sequences_new;
+ FILE *mh_sequences_old_fp, *mh_sequences_new_fp;
+ gchar buf[BUFFSIZE];
+ gchar *path = NULL;
+/*
+ GTimer *timer = g_timer_new();
+ g_timer_start(timer);
+*/
+ if (!item)
+ return;
+
+ path = folder_item_get_path(item);
+
+ mh_sequences_old = g_strconcat(path, G_DIR_SEPARATOR_S,
+ ".mh_sequences", NULL);
+ mh_sequences_new = g_strconcat(path, G_DIR_SEPARATOR_S,
+ ".mh_sequences.new", NULL);
+ if ((mh_sequences_new_fp = g_fopen(mh_sequences_new, "w+b")) != NULL) {
+ GSList *msglist = folder_item_get_msg_list(item);
+ GSList *cur;
+ MsgInfo *info = NULL;
+ gint start = -1, end = -1;
+ gchar *sequence = g_strdup("");
+ msglist = g_slist_sort(msglist, sort_cache_list_by_msgnum);
+ cur = msglist;
+
+ /* write the unseen sequence */
+ do {
+ info = (MsgInfo *)(cur ? cur->data:NULL);
+ if (info && (MSG_IS_UNREAD(info->flags) || MSG_IS_NEW(info->flags))) {
+ if (start < 0)
+ start = end = info->msgnum;
+ else
+ end = info->msgnum;
+ } else {
+ if (start > 0 && end > 0) {
+ gchar *tmp = sequence;
+ if (start != end)
+ sequence = g_strdup_printf("%s %d-%d ", tmp, start, end);
+ else
+ sequence = g_strdup_printf("%s %d ", tmp, start);
+ g_free(tmp);
+ start = end = -1;
+ }
+ }
+ cur = cur ? cur->next:NULL;
+ } while (cur || (start > 0 && end > 0));
+ if (sequence && strlen(sequence)) {
+ fprintf(mh_sequences_new_fp, "%s%s\n",
+ get_unseen_seq_name(), sequence);
+ debug_print("wrote unseen sequence: '%s%s'\n",
+ get_unseen_seq_name(), sequence);
+ }
+ /* rewrite the rest of the file */
+ if ((mh_sequences_old_fp = g_fopen(mh_sequences_old, "r+b")) != NULL) {
+ while (fgets(buf, sizeof(buf), mh_sequences_old_fp) != NULL) {
+ if (strncmp(buf, get_unseen_seq_name(), strlen(get_unseen_seq_name())))
+ fprintf(mh_sequences_new_fp, "%s", buf);
+ }
+ fclose(mh_sequences_old_fp);
+ }
+
+ fclose(mh_sequences_new_fp);
+ g_rename(mh_sequences_new, mh_sequences_old);
+ g_free(sequence);
+ procmsg_msg_list_free(msglist);
+ }
+ g_free(mh_sequences_old);
+ g_free(mh_sequences_new);
+ g_free(path);
+/*
+ g_timer_stop(timer);
+ printf("mh_get_flags: %f secs\n", g_timer_elapsed(timer, NULL));
+ g_timer_destroy(timer);
+*/
+}
+
+static int mh_item_close(Folder *folder, FolderItem *item)
+{
+ mh_write_sequences(item);
+ return 0;
+}
-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642