From 616d409f7cb18b0dfcac25cb17574e4d9d39d293 Mon Sep 17 00:00:00 2001 From: bertrand Date: Thu, 5 Aug 1999 16:02:54 +0000 Subject: Some notes. 1999-08-05 bertrand * camel/README.HACKING: Some notes. * camel/CODING.STYLE: short note about coding style. * camel/README.COPYRIGHT: Note about copyright policy. * camel/providers/MH/camel-mh-folder.c (_list_subfolders): minor typo fixes. svn path=/trunk/; revision=1081 --- camel/CODING.STYLE | 19 +++++++++++ camel/README.COPYRIGHT | 47 +++++++++++++++++++++++++++ camel/README.HACKING | 14 ++++++++ camel/gmime-rfc2047.c | 62 ++++++++++++++++++++---------------- camel/gmime-rfc2047.h | 4 +++ camel/providers/MH/camel-mh-folder.c | 6 ++-- 6 files changed, 121 insertions(+), 31 deletions(-) create mode 100644 camel/CODING.STYLE create mode 100644 camel/README.COPYRIGHT create mode 100644 camel/README.HACKING (limited to 'camel') diff --git a/camel/CODING.STYLE b/camel/CODING.STYLE new file mode 100644 index 0000000000..df1bf5c874 --- /dev/null +++ b/camel/CODING.STYLE @@ -0,0 +1,19 @@ +Note to hackers +--------------- + +When hacking on camel (and on the gnome mailer in general), +be sure to follow the same coding style as the intial authors. +Please read the file HACKING in gnumeric and follow the +general guidelines explained in it. + +Please take a look at camel source files and try to +imitate the coding style the best possible. We are perfectly +aware that this is not the best and unique style, but it +is absolutely mandatory that Camel is homogeneous. +If you find the current coding style to have some weaknesses, +please contact the authors to discuss this matter. + +Thanks. + + Bertrand. + diff --git a/camel/README.COPYRIGHT b/camel/README.COPYRIGHT new file mode 100644 index 0000000000..3cef4eee15 --- /dev/null +++ b/camel/README.COPYRIGHT @@ -0,0 +1,47 @@ +Important note for Camel hackers: +--------------------------------- + +Camel has been a lot of work, and has been conceived to be general +enough to be used outside the gnome-mailer. It is possible in the +future that it is used in softwares with licenses incompatible with the +LGPL. For this reason, the copyright has to be owned by a unique +person. Be sure, however, that Camel will always be available under +the LGPL. Significant authors will always be consulted before any +special use of Camel. Moreover, in special situations, they may be +given the authorization to use Camel with a license different than the +LGPL. + +Thus, when adding code in Camel, always add the following lines at the +begining of the file: + +/* + * + * Copyright (C) 1999 Bertrand Guiheneuf . + * + * 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 + */ + +You may also want to add your name to the author name list after this +header. + +Please contact me (Bertrand.Guiheneuf@aful.org) if you want to discuss +this copyright issue. + +Happy hacking, + +Bertrand. + + diff --git a/camel/README.HACKING b/camel/README.HACKING new file mode 100644 index 0000000000..ceb797e219 --- /dev/null +++ b/camel/README.HACKING @@ -0,0 +1,14 @@ +You want to hack on Camel ? + +Thanks. Camel aims at being the best messaging +library for Linux and your help is welcome. +Please be sure to read the following files before +commiting any change or sending any patch: + +CODING.STYLE +README.COPYRIGHT + + +Thanks. + + Bertrand \ No newline at end of file diff --git a/camel/gmime-rfc2047.c b/camel/gmime-rfc2047.c index e5f48ccbd8..780a866006 100644 --- a/camel/gmime-rfc2047.c +++ b/camel/gmime-rfc2047.c @@ -21,6 +21,10 @@ * */ +/* + * Authors: Robert Brady + */ + #include #include #include @@ -38,17 +42,20 @@ static unsigned char base64_rank[256]; static int base64_rank_table_built; static void build_base64_rank_table (void); -static int hexval(gchar c) { - if (isdigit(c)) return c-'0'; - c = tolower(c); +static int +hexval (gchar c) { + if (isdigit (c)) return c-'0'; + c = tolower (c); return c - 'a' + 10; } -static void decode_quoted(const gchar *text, gchar *to) { +static void +decode_quoted (const gchar *text, gchar *to) +{ while (*text) { if (*text == '=') { - gchar a = hexval(text[1]); - gchar b = hexval(text[2]); + gchar a = hexval (text[1]); + gchar b = hexval (text[2]); int c = (a << 4) + b; *to = c; to++; @@ -66,8 +73,8 @@ static void decode_quoted(const gchar *text, gchar *to) { *to = 0; } -static -void decode_base64 (const gchar *what, gchar *where) +static void +decode_base64 (const gchar *what, gchar *where) { unsigned short pattern = 0; int bits = 0; @@ -111,7 +118,7 @@ gchar { gchar buffer[4096] /* FIXME : constant sized buffer */, *b = buffer; - build_base64_rank_table(); + build_base64_rank_table (); while (*data) { @@ -128,10 +135,10 @@ gchar if (!encoding) break; encoding++; - text = strchr(encoding, '?'); + text = strchr (encoding, '?'); if (!text) break; text++; - end = strstr(text, "?="); + end = strstr (text, "?="); if (!end) break; end++; @@ -139,10 +146,10 @@ gchar *(text-1)=0; *(end-1)=0; - if (strcasecmp(encoding, "q")==0) { + if (strcasecmp (encoding, "q") == 0) { decode_quoted(text, dc); - } else if (strcasecmp(encoding, "b")==0) { - decode_base64(text, dc); + } else if (strcasecmp (encoding, "b") == 0) { + decode_base64 (text, dc); } else { /* What to do here? */ break; @@ -152,20 +159,19 @@ gchar int f; iconv_t i; const gchar *d2 = dc; - int l = strlen(d2), l2 = 4000; + int l = strlen (d2), l2 = 4000; - i = unicode_iconv_open(into_what, charset); + i = unicode_iconv_open (into_what, charset); if (!i) break; - unicode_iconv(i, &d2, &l, &b, &l2); + unicode_iconv (i, &d2, &l, &b, &l2); - unicode_iconv_close(i); + unicode_iconv_close (i); data = end; } } - } - else { + } else { *b = *data; b++; } @@ -182,7 +188,7 @@ gchar *b = 0; - return g_strdup(buffer); + return g_strdup (buffer); } gchar @@ -198,25 +204,25 @@ gchar } if (!not_ascii) { - b += sprintf(b, "%s", string); + b += sprintf (b, "%s", string); } else { - b += sprintf(b, "=?%s?Q?", charset); + b += sprintf (b, "=?%s?Q?", charset); s = string; while (*s) { - if (*s == ' ') b += sprintf(b, "_"); + if (*s == ' ') b += sprintf (b, "_"); else if (*s < 0x20 || *s >= 0x7f || *s == '=' || *s == '?' || *s == '_') { - b += sprintf(b, "=%2x", *s); + b += sprintf (b, "=%2x", *s); } else { - b += sprintf(b, "%c", *s); + b += sprintf (b, "%c", *s); } s++; } - b += sprintf(b, "?="); + b += sprintf (b, "?="); } *b = 0; - return g_strdup(buffer); + return g_strdup (buffer); } diff --git a/camel/gmime-rfc2047.h b/camel/gmime-rfc2047.h index f833b653f4..48e9f5ca0f 100644 --- a/camel/gmime-rfc2047.h +++ b/camel/gmime-rfc2047.h @@ -21,6 +21,10 @@ * */ +/* + * Authors: Robert Brady + */ + #ifndef GMIME_RFC2047_H #define GMIME_RFC2047_H 1 #include diff --git a/camel/providers/MH/camel-mh-folder.c b/camel/providers/MH/camel-mh-folder.c index ad910f4005..6f7b419841 100644 --- a/camel/providers/MH/camel-mh-folder.c +++ b/camel/providers/MH/camel-mh-folder.c @@ -301,15 +301,15 @@ _list_subfolders(CamelFolder *folder) parent_class->delete_messages (folder); directory_path = mh_folder->directory_path; - if (!directory_path) return FALSE; + if (!directory_path) return NULL; - if (!camel_folder_exists (folder)) return TRUE; + if (!camel_folder_exists (folder)) return NULL; dir_handle = opendir (directory_path); /* read first entry in the directory */ dir_entry = readdir (dir_handle); - while ((stat_error != -1) && (unlink_error != -1) && (dir_entry != NULL)) { + while ((stat_error != -1) && (dir_entry != NULL)) { /* get the name of the next entry in the dir */ entry_name = dir_entry->d_name; -- cgit