You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(65) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(61) |
Feb
(111) |
Mar
(98) |
Apr
(33) |
May
(31) |
Jun
(64) |
Jul
(35) |
Aug
(50) |
Sep
(170) |
Oct
(89) |
Nov
(72) |
Dec
(214) |
2002 |
Jan
(74) |
Feb
(21) |
Mar
(5) |
Apr
(4) |
May
(61) |
Jun
(13) |
Jul
(3) |
Aug
(39) |
Sep
(14) |
Oct
(80) |
Nov
(22) |
Dec
(76) |
2003 |
Jan
(14) |
Feb
(59) |
Mar
(7) |
Apr
(5) |
May
|
Jun
(4) |
Jul
(6) |
Aug
(78) |
Sep
(68) |
Oct
(23) |
Nov
(25) |
Dec
(107) |
2004 |
Jan
(82) |
Feb
(75) |
Mar
(13) |
Apr
(9) |
May
(21) |
Jun
(2) |
Jul
(1) |
Aug
(52) |
Sep
(23) |
Oct
(15) |
Nov
(6) |
Dec
(60) |
2005 |
Jan
(125) |
Feb
(94) |
Mar
(32) |
Apr
(68) |
May
|
Jun
|
Jul
(11) |
Aug
(3) |
Sep
(15) |
Oct
(3) |
Nov
|
Dec
(58) |
2006 |
Jan
(46) |
Feb
(29) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(9) |
Dec
(9) |
2007 |
Jan
(62) |
Feb
(60) |
Mar
|
Apr
|
May
|
Jun
(2) |
Jul
(6) |
Aug
(3) |
Sep
(4) |
Oct
(2) |
Nov
(4) |
Dec
(46) |
2008 |
Jan
(3) |
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
(10) |
Dec
(49) |
2009 |
Jan
(14) |
Feb
(12) |
Mar
(37) |
Apr
(8) |
May
|
Jun
|
Jul
|
Aug
(6) |
Sep
(25) |
Oct
(48) |
Nov
(7) |
Dec
(45) |
2010 |
Jan
(15) |
Feb
(14) |
Mar
(7) |
Apr
|
May
|
Jun
(1) |
Jul
(1) |
Aug
(1) |
Sep
|
Oct
(28) |
Nov
|
Dec
(44) |
2011 |
Jan
(22) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(70) |
2012 |
Jan
(6) |
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(128) |
2013 |
Jan
(8) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(2) |
Dec
(150) |
2014 |
Jan
(70) |
Feb
(44) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Sebastian B. <sb...@us...> - 2012-12-18 10:36:57
|
Update of /cvsroot/simplemail/simplemail In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv5964 Modified Files: index_private.h index.c index_naive.c Log Message: Minor change in the find_documents() interface. Implemented forwarders and creation of the naive index. Index: index_naive.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/index_naive.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- index_naive.c 18 Dec 2012 09:53:32 -0000 1.2 +++ index_naive.c 18 Dec 2012 10:36:55 -0000 1.3 @@ -35,11 +35,18 @@ struct index *index_naive_create(const char *filename) { - return NULL; + struct index *idx; + + if (!(idx = (struct index*)malloc(sizeof(*idx)))) + return NULL; + + memset(idx,0,sizeof(*idx)); + return idx; } void index_naive_dispose(struct index *index) { + free(index); } int index_naive_put_document(struct index *index, int did, const char *text) @@ -52,7 +59,7 @@ return 0; } -int index_naive_find_documents(struct index *index, int (*callback)(int did, void *userdata), void *userdata, int num_substrings, ...) +int index_naive_find_documents(struct index *index, int (*callback)(int did, void *userdata), void *userdata, int num_substrings, va_list substrings) { return 0; } Index: index_private.h =================================================================== RCS file: /cvsroot/simplemail/simplemail/index_private.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- index_private.h 18 Dec 2012 09:34:39 -0000 1.1 +++ index_private.h 18 Dec 2012 10:36:55 -0000 1.2 @@ -22,6 +22,8 @@ #ifndef SM__INDEX_PRIVATE_H #define SM__INDEX_PRIVATE_H +#include <stdarg.h> + struct index_algorithm; /** @@ -82,9 +84,10 @@ * @param callback * @param userdata * @param num_substrings number of following strings of type const char *. + * @param substrings the substrings that must be contained. * @return number of documents for which the callback was called. */ - int (*find_documents)(struct index *index, int (*callback)(int did, void *userdata), void *userdata, int num_substrings, ...); + int (*find_documents)(struct index *index, int (*callback)(int did, void *userdata), void *userdata, int num_substrings, va_list substrings); }; Index: index.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/index.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- index.c 18 Dec 2012 09:34:39 -0000 1.2 +++ index.c 18 Dec 2012 10:36:55 -0000 1.3 @@ -36,7 +36,12 @@ */ struct index *index_create(struct index_algorithm *alg, const char *filename) { - return NULL; + struct index *idx; + + if (!(idx = alg->create(filename))) + return NULL; + idx->alg = alg; + return idx; } /** @@ -48,6 +53,8 @@ */ void index_dispose(struct index *index) { + if (!index) return; + index->alg->dispose(index); } /** @@ -60,7 +67,7 @@ */ int index_put_document(struct index *index, int did, const char *text) { - return 0; + return index->alg->put_document(index,did,text); } /** @@ -73,7 +80,7 @@ */ int index_remove_document(struct index *index, int did) { - return 0; + return index->alg->remove_document(index,did); } /** @@ -87,5 +94,11 @@ */ int index_find_documents(struct index *index, int (*callback)(int did, void *userdata), void *userdata, int num_substrings, ...) { - return 0; + int rc; + + va_list list; + + va_start(list, num_substrings); + rc = index->alg->find_documents(index,callback,userdata,num_substrings,list); + va_end(list); } |
From: Sebastian B. <sb...@us...> - 2012-12-18 09:57:48
|
Update of /cvsroot/simplemail/simplemail/tests In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv4566/tests Modified Files: makefile Added Files: index_unittest.c Log Message: Added test skeleton for string index. --- NEW FILE: index_unittest.c --- /** * index_unittest - a simple test for the simple string index interface for SimpleMail. * Copyright (C) 2012 Sebastian Bauer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <stdlib.h> #include <time.h> #include <sys/time.h> #include <CUnit/Basic.h> #include "index.h" #include "index_naive.h" /*******************************************************/ /* @Test */ void test_index_naive(void) { } Index: makefile =================================================================== RCS file: /cvsroot/simplemail/simplemail/tests/makefile,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- makefile 16 Dec 2012 10:34:24 -0000 1.18 +++ makefile 18 Dec 2012 09:57:46 -0000 1.19 @@ -21,8 +21,9 @@ boyermoore_unittest \ codesets_unittest \ configuration_unittest \ - mail_unittest \ filter_unittest \ + index_unittest \ + mail_unittest \ support_indep_unittest \ text2html_unittest |
From: Sebastian B. <sb...@us...> - 2012-12-18 09:53:34
|
Update of /cvsroot/simplemail/simplemail In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv4368 Modified Files: index_naive.h index_naive.c Log Message: Fixed comments. Index: index_naive.h =================================================================== RCS file: /cvsroot/simplemail/simplemail/index_naive.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- index_naive.h 18 Dec 2012 09:52:41 -0000 1.1 +++ index_naive.h 18 Dec 2012 09:53:32 -0000 1.2 @@ -1,5 +1,5 @@ /** - * index_naive.h - a simple string index interface for SimpleMail. + * index_naive.h - a naive string index implementation for SimpleMail. * Copyright (C) 2012 Sebastian Bauer * * This program is free software: you can redistribute it and/or modify Index: index_naive.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/index_naive.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- index_naive.c 18 Dec 2012 09:52:41 -0000 1.1 +++ index_naive.c 18 Dec 2012 09:53:32 -0000 1.2 @@ -1,5 +1,5 @@ /** - * index_naive.c - a navive string index implementation for SimpleMail. + * index_naive.c - a naive string index implementation for SimpleMail. * Copyright (C) 2012 Sebastian Bauer * * This program is free software: you can redistribute it and/or modify |
From: Sebastian B. <sb...@us...> - 2012-12-18 09:52:43
|
Update of /cvsroot/simplemail/simplemail In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv4325 Modified Files: common-sources.mk Added Files: index_naive.h index_naive.c Log Message: Added a dummy implementation of a naive string index implementation. --- NEW FILE: index_naive.h --- /** * index_naive.h - a simple string index interface for SimpleMail. * Copyright (C) 2012 Sebastian Bauer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SM__INDEX_NAIVE_H #define SM__INDEX_NAIVE_H extern struct index_algorithm index_naive; #endif --- NEW FILE: index_naive.c --- /** * index_naive.c - a navive string index implementation for SimpleMail. * Copyright (C) 2012 Sebastian Bauer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * @file index_naive.c */ #include <stdlib.h> #include <string.h> #include "index.h" #include "index_private.h" #include "index_naive.h" struct index_naive { struct index index; }; struct index *index_naive_create(const char *filename) { return NULL; } void index_naive_dispose(struct index *index) { } int index_naive_put_document(struct index *index, int did, const char *text) { return 0; } int index_naive_remove_document(struct index *index, int did) { return 0; } int index_naive_find_documents(struct index *index, int (*callback)(int did, void *userdata), void *userdata, int num_substrings, ...) { return 0; } /*****************************************************/ struct index_algorithm index_naive = { index_naive_create, index_naive_dispose, index_naive_put_document, index_naive_remove_document, index_naive_find_documents }; Index: common-sources.mk =================================================================== RCS file: /cvsroot/simplemail/simplemail/common-sources.mk,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- common-sources.mk 18 Dec 2012 09:34:39 -0000 1.4 +++ common-sources.mk 18 Dec 2012 09:52:41 -0000 1.5 @@ -19,6 +19,7 @@ http.c \ imap.c \ index.c \ + index_naive.c \ lists.c \ mail.c \ mbox.c \ |
From: Sebastian B. <sb...@us...> - 2012-12-18 09:34:41
|
Update of /cvsroot/simplemail/simplemail In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv3577 Modified Files: common-sources.mk index.c Added Files: index.h index_private.h Log Message: Worked on the index API. --- NEW FILE: index.h --- /** * index.h - a simple string index interface for SimpleMail. * Copyright (C) 2012 Sebastian Bauer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SM__INDEX_H #define SM__INDEX_H struct index; struct index_algorithm; struct index *index_create(struct index_algorithm *alg, const char *filename); void index_dispose(struct index *index); int index_put_document(struct index *index, int did, const char *text); int index_remove_document(struct index *index, int did); int index_find_documents(struct index *index, int (*callback)(int did, void *userdata), void *userdata, int num_substrings, ...); #endif Index: index.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/index.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- index.c 10 Dec 2012 15:35:31 -0000 1.1 +++ index.c 18 Dec 2012 09:34:39 -0000 1.2 @@ -1,22 +1,91 @@ /** + * index.c - a simple string index interface for SimpleMail. + * Copyright (C) 2012 Sebastian Bauer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + + +/** * @file index.c */ #include <string.h> -struct index *index_create(char *filename) +#include "index.h" +#include "index_private.h" + +/** + * Create an index using the given algorithm and persistence layer + * stored at the given name. + * + * @param alg + * @param filename + * @return + */ +struct index *index_create(struct index_algorithm *alg, const char *filename) { return NULL; } -void index_delete(struct index *index) +/** + * Free all resources associated with the given index. Does not affect + * the persistence layer. The given index must not be accessed any longer + * after a call to this function. + * + * @param index + */ +void index_dispose(struct index *index) { } -void index_put_text(struct index *index, char *string, int id) +/** + * Put a document of the given document id into the index. + * + * @param index + * @param did + * @param text + * @return success or not. + */ +int index_put_document(struct index *index, int did, const char *text) { + return 0; } -void index_lockup(struct index *index, char *string) +/** + * Remove the document from the index. + * + * @param index + * @param did + * @return success or not. + * + */ +int index_remove_document(struct index *index, int did) { + return 0; +} + +/** + * Find documents that all contain the given string as exact substrings. + * + * @param index + * @param callback + * @param userdata + * @param num_substrings + * @return + */ +int index_find_documents(struct index *index, int (*callback)(int did, void *userdata), void *userdata, int num_substrings, ...) +{ + return 0; } --- NEW FILE: index_private.h --- /** * index_private.h - a simple string index interface for SimpleMail. * Copyright (C) 2012 Sebastian Bauer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * @file index_private.h */ #ifndef SM__INDEX_PRIVATE_H #define SM__INDEX_PRIVATE_H struct index_algorithm; /** * Base structure for index instance data. */ struct index { struct index_algorithm *alg; }; /** * Defines the common interface for string index algorithms. * This is not directly exposed to clients only to * implementors. */ struct index_algorithm { /** * Creates a new index stored in the given filename. * * @param filename * @return the newly created index. */ struct index *(*create)(const char *filename); /** * Get rid of memory allocated by the index. * Doesn't not affect the persistence layer. * * @param index */ void (*dispose)(struct index *index); /** * Put a document with the associated id into the index. * * @param index * @param did * @param text * @return */ int (*put_document)(struct index *index, int did, const char *text); /** * Remove the document identified by the given document id from the * index. * * @param index * @param did * @return */ int (*remove_document)(struct index *index, int did); /** * Find documents that all contain the given string as exact substrings. * * @param index * @param callback * @param userdata * @param num_substrings number of following strings of type const char *. * @return number of documents for which the callback was called. */ int (*find_documents)(struct index *index, int (*callback)(int did, void *userdata), void *userdata, int num_substrings, ...); }; #endif Index: common-sources.mk =================================================================== RCS file: /cvsroot/simplemail/simplemail/common-sources.mk,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- common-sources.mk 16 Dec 2011 07:22:17 -0000 1.3 +++ common-sources.mk 18 Dec 2012 09:34:39 -0000 1.4 @@ -18,6 +18,7 @@ hmac_md5.c \ http.c \ imap.c \ + index.c \ lists.c \ mail.c \ mbox.c \ |
From: Sebastian B. <sb...@us...> - 2012-12-17 17:31:48
|
Update of /cvsroot/simplemail/simplemail/amiga-mui In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv9709/amiga-mui Modified Files: filterwnd.c Log Message: Fixed some disable state issues. Doxygenifized. Index: filterwnd.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/amiga-mui/filterwnd.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- filterwnd.c 17 Dec 2012 16:50:50 -0000 1.41 +++ filterwnd.c 17 Dec 2012 17:31:46 -0000 1.42 @@ -16,9 +16,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -/* -** filterwnd.c -*/ +/** + * Handle the filter window. + * + * @file filterwnd.c + */ #include <string.h> #include <stdio.h> @@ -71,6 +73,8 @@ static Object *filter_arexx_string; static Object *filter_sound_check; static Object *filter_sound_string; +static Object *filter_add_rule_button; +static Object *filter_apply_now_button; static Object *filter_folder_list; @@ -122,17 +126,18 @@ return 1; } -/************************************************************************** - This function is called whenever the folder list has changed -**************************************************************************/ +/** + * Refreshes the folder list. It should be called, whenever the folder list + * has been changed. + */ void filter_update_folder_list(void) { DoMethod(filter_folder_list, MUIM_FolderTreelist_Refresh, NULL); } -/************************************************************************** - Accept the rule -**************************************************************************/ +/** + * Accept the current filter settings. + */ static void filter_accept_rule(void) { if (filter_last_selected) @@ -234,9 +239,9 @@ } } -/************************************************************************** - Refreshes the rules of the current folder. -**************************************************************************/ +/** + * Refreshes the rules of the current filter. + */ static void filter_refresh_rules(void) { struct filter *filter; @@ -290,9 +295,9 @@ DoMethod(filter_rule_group, MUIM_Group_ExitChange); } -/************************************************************************** - Add a new rule into the filter -**************************************************************************/ +/** + * Adds a new rule into the currently selected filter. + */ static void filter_add_rule_gui(void) { if (filter_last_selected) @@ -303,9 +308,11 @@ } } -/************************************************************************** - Remove the rule -**************************************************************************/ +/** + * Remove the rule from the GUI. + * + * @param objs the object representing the rule. + */ static void filter_remove_rule_gui(Object **objs) { struct filter_rule *fr; @@ -325,9 +332,9 @@ MUI_DisposeObject(objs[0]); } -/************************************************************************** - Apply the filter -**************************************************************************/ +/** + * Apply the currently selected filter. + */ static void filter_apply(void) { if (filter_last_selected) @@ -337,9 +344,9 @@ } } -/************************************************************************** - Create a new filter -**************************************************************************/ +/** + * Creates a new filter. + */ static void filter_new(void) { struct filter *f = filter_create(); @@ -354,18 +361,18 @@ } } -/************************************************************************** - Delete the current selected filter -**************************************************************************/ +/** + * Removes the currently selected filter. + */ static void filter_remove(void) { filter_last_selected = NULL; DoMethod(filter_list, MUIM_NList_Remove, MUIV_NList_Remove_Active); } -/************************************************************************** - Ok, callback and close the filterwindow -**************************************************************************/ +/** + * Accept the filter settings. Also closes the window. + */ static void filter_ok(void) { struct filter *f; @@ -379,9 +386,7 @@ { DoMethod(filter_list, MUIM_NList_GetEntry, i, (ULONG)&f); if (f) - { filter_list_add_duplicate(f); - } } /* Clear the list to save memory */ @@ -391,9 +396,9 @@ filter_refresh_rules(); } -/************************************************************************** - Cancel the filter -**************************************************************************/ +/** + * Cancel the filter changes. Also closes the window. + */ static void filter_cancel(void) { /* Clear the list to save memory */ @@ -404,9 +409,9 @@ filter_refresh_rules(); } -/************************************************************************** - New Entry has been activated -**************************************************************************/ +/** + * A new entry has been activated. + */ static void filter_active(void) { struct filter *f; @@ -427,14 +432,21 @@ set(filter_new_check, MUIA_Selected, !!(f->flags & FILTER_FLAG_NEW)); set(filter_sent_check, MUIA_Selected, !!(f->flags & FILTER_FLAG_SENT)); set(filter_remote_check, MUIA_Selected, !!(f->flags & FILTER_FLAG_REMOTE)); + } else + { + filter_refresh_rules(); + } - } else filter_refresh_rules(); filter_last_selected = f; + + /* Update some disable states */ + set(filter_apply_now_button,MUIA_Disabled,!filter_last_selected); + set(filter_add_rule_button,MUIA_Disabled,!filter_last_selected); } -/************************************************************************** - A new name -**************************************************************************/ +/** + * A new name has been entered. + */ static void filter_name(void) { struct filter *f; @@ -447,9 +459,9 @@ } } -/************************************************************************** - Init the filter window -**************************************************************************/ +/** + * Initialize the filter window. + */ static void init_filter(void) { static struct Hook filter_construct_hook; @@ -457,7 +469,7 @@ static struct Hook filter_display_hook; static struct Hook move_objstr_hook, move_strobj_hook; Object *ok_button, *cancel_button, *save_button; - Object *filter_add_rule_button, *filter_apply_now_button, *filter_move_popobject, *filter_remote_label; + Object *filter_move_popobject, *filter_remote_label; init_hook(&filter_construct_hook,(HOOKFUNC)filter_construct); init_hook(&filter_destruct_hook,(HOOKFUNC)filter_destruct); @@ -628,6 +640,8 @@ if (!filter_wnd) return; } + filter_last_selected = NULL; + /* Clear the filter listview contents */ DoMethod(filter_list, MUIM_NList_Clear); @@ -649,6 +663,7 @@ } set(filter_list, MUIA_NList_Active, new_active); + filter_active(); set(filter_wnd, MUIA_Window_Open, TRUE); } |
From: Sebastian B. <sb...@us...> - 2012-12-17 16:50:52
|
Update of /cvsroot/simplemail/simplemail/amiga-mui In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv7651/amiga-mui Modified Files: filterwnd.c Log Message: Fixed spelling mistake. Index: filterwnd.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/amiga-mui/filterwnd.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- filterwnd.c 17 Dec 2012 15:52:03 -0000 1.40 +++ filterwnd.c 17 Dec 2012 16:50:50 -0000 1.41 @@ -498,7 +498,7 @@ End, Child, BalanceObject, End, Child, VGroup, - Child, HorizLineTextObject(_("Activtiy")), + Child, HorizLineTextObject(_("Activity")), Child, HGroup, Child, RectangleObject,MUIA_Weight,25,End, Child, ColGroup(5), |
From: Sebastian B. <sb...@us...> - 2012-12-17 15:52:06
|
Update of /cvsroot/simplemail/simplemail/amiga-mui In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv2904/amiga-mui Modified Files: filterwnd.c Log Message: When opening with a new filter, make sure that the new filter is active. Index: filterwnd.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/amiga-mui/filterwnd.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- filterwnd.c 14 Dec 2012 17:49:33 -0000 1.39 +++ filterwnd.c 17 Dec 2012 15:52:03 -0000 1.40 @@ -620,6 +620,7 @@ void filter_open_with_new_filter(struct filter *nf) { struct filter *f; + int new_active; if (!filter_wnd) { @@ -639,9 +640,15 @@ } if (nf) + { DoMethod(filter_list, MUIM_NList_InsertSingle, (ULONG)nf, MUIV_NList_Insert_Bottom); + new_active = xget(filter_list,MUIA_NList_Entries)-1; + } else + { + new_active = 0; + } - set(filter_list, MUIA_NList_Active,0); + set(filter_list, MUIA_NList_Active, new_active); set(filter_wnd, MUIA_Window_Open, TRUE); } |
From: Sebastian B. <sb...@us...> - 2012-12-17 15:47:47
|
Update of /cvsroot/simplemail/simplemail/amiga-mui In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv2465/amiga-mui Modified Files: filterruleclass.c Log Message: Implemented filter rule drop actions using filter_rule_create_from_mail_iterator(). Index: filterruleclass.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/amiga-mui/filterruleclass.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- filterruleclass.c 16 Dec 2012 19:22:43 -0000 1.19 +++ filterruleclass.c 17 Dec 2012 15:47:44 -0000 1.20 @@ -391,6 +391,31 @@ return MUIV_DragQuery_Accept; } +/** + * Used for mail iterator callback. + * + * @param handle + * @param userdata + * @return + */ +static struct mail_info *FilterRule_Get_First_Mail_Info(void *handle, void *userdata) +{ + return (struct mail_info*)DoMethod(userdata, MUIM_MailTreelist_GetFirstSelected, (ULONG)handle); +} + +/** + * Uses for mail iterator callback. + * + * @param handle + * @param userdata + * @return + */ +static struct mail_info *FilterRule_Get_Next_Mail_Info(void *handle, void *userdata) +{ + return (struct mail_info*)DoMethod(userdata, MUIM_MailTreelist_GetNextSelected, (ULONG)handle); +} + + STATIC ULONG FilterRule_DragDrop(struct IClass *cl,Object *obj,struct MUIP_DragDrop *msg) { struct filter_rule *fr; @@ -405,42 +430,11 @@ switch (data->type) { case RULE_RCPT_MATCH: - fr = NULL; + fr = filter_rule_create_from_mail_iterator(FRCT_RECEPIENTS,-1,FilterRule_Get_First_Mail_Info,FilterRule_Get_Next_Mail_Info,msg->obj); break; case RULE_SUBJECT_MATCH: - { - /* TODO: Refactor (similar code is in simplemail.c), maybe let the controller handle all this */ - void *handle; - struct mail_info *m; - unsigned int num_mails = 0; - - m = (struct mail_info*)DoMethod(msg->obj, MUIM_MailTreelist_GetFirstSelected, (ULONG)&handle); - while (m) - { - num_mails++; - m = (struct mail_info*)DoMethod(msg->obj, MUIM_MailTreelist_GetNextSelected, (ULONG)&handle); - } - - if (num_mails) - { - char **subjects; - - if ((subjects = malloc(num_mails * sizeof(*subjects)))) - { - num_mails = 0; - m = (struct mail_info*)DoMethod(msg->obj, MUIM_MailTreelist_GetFirstSelected, (ULONG)&handle); - while (m) - { - subjects[num_mails++] = m->subject; - m = (struct mail_info*)DoMethod(msg->obj, MUIM_MailTreelist_GetNextSelected, (ULONG)&handle); - } - - fr = filter_rule_create_from_strings(subjects,num_mails,RULE_SUBJECT_MATCH); - free(subjects); - } - } - } + fr = filter_rule_create_from_mail_iterator(FRCT_SUBJECT,-1,FilterRule_Get_First_Mail_Info,FilterRule_Get_Next_Mail_Info,msg->obj); break; default: fr = NULL; break; |
From: Sebastian B. <sb...@us...> - 2012-12-17 14:14:24
|
Update of /cvsroot/simplemail/simplemail In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25757 Modified Files: simplemail.c Log Message: Simplified filter creation from current selection by using the new function in filter.c. Index: simplemail.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/simplemail.c,v retrieving revision 1.227 retrieving revision 1.228 diff -u -d -r1.227 -r1.228 --- simplemail.c 16 Dec 2012 20:46:32 -0000 1.227 +++ simplemail.c 17 Dec 2012 14:14:18 -0000 1.228 @@ -1166,64 +1166,63 @@ } /** - * Returns the number of selected mails in the main window. + * Used for mail iterator callback. * + * @param handle + * @param userdata * @return */ -static unsigned int simplemail_get_num_of_selected_mails(void) +static struct mail_info *simplemail_get_first_mail_info_of_main(void *handle, void *userdata) { - void *handle; - struct mail_info *mail; - unsigned int num_of_mails = 0; - - mail = main_get_mail_first_selected(&handle); - while (mail) - { - num_of_mails++; - mail = main_get_mail_next_selected(&handle); - } + return main_get_mail_first_selected(handle); +} - return num_of_mails; +/** + * Uses for mail iterator callback. + * + * @param handle + * @param userdata + * @return + */ +static struct mail_info *simplemail_get_next_mail_info_of_main(void *handle, void *userdata) +{ + return main_get_mail_next_selected(handle); } /** - * Create a subject filter from the currently selected mails - * and open the filter window. + * Helper function to create a filter of specified type from the current + * mail selection. + * + * @param type */ -void callback_create_subject_filter(void) +static void simplemail_create_filter_from_current_mail_selection(enum filter_rule_create_type type) { - struct mail_info *mail; - void *handle; - char **subjects; struct filter *f; struct filter_rule *fr; - unsigned int num_of_mails; - - if (!(num_of_mails = simplemail_get_num_of_selected_mails())) - return; - - if (!(subjects = (char**)malloc(sizeof(subjects[0])*num_of_mails))) - return; - - num_of_mails = 0; - mail = main_get_mail_first_selected(&handle); - while (mail) - { - subjects[num_of_mails++] = mail->subject; - mail = main_get_mail_next_selected(&handle); - } if (!(f = filter_create())) - goto out; + return; - if (!(fr = filter_rule_create_from_strings(subjects,num_of_mails,RULE_SUBJECT_MATCH))) + if (!(fr = filter_rule_create_from_mail_iterator(type,-1, + simplemail_get_first_mail_info_of_main, + simplemail_get_next_mail_info_of_main, + NULL))) goto out; filter_add_rule(f,fr); filter_open_with_new_filter(f); - filter_dispose(f); out: - free(subjects); + filter_dispose(f); + +} + +/** + * Create a subject filter from the currently selected mails + * and open the filter window. + */ +void callback_create_subject_filter(void) +{ + simplemail_create_filter_from_current_mail_selection(FRCT_SUBJECT); } /** @@ -1232,43 +1231,7 @@ */ void callback_create_recipient_filter(void) { - int i; - struct mail_info *mail; - void *handle; - char ***recipients; - struct filter *f; - struct filter_rule *fr; - unsigned int num_of_mails; - - if (!(num_of_mails = simplemail_get_num_of_selected_mails())) - return; - - if (!(recipients = (char***)malloc(sizeof(recipients[0])*num_of_mails))) - return; - - num_of_mails = 0; - mail = main_get_mail_first_selected(&handle); - while (mail) - { - recipients[num_of_mails++] = mail_info_get_recipient_addresses(mail); - mail = main_get_mail_next_selected(&handle); - } - - if (!(f = filter_create())) - goto out; - - if (!(fr = filter_rule_create_from_common_sorted_recipients(recipients,num_of_mails))) - goto out; - - filter_add_rule(f,fr); - filter_open_with_new_filter(f); - filter_dispose(f); - - for (i=0;i<num_of_mails;i++) - free(recipients[i]); -out: - free(recipients); - + simplemail_create_filter_from_current_mail_selection(FRCT_RECEPIENTS); } /* mails should be fetched */ |
From: Sebastian B. <sb...@us...> - 2012-12-17 14:13:03
|
Update of /cvsroot/simplemail/simplemail In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv25671 Modified Files: filter.c Log Message: Fixed a warning. Index: filter.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/filter.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- filter.c 17 Dec 2012 13:25:36 -0000 1.32 +++ filter.c 17 Dec 2012 14:13:00 -0000 1.33 @@ -509,6 +509,7 @@ case FRCT_RECEPIENTS: array_free(data[i]); break; + default: break; } m = get_next_mail_info(&handle,userdata); } |
From: Sebastian B. <sb...@us...> - 2012-12-17 13:25:38
|
Update of /cvsroot/simplemail/simplemail/tests In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv23876/tests Modified Files: filter_unittest.c Log Message: Added filter_rule_create_from_mail_iterator() and tests. Index: filter_unittest.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/tests/filter_unittest.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- filter_unittest.c 16 Dec 2012 10:09:04 -0000 1.8 +++ filter_unittest.c 17 Dec 2012 13:25:36 -0000 1.9 @@ -23,8 +23,11 @@ #include <CUnit/Basic.h> +#include "mail.h" #include "filter.h" +/*******************************************************/ + /* @Test */ void test_filter_rule_create_from_strings(void) { @@ -53,6 +56,8 @@ filter_dispose(f); } +/*******************************************************/ + /* @Test */ void test_filter_rule_create_from_common_sorted_recipients(void) { @@ -74,3 +79,106 @@ filter_add_rule(f,fr); filter_dispose(f); } + +/*******************************************************/ + +#define NUM_MAILS 3 + +static struct mail_info *get_first_mail_info(void *handle, void *userdata) +{ + unsigned int *h = (unsigned int*)handle; + struct mail_info **m; + + if (NUM_MAILS == 0) + return NULL; + + m = (struct mail_info**)userdata; + *h = 0; + return m[*h]; +} + +static struct mail_info *get_next_mail_info(void *handle, void *userdata) +{ + unsigned int *h = (unsigned int*)handle; + struct mail_info **m; + + if (*h == NUM_MAILS-1) return NULL; + m = (struct mail_info**)userdata; + *h = *h + 1; + return m[*h]; +} + +/*******************************************************/ + +/* @Test */ +void test_filter_rule_create_subject_rule_from_mail_iterator(void) +{ + struct filter_rule *fr; + struct filter *f; + + struct mail_info *m[NUM_MAILS]; + int i; + + for (i=0;i<sizeof(m)/sizeof(*m);i++) + { + char buf[128]; + snprintf(buf,sizeof(buf),"%d%dTest%d%d\n",i,i,i,i); + + m[i] = mail_info_create(); + CU_ASSERT(m[i] != NULL); + + m[i]->subject = (utf8*)mystrdup(buf); + CU_ASSERT(m[i]->subject != NULL); + } + + f = filter_create(); + CU_ASSERT(f != NULL); + + fr = filter_rule_create_from_mail_iterator(FRCT_SUBJECT,-1,get_first_mail_info,get_next_mail_info,m); + CU_ASSERT(fr != NULL); + CU_ASSERT(!strcmp("Test",fr->u.subject.subject[0])); + + for (i=0;i<sizeof(m)/sizeof(*m);i++) + mail_info_free(m[i]); + + filter_add_rule(f,fr); + filter_dispose(f); +} + +/*******************************************************/ + +/* @Test */ +void test_filter_rule_create_recipient_rule_from_mail_iterator(void) +{ + struct filter_rule *fr; + struct filter *f; + + struct mail_info *m[NUM_MAILS]; + int i; + + for (i=0;i<sizeof(m)/sizeof(*m);i++) + { + char buf[128]; + snprintf(buf,sizeof(buf),"test%d...@ab...,sb...@zz...\n",i); + + m[i] = mail_info_create(); + CU_ASSERT(m[i] != NULL); + + m[i]->to_list = create_address_list(buf); + CU_ASSERT(m[i]->to_list != NULL); + } + + f = filter_create(); + CU_ASSERT(f != NULL); + + fr = filter_rule_create_from_mail_iterator(FRCT_RECEPIENTS,-1,get_first_mail_info,get_next_mail_info,m); + CU_ASSERT(fr != NULL); + + CU_ASSERT(strcmp("sb...@zz...",fr->u.rcpt.rcpt[0])==0); + + for (i=0;i<sizeof(m)/sizeof(*m);i++) + mail_info_free(m[i]); + + filter_add_rule(f,fr); + filter_dispose(f); +} |
From: Sebastian B. <sb...@us...> - 2012-12-16 20:46:35
|
Update of /cvsroot/simplemail/simplemail In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv30448 Modified Files: simplemail.c Log Message: Removed now-useless cast. Index: simplemail.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/simplemail.c,v retrieving revision 1.226 retrieving revision 1.227 diff -u -d -r1.226 -r1.227 --- simplemail.c 15 Dec 2012 06:21:07 -0000 1.226 +++ simplemail.c 16 Dec 2012 20:46:32 -0000 1.227 @@ -1209,7 +1209,7 @@ mail = main_get_mail_first_selected(&handle); while (mail) { - subjects[num_of_mails++] = (char*)mail->subject; + subjects[num_of_mails++] = mail->subject; mail = main_get_mail_next_selected(&handle); } |
From: Sebastian B. <sb...@us...> - 2012-12-16 19:22:45
|
Update of /cvsroot/simplemail/simplemail/amiga-mui In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv23630/amiga-mui Modified Files: filterruleclass.c Log Message: We are now accepting drag and drop events from mailtree class for subject filters. Index: filterruleclass.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/amiga-mui/filterruleclass.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- filterruleclass.c 14 Dec 2012 17:49:03 -0000 1.18 +++ filterruleclass.c 16 Dec 2012 19:22:43 -0000 1.19 @@ -33,11 +33,13 @@ #include <proto/intuition.h> #include "filter.h" +#include "mail.h" #include "smintl.h" #include "debug.h" #include "support.h" #include "compiler.h" +#include "mailtreelistclass.h" #include "muistuff.h" #include "multistringclass.h" #include "filterruleclass.h" @@ -366,14 +368,95 @@ } } +/** + * Decides whether a drag and drop operation may be accepted. + * + * @param data + * @param dragged_obj + * @return + */ +static int FilterRule_AcceptDrag(struct FilterRule_Data *data, Object *dragged_obj) +{ + if (OCLASS(dragged_obj) != CL_MailTreelist->mcc_Class) + return 0; + if (data->type != RULE_RCPT_MATCH && data->type != RULE_SUBJECT_MATCH) + return 0; + return 1; +} + STATIC ULONG FilterRule_DragQuery(struct IClass *cl,Object *obj,struct MUIP_DragQuery *msg) { - return DoSuperMethodA(cl,obj,(Msg)msg); + struct FilterRule_Data *data = (struct FilterRule_Data*)INST_DATA(cl,obj); + if (!FilterRule_AcceptDrag(data,msg->obj)) return DoSuperMethodA(cl,obj,(Msg)msg); + return MUIV_DragQuery_Accept; } STATIC ULONG FilterRule_DragDrop(struct IClass *cl,Object *obj,struct MUIP_DragDrop *msg) { - return DoSuperMethodA(cl,obj,(Msg)msg); + struct filter_rule *fr; + struct filter *f; /* We need this only to dispose the filter rule */ + + struct FilterRule_Data *data = (struct FilterRule_Data*)INST_DATA(cl,obj); + if (!FilterRule_AcceptDrag(data,msg->obj)) return DoSuperMethodA(cl,obj,(Msg)msg); + + if (!(f = filter_create())) + return 0; + + switch (data->type) + { + case RULE_RCPT_MATCH: + fr = NULL; + break; + + case RULE_SUBJECT_MATCH: + { + /* TODO: Refactor (similar code is in simplemail.c), maybe let the controller handle all this */ + void *handle; + struct mail_info *m; + unsigned int num_mails = 0; + + m = (struct mail_info*)DoMethod(msg->obj, MUIM_MailTreelist_GetFirstSelected, (ULONG)&handle); + while (m) + { + num_mails++; + m = (struct mail_info*)DoMethod(msg->obj, MUIM_MailTreelist_GetNextSelected, (ULONG)&handle); + } + + if (num_mails) + { + char **subjects; + + if ((subjects = malloc(num_mails * sizeof(*subjects)))) + { + num_mails = 0; + m = (struct mail_info*)DoMethod(msg->obj, MUIM_MailTreelist_GetFirstSelected, (ULONG)&handle); + while (m) + { + subjects[num_mails++] = m->subject; + m = (struct mail_info*)DoMethod(msg->obj, MUIM_MailTreelist_GetNextSelected, (ULONG)&handle); + } + + fr = filter_rule_create_from_strings(subjects,num_mails,RULE_SUBJECT_MATCH); + free(subjects); + } + } + } + break; + + default: fr = NULL; break; + } + + if (fr) + { + FilterRule_SetRule(data,fr); + + /* So the filter rule will be disposed */ + filter_add_rule(f,fr); + } + + if (f) + filter_dispose(f); + return 0; } STATIC MY_BOOPSI_DISPATCHER(ULONG, FilterRule_Dispatcher, cl, obj, msg) |
From: Sebastian B. <sb...@us...> - 2012-12-16 10:34:26
|
Update of /cvsroot/simplemail/simplemail/tests In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv21059/tests Modified Files: makefile Added Files: codesets_unittest.c Log Message: Added tests for codesets. Index: makefile =================================================================== RCS file: /cvsroot/simplemail/simplemail/tests/makefile,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- makefile 16 Dec 2012 09:58:21 -0000 1.17 +++ makefile 16 Dec 2012 10:34:24 -0000 1.18 @@ -19,6 +19,7 @@ TESTEXES=\ boyermoore_unittest \ + codesets_unittest \ configuration_unittest \ mail_unittest \ filter_unittest \ --- NEW FILE: codesets_unittest.c --- /*************************************************************************** SimpleMail - Copyright (C) 2000 Hynek Schlawack and Sebastian Bauer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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 ***************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <time.h> #include <sys/time.h> #include <CUnit/Basic.h> #include "codesets.h" /*******************************************************/ /* @Test */ void test_isascii7(void) { CU_ASSERT(isascii7("ascii7")!=0); CU_ASSERT(isascii7("")!=0); CU_ASSERT(isascii7("ö")==0); } /*******************************************************/ /* @Test */ void test_utf8len(void) { CU_ASSERT(utf8len("ö")==1); } |
From: Sebastian B. <sb...@us...> - 2012-12-16 10:14:21
|
Update of /cvsroot/simplemail/simplemail/tests In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv20290/tests Modified Files: configuration_unittest.c Log Message: Fixed header. Index: configuration_unittest.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/tests/configuration_unittest.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- configuration_unittest.c 16 Dec 2012 09:58:21 -0000 1.1 +++ configuration_unittest.c 16 Dec 2012 10:14:18 -0000 1.2 @@ -1,13 +1,20 @@ -/* First Compile with - * - * gcc mail_unittest.c -g ../*.c -I .. -I ../indep-include/ -I ../gtk/ -DNODEBUG -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -lcunit 2>error - * - * Then execute - * perl gen-stubs.pl <error >stubs.c - * - * Then compile with - * gcc mail_unittest.c -g ../*.c -I .. -I ../indep-include/ -I ../gtk/ -DNODEBUG -DHAVE_STUBS_C -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -lcunit - */ +/*************************************************************************** + SimpleMail - Copyright (C) 2000 Hynek Schlawack and Sebastian Bauer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + 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 +***************************************************************************/ #include <stdio.h> #include <stdlib.h> |
From: Sebastian B. <sb...@us...> - 2012-12-16 10:09:07
|
Update of /cvsroot/simplemail/simplemail/tests In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv20008/tests Modified Files: text2html_unittest.c filter_unittest.c boyermoore_unittest.c support_indep_unittest.c mail_unittest.c imap_unittest.c Log Message: Fixed header. Index: support_indep_unittest.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/tests/support_indep_unittest.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- support_indep_unittest.c 10 Dec 2012 21:07:36 -0000 1.6 +++ support_indep_unittest.c 16 Dec 2012 10:09:04 -0000 1.7 @@ -1,13 +1,20 @@ -/* First Compile with - * - * gcc mail_unittest.c -g ../*.c -I .. -I ../indep-include/ -I ../gtk/ -DNODEBUG -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -lcunit 2>error - * - * Then execute - * perl gen-stubs.pl <error >stubs.c - * - * Then compile with - * gcc mail_unittest.c -g ../*.c -I .. -I ../indep-include/ -I ../gtk/ -DNODEBUG -DHAVE_STUBS_C -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -lcunit - */ +/*************************************************************************** + SimpleMail - Copyright (C) 2000 Hynek Schlawack and Sebastian Bauer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + 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 +***************************************************************************/ #include <stdio.h> #include <stdlib.h> Index: boyermoore_unittest.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/tests/boyermoore_unittest.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- boyermoore_unittest.c 10 Dec 2012 15:03:39 -0000 1.2 +++ boyermoore_unittest.c 16 Dec 2012 10:09:04 -0000 1.3 @@ -1,13 +1,20 @@ -/* First Compile with - * - * gcc mail_unittest.c -g ../*.c -I .. -I ../indep-include/ -I ../gtk/ -DNODEBUG -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -lcunit 2>error - * - * Then execute - * perl gen-stubs.pl <error >stubs.c - * - * Then compile with - * gcc mail_unittest.c -g ../*.c -I .. -I ../indep-include/ -I ../gtk/ -DNODEBUG -DHAVE_STUBS_C -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -lcunit - */ +/*************************************************************************** + SimpleMail - Copyright (C) 2000 Hynek Schlawack and Sebastian Bauer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + 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 +***************************************************************************/ #include <stdio.h> #include <stdlib.h> Index: filter_unittest.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/tests/filter_unittest.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- filter_unittest.c 14 Dec 2012 09:25:29 -0000 1.7 +++ filter_unittest.c 16 Dec 2012 10:09:04 -0000 1.8 @@ -1,13 +1,20 @@ -/* First Compile with - * - * gcc mail_unittest.c -g ../*.c -I .. -I ../indep-include/ -I ../gtk/ -DNODEBUG -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -lcunit 2>error - * - * Then execute - * perl gen-stubs.pl <error >stubs.c - * - * Then compile with - * gcc mail_unittest.c -g ../*.c -I .. -I ../indep-include/ -I ../gtk/ -DNODEBUG -DHAVE_STUBS_C -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -lcunit - */ +/*************************************************************************** + SimpleMail - Copyright (C) 2000 Hynek Schlawack and Sebastian Bauer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + 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 +***************************************************************************/ #include <stdio.h> #include <stdlib.h> Index: text2html_unittest.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/tests/text2html_unittest.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- text2html_unittest.c 15 Dec 2012 06:59:14 -0000 1.1 +++ text2html_unittest.c 16 Dec 2012 10:09:04 -0000 1.2 @@ -1,13 +1,21 @@ -/* First Compile with - * - * gcc mail_unittest.c -g ../*.c -I .. -I ../indep-include/ -I ../gtk/ -DNODEBUG -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -lcunit 2>error - * - * Then execute - * perl gen-stubs.pl <error >stubs.c - * - * Then compile with - * gcc mail_unittest.c -g ../*.c -I .. -I ../indep-include/ -I ../gtk/ -DNODEBUG -DHAVE_STUBS_C -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -lcunit - */ +/*************************************************************************** + SimpleMail - Copyright (C) 2000 Hynek Schlawack and Sebastian Bauer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + 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 +***************************************************************************/ + #include <stdio.h> #include <stdlib.h> Index: imap_unittest.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/tests/imap_unittest.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- imap_unittest.c 21 Dec 2011 21:24:52 -0000 1.5 +++ imap_unittest.c 16 Dec 2012 10:09:04 -0000 1.6 @@ -1,3 +1,21 @@ +/*************************************************************************** + SimpleMail - Copyright (C) 2000 Hynek Schlawack and Sebastian Bauer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + 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 imap_unittest.c */ Index: mail_unittest.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/tests/mail_unittest.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- mail_unittest.c 11 Dec 2012 18:45:23 -0000 1.6 +++ mail_unittest.c 16 Dec 2012 10:09:04 -0000 1.7 @@ -1,13 +1,20 @@ -/* First Compile with - * - * gcc mail_unittest.c -g ../*.c -I .. -I ../indep-include/ -I ../gtk/ -DNODEBUG -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -lcunit 2>error - * - * Then execute - * perl gen-stubs.pl <error >stubs.c - * - * Then compile with - * gcc mail_unittest.c -g ../*.c -I .. -I ../indep-include/ -I ../gtk/ -DNODEBUG -DHAVE_STUBS_C -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -lcunit - */ +/*************************************************************************** + SimpleMail - Copyright (C) 2000 Hynek Schlawack and Sebastian Bauer + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + 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 +***************************************************************************/ #include <stdio.h> #include <stdlib.h> |
From: Sebastian B. <sb...@us...> - 2012-12-16 10:06:35
|
Update of /cvsroot/simplemail/simplemail In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19897 Modified Files: account.c Log Message: Doxygenification. Index: account.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/account.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- account.c 2 Jan 2011 11:16:09 -0000 1.11 +++ account.c 16 Dec 2012 10:06:33 -0000 1.12 @@ -16,9 +16,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ***************************************************************************/ -/* -** account.c -*/ +/** + * @file account.c + */ #include <stdlib.h> #include <string.h> @@ -33,9 +33,11 @@ #include "smtp.h" #include "support_indep.h" -/************************************************************************** - Allocates a new account -**************************************************************************/ +/** + * Allocates a new account. + * + * @return + */ struct account *account_malloc(void) { struct pop3_server *pop; @@ -66,9 +68,12 @@ return NULL; } -/************************************************************************** - Duplicates an account -**************************************************************************/ +/** + * Duplicates an account. + * + * @param a + * @return + */ struct account *account_duplicate(struct account *a) { struct pop3_server *pop; @@ -104,9 +109,11 @@ return NULL; } -/************************************************************************** - Frees an account -**************************************************************************/ +/** + * Frees an account. + * + * @param a + */ void account_free(struct account *a) { if (a->account_name) free(a->account_name); @@ -157,9 +164,12 @@ return NULL; } -/************************************************************************** - -**************************************************************************/ +/** + * Find an imap server by the given folder using the accounts. + * + * @param f + * @return + */ struct imap_server *account_find_imap_server_by_folder(struct folder *f) { struct account *account; |
From: Sebastian B. <sb...@us...> - 2012-12-16 09:58:24
|
Update of /cvsroot/simplemail/simplemail/tests In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19516/tests Modified Files: makefile Added Files: configuration_unittest.c Log Message: Added unit test for save_config(). --- NEW FILE: configuration_unittest.c --- /* First Compile with * * gcc mail_unittest.c -g ../*.c -I .. -I ../indep-include/ -I ../gtk/ -DNODEBUG -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -lcunit 2>error * * Then execute * perl gen-stubs.pl <error >stubs.c * * Then compile with * gcc mail_unittest.c -g ../*.c -I .. -I ../indep-include/ -I ../gtk/ -DNODEBUG -DHAVE_STUBS_C -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -lcunit */ #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <time.h> #include <sys/time.h> #include <CUnit/Basic.h> #include "configuration.h" #include "smock.h" /*******************************************************/ FILE *fopen(const char *fname, const char *mode) { return (FILE*)mock(fname,mode); } /*******************************************************/ /* @Test */ void test_save_config_with_failing_fopen(void) { user.config_filename = "test.cfg"; mock_always_returns(fopen,0); save_config(); mock_clean(); } Index: makefile =================================================================== RCS file: /cvsroot/simplemail/simplemail/tests/makefile,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- makefile 15 Dec 2012 06:59:14 -0000 1.16 +++ makefile 16 Dec 2012 09:58:21 -0000 1.17 @@ -19,6 +19,7 @@ TESTEXES=\ boyermoore_unittest \ + configuration_unittest \ mail_unittest \ filter_unittest \ support_indep_unittest \ |
From: Sebastian B. <sb...@us...> - 2012-12-16 09:57:32
|
Update of /cvsroot/simplemail/simplemail/tests In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19477/tests Added Files: smock.h Log Message: Added a simple mocking implementation. --- NEW FILE: smock.h --- /** * smock.h - A very simple mocking implementation for ANSI C. * Copyright (C) 2012 Sebastian Bauer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /** * @file smock.h * * @author Sebastian Bauer * * @note API inspired by cgreen (http://www.lastcraft.com/cgreen.php). */ #ifndef SM__MOCK_H #define SM__MOCK_H enum mock_type { MOCK_DUMMY, MOCK_RETURN }; struct mock_entry { struct mock_entry *next; /** Name of the function this entry is responsible for */ const char *func; enum mock_type type; union { struct { int always; intptr_t rc; } ret; } u; }; static struct mock_entry _dummy_first = {NULL,"",MOCK_DUMMY}; /** * Inserts the given entry. * * @param e */ static void _mock_insert(struct mock_entry *e) { struct mock_entry *p = &_dummy_first; while (p->next) p = p->next; p->next = e; } /** * This is the general mock function. It is called, whenever * a mocked function is called. * * @param func * @param args * @return */ static intptr_t mock_(const char *func, const char *args) { struct mock_entry *p; struct mock_entry *e; p = &_dummy_first; e = p->next; while (e) { if (!strcmp(func,e->func)) { intptr_t rc = e->u.ret.rc; if (!e->u.ret.always) { p->next = e->next; free(e); } return rc; } p = e; e = e->next; } fprintf(stderr,"No mocking instructions found for \"%s\"!\n",func); exit(-1); } /** * The given function shall always return rc. * * @param func * @param rc */ static void _mock_returns(const char *func, intptr_t rc, int always) { struct mock_entry *e; if (!(e = (struct mock_entry*)malloc(sizeof(*e)))) { fprintf(stderr,"Not enough memory!\n"); exit(-1); } memset(e,0,sizeof(*e)); e->func = func; e->u.ret.always = always; e->u.ret.rc = rc; _mock_insert(e); } /*******************************************************/ /* The following macros define the public interface */ /** * The macro that shall be used in the function body of the * mocked function. */ #define mock(...) mock_(__func__, #__VA_ARGS__) /** * The given function shall return the given return value * once. */ #define mock_returns(f,rc) _mock_returns(#f,fc, 1) /** * The given function shall always return the given value. */ #define mock_always_returns(f,rc) _mock_returns(#f,rc, 1) /** * Clean up function. */ static inline mock_clean(void) { struct mock_entry *e, *n; e = _dummy_first.next; while (e) { n = e->next; free(e); e = n; } _dummy_first.next = NULL; } /*******************************************************/ #endif |
From: Sebastian B. <sb...@us...> - 2012-12-15 12:44:45
|
Update of /cvsroot/simplemail/simplemail/amiga-mui In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19501/amiga-mui Modified Files: pgplistclass.c Log Message: Fixed warning. Index: pgplistclass.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/amiga-mui/pgplistclass.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- pgplistclass.c 19 Mar 2009 22:10:48 -0000 1.10 +++ pgplistclass.c 15 Dec 2012 12:44:43 -0000 1.11 @@ -71,7 +71,7 @@ if (msg->entry) { struct pgp_key *key = (struct pgp_key *)msg->entry; - sprintf(data->buf,"0x%08lX",key->keyid); + sprintf(data->buf,"0x%08X",key->keyid); msg->strings[0] = data->buf; msg->strings[1] = key->userids?key->userids[0]:NULL; } else |
From: Sebastian B. <sb...@us...> - 2012-12-15 12:44:04
|
Update of /cvsroot/simplemail/simplemail/amiga-mui In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19437/amiga-mui Modified Files: smtoolbarclass.c Log Message: Fixed warnings. Index: smtoolbarclass.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/amiga-mui/smtoolbarclass.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- smtoolbarclass.c 24 Dec 2008 11:34:39 -0000 1.10 +++ smtoolbarclass.c 15 Dec 2012 12:44:02 -0000 1.11 @@ -237,8 +237,8 @@ /* Something failed */ for (i=0;i<button_count;i++) { - free(toolbar_buttons[i].text); - free(toolbar_buttons[i].help); + free((void*)toolbar_buttons[i].text); + free((void*)toolbar_buttons[i].help); } free(toolbar_buttons); return 0; @@ -272,8 +272,8 @@ for (i=0;i<data->button_count;i++) { - free(data->toolbar_buttons[i].text); - free(data->toolbar_buttons[i].help); + free((void*)data->toolbar_buttons[i].text); + free((void*)data->toolbar_buttons[i].help); } free(data->toolbar_buttons); |
From: Sebastian B. <sb...@us...> - 2012-12-15 12:40:20
|
Update of /cvsroot/simplemail/simplemail/amiga-mui In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19235/amiga-mui Modified Files: picturebuttonclass.c picturebuttonclass.h Log Message: Made args of MakePictureButton() const. Index: picturebuttonclass.h =================================================================== RCS file: /cvsroot/simplemail/simplemail/amiga-mui/picturebuttonclass.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- picturebuttonclass.h 25 Oct 2009 10:16:12 -0000 1.7 +++ picturebuttonclass.h 15 Dec 2012 12:40:18 -0000 1.8 @@ -35,6 +35,6 @@ int create_picturebutton_class(void); void delete_picturebutton_class(void); -Object *MakePictureButton(char *label, char *filename); +Object *MakePictureButton(const char *label, const char *filename); #endif Index: picturebuttonclass.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/amiga-mui/picturebuttonclass.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- picturebuttonclass.c 25 Oct 2009 10:51:37 -0000 1.28 +++ picturebuttonclass.c 15 Dec 2012 12:40:18 -0000 1.29 @@ -391,7 +391,7 @@ SM_LEAVE; } -Object *MakePictureButton(char *label, char *filename) +Object *MakePictureButton(const char *label, const char *filename) { int control_char = GetControlChar(label); |
From: Sebastian B. <sb...@us...> - 2012-12-15 12:38:42
|
Update of /cvsroot/simplemail/simplemail/amiga-mui In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv19135/amiga-mui Modified Files: amigasupport.c amigasupport.h Log Message: Made 1st arg of GetControlChar() const. Index: amigasupport.h =================================================================== RCS file: /cvsroot/simplemail/simplemail/amiga-mui/amigasupport.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- amigasupport.h 26 Jan 2005 16:42:06 -0000 1.10 +++ amigasupport.h 15 Dec 2012 12:38:40 -0000 1.11 @@ -32,7 +32,7 @@ ULONG ConvertKey(struct IntuiMessage *imsg); STRPTR NameOfLock( BPTR lock ); VOID MyBltMaskBitMapRastPort( struct BitMap *srcBitMap, LONG xSrc, LONG ySrc, struct RastPort *destRP, LONG xDest, LONG yDest, LONG xSize, LONG ySize, ULONG minterm, APTR bltMask ); -LONG GetControlChar(char *buf); +LONG GetControlChar(const char *buf); VOID FreeTemplate(APTR m); APTR ParseTemplate(STRPTR temp, STRPTR line, APTR results); LONG SendRexxCommand(STRPTR port, STRPTR Cmd, STRPTR Result, LONG ResultSize); Index: amigasupport.c =================================================================== RCS file: /cvsroot/simplemail/simplemail/amiga-mui/amigasupport.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- amigasupport.c 14 Dec 2012 21:36:29 -0000 1.28 +++ amigasupport.c 15 Dec 2012 12:38:40 -0000 1.29 @@ -394,7 +394,7 @@ } } -LONG GetControlChar(char *label) +LONG GetControlChar(const char *label) { char *buf = strchr(label,'_'); if (buf) return ToLower(*(buf+1)); |
From: Sebastian B. <sb...@us...> - 2012-12-15 06:59:17
|
Update of /cvsroot/simplemail/simplemail/tests In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv28206/tests Modified Files: makefile Added Files: text2html_unittest.c Log Message: Added test for text2html(). Index: makefile =================================================================== RCS file: /cvsroot/simplemail/simplemail/tests/makefile,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- makefile 13 Dec 2012 19:11:25 -0000 1.15 +++ makefile 15 Dec 2012 06:59:14 -0000 1.16 @@ -21,7 +21,8 @@ boyermoore_unittest \ mail_unittest \ filter_unittest \ - support_indep_unittest + support_indep_unittest \ + text2html_unittest test-objs/%.o: ../%.c $(CC) $(CFLAGS) -c $< -o $@ --- NEW FILE: text2html_unittest.c --- /* First Compile with * * gcc mail_unittest.c -g ../*.c -I .. -I ../indep-include/ -I ../gtk/ -DNODEBUG -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -lcunit 2>error * * Then execute * perl gen-stubs.pl <error >stubs.c * * Then compile with * gcc mail_unittest.c -g ../*.c -I .. -I ../indep-include/ -I ../gtk/ -DNODEBUG -DHAVE_STUBS_C -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -lcunit */ #include <stdio.h> #include <stdlib.h> #include <time.h> #include <sys/time.h> #include <CUnit/Basic.h> #include "text2html.h" /********************************************************/ /* @Test */ void test_text2html(void) { char *buf = "Dear Mr. Test,\n\nOn xxxx abcdef@ghijklm wrote:\n> test\n> test\n\ntest :)\n\ntest"; char *html; html = text2html((unsigned char *)buf,strlen(buf),0,NULL); printf("%s\n",html); CU_ASSERT(html != NULL); CU_ASSERT(strstr(html,"mailto:abcdef@ghijklm") != NULL); free(html); } |