Re: [evolution-patches] NNTP one-liners
- From: Jeffrey Stedfast <fejj ximian com>
- To: Meilof <meilof wanadoo nl>
- Cc: Evolution-patches <evolution-patches ximian com>
- Subject: Re: [evolution-patches] NNTP one-liners
- Date: Thu, 29 Jan 2004 16:51:25 -0500
I *think* this looks ok, except I noticed that some blocks weren't
indented right - probably due to use of diff -b?
Hopefully notzed will look this over tonight (he's more knowledgeable
about nntp stuff than I am).
Jeff
On Thu, 2004-01-29 at 22:40, Meilof wrote:
> Hello,
>
>
> I submitted these fixes two weeks ago along with a rationale for some of
> the fixes
> [http://lists.ximian.com/archives/public/evolution-patches/2004-January/004133.html].
> Are these going to be applied? I updated the fix a little to match the
> current CVS.
>
>
> Meilof
> -- meilof wanadoo nl
>
> ______________________________________________________________________
> --- /home/meilof/cvs/evolution-cvs-orig//camel/ChangeLog 2004-01-29 22:07:24.000000000 -0500
> +++ camel/ChangeLog 2004-01-29 22:19:27.000000000 -0500
> @@ -1,3 +1,17 @@
> +2004-01-29 Meilof Veeningen <meilof wanadoo nl>
> +
> + * providers/nntp/camel-nntp-folder.c: support for working without a
> + cache, object state files
> +
> + * providers/nntp/camel-nntp-store.c: support for working without a
> + cache, support for looking up non-root subscribed folders, support for
> + recursive unsubscribed folder listings, fix for folder info crash
> +
> + * providers/nntp/camel-nntp-store-summary.[ch]: removed some
> + imap-specific code
> +
> + * providers/nntp/camel-nntp-summary.c: work without cache
> +
> 2004-01-27 Radek Doulik <rodo ximian com>
>
> * providers/imap/camel-imap-folder.c (camel_imap_folder_new): set
> --- /home/meilof/cvs/evolution-cvs-orig//mail/ChangeLog 2004-01-29 22:07:48.000000000 -0500
> +++ mail/ChangeLog 2004-01-29 22:23:28.000000000 -0500
> @@ -1,3 +1,12 @@
> +2004-01-29 Meilof Veeningen <meilof wanadoo nl>
> +
> + * em-folder-selection-button.c
> + (em_folder_selection_button_set_selection_mult): use gstring rather
> + than char*
> +
> + * em-folder-tree.c (em_folder_tree_set_selected): use "" rather than
> + NULL for get_folder_info top (needed for check in folder_info__got)
> +
> 2004-01-28 Not Zed <NotZed Ximian com>
>
> ** See bug #53179
> --- /home/meilof/cvs/evolution-cvs-orig//composer/ChangeLog 2004-01-29 22:07:38.000000000 -0500
> +++ composer/ChangeLog 2004-01-29 22:24:31.000000000 -0500
> @@ -1,3 +1,8 @@
> +2004-01-29 Meilof Veeningen <meilof wanadoo nl>
> + * e-msg-composer-hdrs.c: fix to make relative folder names work
> + if the store url does not end with a slash, use gstring rather
> + than char* in some places.
> +
> 2004-01-14 Not Zed <NotZed Ximian com>
>
> ** See Bug #20017.
> --- /home/meilof/cvs/evolution-cvs-orig//camel/providers/nntp/camel-nntp-folder.c 2004-01-29 22:07:34.000000000 -0500
> +++ camel/providers/nntp/camel-nntp-folder.c 2004-01-29 22:17:46.000000000 -0500
> @@ -80,6 +80,8 @@
> if (camel_nntp_summary_check ((CamelNNTPSummary *) folder->summary, nntp_folder->changes, ex) != -1)
> camel_folder_summary_save (folder->summary);
>
> + camel_object_state_write (folder);
> +
> if (camel_folder_change_info_changed(nntp_folder->changes)) {
> changes = nntp_folder->changes;
> nntp_folder->changes = camel_folder_change_info_new();
> @@ -96,6 +98,7 @@
> static void
> nntp_folder_sync_offline (CamelFolder *folder, CamelException *ex)
> {
> + camel_object_state_write (folder);
> camel_folder_summary_save (folder->summary);
> }
>
> @@ -121,8 +124,9 @@
> goto fail;
>
> if (ret == 220) {
> - stream = camel_data_cache_add (nntp_store->cache, "cache", msgid, NULL);
> - if (stream) {
> +
> + if (nntp_store->cache &&
> + (stream = camel_data_cache_add (nntp_store->cache, "cache", msgid, NULL)) != NULL) {
> if (camel_stream_write_to_stream ((CamelStream *) nntp_store->stream, stream) == -1)
> goto fail;
> if (camel_stream_reset (stream) == -1)
> @@ -198,8 +202,8 @@
> msgid++;
>
> /* Lookup in cache, NEWS is global messageid's so use a global cache path */
> - stream = camel_data_cache_get (nntp_store->cache, "cache", msgid, NULL);
> - if (stream == NULL) {
> + if (nntp_store->cache == NULL ||
> + (stream = camel_data_cache_get (nntp_store->cache, "cache", msgid, NULL)) == NULL) {
> if (camel_disco_store_status ((CamelDiscoStore *) nntp_store) == CAMEL_DISCO_STORE_OFFLINE) {
> camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
> _("This message is not currently available"));
> @@ -577,7 +581,7 @@
> {
> CamelFolder *folder;
> CamelNNTPFolder *nntp_folder;
> - char *root;
> + char *filename;
> CamelService *service;
> #ifdef ASYNC_SUMMARY
> struct _folder_check_msg *m;
> @@ -586,12 +590,12 @@
> gboolean subscribed = TRUE;
>
> service = (CamelService *) parent;
> - root = camel_session_get_storage_path (service->session, service, ex);
> - if (root == NULL)
> + filename = camel_session_get_storage_path (service->session, service, ex);
> + if (filename == NULL)
> return NULL;
>
> /* If this doesn't work, stuff wont save, but let it continue anyway */
> - camel_mkdir (root, 0777);
> + camel_mkdir (filename, 0777);
>
> folder = (CamelFolder *) camel_object_new (CAMEL_NNTP_FOLDER_TYPE);
> nntp_folder = (CamelNNTPFolder *)folder;
> @@ -599,8 +603,13 @@
> camel_folder_construct (folder, parent, folder_name, folder_name);
> folder->folder_flags |= CAMEL_FOLDER_HAS_SUMMARY_CAPABILITY|CAMEL_FOLDER_HAS_SEARCH_CAPABILITY;
>
> - nntp_folder->storage_path = g_build_filename (root, folder->full_name, NULL);
> - g_free (root);
> + nntp_folder->storage_path = g_build_filename (filename, folder->full_name, NULL);
> + g_free (filename);
> +
> + filename = g_strdup_printf ("%s.cmeta", nntp_folder->storage_path);
> + camel_object_set (folder, NULL, CAMEL_OBJECT_STATE_FILE, filename, NULL);
> + camel_object_state_read (folder);
> + g_free (filename);
>
> folder->summary = (CamelFolderSummary *) camel_nntp_summary_new (nntp_folder);
> camel_folder_summary_load (folder->summary);
> --- /home/meilof/cvs/evolution-cvs-orig//camel/providers/nntp/camel-nntp-store.c 2004-01-29 22:07:34.000000000 -0500
> +++ camel/providers/nntp/camel-nntp-store.c 2004-01-29 22:17:46.000000000 -0500
> @@ -102,17 +102,18 @@
> /* setup store-wide cache */
> if (store->cache == NULL) {
> if (store->storage_path == NULL)
> - goto fail;
> + goto cache_done;
>
> store->cache = camel_data_cache_new (store->storage_path, 0, ex);
> if (store->cache == NULL)
> - goto fail;
> + goto cache_done;
>
> /* Default cache expiry - 2 weeks old, or not visited in 5 days */
> camel_data_cache_set_expire_age (store->cache, 60*60*24*14);
> camel_data_cache_set_expire_access (store->cache, 60*60*24*5);
> }
>
> + cache_done:
> if (!(h = camel_service_gethost (service, ex)))
> goto fail;
>
> @@ -179,7 +180,7 @@
> /* set 'reader' mode & ignore return code */
> if (camel_nntp_command (store, (char **) &buf, "mode reader") < 0 ||
> /* hack: inn seems to close connections if nothing is done within
> - the first ten seconds. a non-existent command is enough though */
> + the first ten seconds, so we do some pseudo-useful command */
> camel_nntp_command (store, (char **) &buf, "date") < 0)
> goto fail;
>
> @@ -259,13 +260,13 @@
> /* setup store-wide cache */
> if (nntp_store->cache == NULL) {
> nntp_store->cache = camel_data_cache_new (nntp_store->storage_path, 0, ex);
> - if (nntp_store->cache == NULL)
> - return FALSE;
>
> + if (nntp_store->cache != NULL) {
> /* Default cache expiry - 2 weeks old, or not visited in 5 days */
> camel_data_cache_set_expire_age (nntp_store->cache, 60*60*24*14);
> camel_data_cache_set_expire_access (nntp_store->cache, 60*60*24*5);
> }
> + }
>
> path = g_build_filename (nntp_store->storage_path, ".ev-journal", NULL);
> disco_store->diary = camel_disco_diary_new (disco_store, path, ex);
> @@ -466,11 +467,30 @@
> {
> int i;
> CamelStoreInfo *si;
> - CamelFolderInfo *first = NULL, *last = NULL, *fi = NULL;
> + CamelFolderInfo *root, *first = NULL, *last = NULL, *fi = NULL;
> +
> + if (flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE) {
> + /* for recursive queries, the item itself should be added */
> + if (top && top[0] != 0) {
> + si = (CamelStoreInfo *) camel_nntp_store_summary_full_name (store->summary, top);
> + if (si) {
> + if (si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED)
> + root = nntp_folder_info_from_store_info (store, store->do_short_folder_notation, si);
> + camel_store_summary_info_free ((CamelStoreSummary *) store->summary, si);
> + }
> + }
> +
> + if (!root) {
> + root = nntp_folder_info_from_name (store, store->do_short_folder_notation, top ? top : "");
> + root->flags |= CAMEL_FOLDER_NOSELECT;
> + }
> + }
>
> - /* since we do not do a tree, any request that is not for root is sure to give no results */
> - if (top != NULL && top[0] != 0)
> + if (top != NULL && top[0] != 0) {
> + /* no subitems for sure */
> return NULL;
> + }
> +
>
> for (i=0;(si = camel_store_summary_index ((CamelStoreSummary *) store->summary, i));i++) {
> if (si->flags & CAMEL_STORE_INFO_FOLDER_SUBSCRIBED) {
> @@ -487,7 +507,41 @@
> camel_store_summary_info_free ((CamelStoreSummary *) store->summary, si);
> }
>
> + if (!(flags & CAMEL_STORE_FOLDER_INFO_RECURSIVE))
> return first;
> +
> + root->child = first;
> + return root;
> +}
> +
> +static CamelFolderInfo *
> +nntp_folder_list_hierarchical (CamelNNTPStore *store, CamelFolderInfo *first, char *top)
> +{
> + GPtrArray *arr = g_ptr_array_new();
> + CamelFolderInfo *cur;
> + CamelStoreInfo *si;
> +
> + if (top != NULL) {
> + /* check to see whether top exists */
> + cur = nntp_folder_info_from_name (store, FALSE,
> + (store->folder_hierarchy_relative || top == NULL) ? "" : top);
> + si = (CamelStoreInfo *) camel_nntp_store_summary_full_name (store->summary, top);
> + if (si)
> + camel_store_summary_info_free ((CamelStoreSummary *) store->summary, si);
> + else
> + cur->flags |= CAMEL_FOLDER_NOSELECT;
> + g_ptr_array_add (arr, cur);
> + }
> +
> + while (first) {
> + g_ptr_array_add (arr, first);
> + first = first->sibling;
> + }
> +
> + cur = camel_folder_info_build (arr, NULL, '.', store->folder_hierarchy_relative);
> + g_ptr_array_free (arr, FALSE);
> +
> + return cur;
> }
>
> /*
> @@ -522,7 +576,7 @@
> /* apparently, this is an indirect subitem. if it's not a subitem of
> the item we added last, we need to add a portion of this item to
> the list as a placeholder */
> - len = strlen (last->full_name);
> + len = last ? strlen (last->full_name) : 0;
> if (!last ||
> g_ascii_strncasecmp(si->path, last->full_name, len) != 0 ||
> si->path[len] != '.') {
> @@ -552,8 +606,14 @@
> camel_store_summary_info_free((CamelStoreSummary *)store->summary, si);
> }
>
> + if (recursive_flag) {
> + last = nntp_folder_list_hierarchical (store, first, top);
> + g_free(top);
> + return last;
> + } else {
> g_free(top);
> return first;
> + }
> }
>
> /* retrieves the date from the NNTP server */
> @@ -1058,7 +1118,10 @@
> }
> camel_nntp_stream_set_mode(store->stream, CAMEL_NNTP_STREAM_LINE);
>
> - command_begin_send:
> + camel_stream_reset ((CamelStream *) store->mem);
> + /* FIXME: hack */
> + g_byte_array_set_size (store->mem->buffer, 0);
> +
> va_start(ap, fmt);
> ps = p = fmt;
> while ((c = *p++)) {
> @@ -1103,25 +1166,20 @@
> dd(printf("NNTP_COMMAND: '%.*s'\n", (int)store->mem->buffer->len, store->mem->buffer->data));
> camel_stream_write ((CamelStream *) store->mem, "\r\n", 2);
>
> - if (camel_stream_write ((CamelStream *) store->stream, store->mem->buffer->data, store->mem->buffer->len) == -1 && errno != EINTR) {
> - camel_stream_reset ((CamelStream *) store->mem);
> - /* FIXME: hack */
> - g_byte_array_set_size (store->mem->buffer, 0);
> -
> - reconnect:
> + while (1) {
> + dd(printf("NNTP_COMMAND: '%.*s'\n", (int)store->mem->buffer->len, store->mem->buffer->data));
> + if (camel_stream_write ((CamelStream *) store->stream, store->mem->buffer->data, store->mem->buffer->len) == -1
> + && errno != EINTR) {
> +reconnect:
> /* some error, re-connect */
> camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
>
> if (!nntp_connected (store, NULL))
> return -1;
>
> - goto command_begin_send;
> + continue;
> }
>
> - camel_stream_reset ((CamelStream *) store->mem);
> - /* FIXME: hack */
> - g_byte_array_set_size (store->mem->buffer, 0);
> -
> if (camel_nntp_stream_line (store->stream, (unsigned char **) line, &u) == -1)
> return -1;
>
> @@ -1129,13 +1187,17 @@
>
> /* Check for 'authentication required' codes */
> if (u == NNTP_AUTH_REQUIRED &&
> - camel_nntp_try_authenticate(store))
> - goto command_begin_send;
> + camel_nntp_try_authenticate (store))
> + continue;
>
> /* the server doesn't like us anymore, but we still like her! */
> if (u == 401 || u == 503)
> goto reconnect;
>
> + /* success */
> + break;
> + }
> +
> /* Handle all switching to data mode here, to make callers job easier */
> if (u == 215 || (u >= 220 && u <=224) || (u >= 230 && u <= 231))
> camel_nntp_stream_set_mode(store->stream, CAMEL_NNTP_STREAM_DATA);
> --- /home/meilof/cvs/evolution-cvs-orig//camel/providers/nntp/camel-nntp-store-summary.c 2004-01-29 22:07:34.000000000 -0500
> +++ camel/providers/nntp/camel-nntp-store-summary.c 2004-01-29 22:17:46.000000000 -0500
> @@ -87,10 +87,6 @@
> static void
> camel_nntp_store_summary_init (CamelNNTPStoreSummary *s)
> {
> - /*struct _CamelNNTPStoreSummaryPrivate *p;
> -
> - p = _PRIVATE(s) = g_malloc0(sizeof(*p));*/
> -
> ((CamelStoreSummary *) s)->store_info_size = sizeof (CamelNNTPStoreInfo);
> s->version = CAMEL_NNTP_STORE_SUMMARY_VERSION;
> memset (&s->last_newslist, 0, sizeof (s->last_newslist));
> @@ -99,11 +95,6 @@
> static void
> camel_nntp_store_summary_finalise (CamelObject *obj)
> {
> - /*struct _CamelNNTPStoreSummaryPrivate *p;*/
> - /*CamelNNTPStoreSummary *s = (CamelNNTPStoreSummary *)obj;*/
> -
> - /*p = _PRIVATE(obj);
> - g_free(p);*/
> }
>
> CamelType
> @@ -171,148 +162,6 @@
> return NULL;
> }
>
> -char *
> -camel_nntp_store_summary_full_to_path (CamelNNTPStoreSummary *s, const char *full_name, char dir_sep)
> -{
> - char *path, *p;
> - int c;
> - const char *f;
> -
> - if (dir_sep != '/') {
> - p = path = g_alloca (strlen (full_name) * 3 + 1);
> - f = full_name;
> - while ((c = *f++ & 0xff)) {
> - if (c == dir_sep)
> - *p++ = '/';
> - else if (c == '/' || c == '%')
> - p += sprintf (p, "%%%02X", c);
> - else
> - *p++ = c;
> - }
> - *p = 0;
> - } else
> - path = (char *) full_name;
> -
> - return camel_utf7_utf8 (path);
> -}
> -
> -static guint32
> -hexnib (guint32 c)
> -{
> - if (c >= '0' && c <= '9')
> - return c-'0';
> - else if (c >= 'A' && c <= 'Z')
> - return c - 'A' + 10;
> - else
> - return 0;
> -}
> -
> -char *
> -camel_nntp_store_summary_path_to_full (CamelNNTPStoreSummary *s, const char *path, char dir_sep)
> -{
> - unsigned char *full, *f;
> - guint32 c, v = 0;
> - const char *p;
> - int state=0;
> - char *subpath, *last = NULL;
> - CamelStoreInfo *si;
> -
> - /* check to see if we have a subpath of path already defined */
> - subpath = g_alloca (strlen (path) + 1);
> - strcpy (subpath, path);
> - do {
> - si = camel_store_summary_path ((CamelStoreSummary *) s, subpath);
> - if (si == NULL) {
> - last = strrchr (subpath, '/');
> - if (last)
> - *last = 0;
> - }
> - } while (si == NULL && last);
> -
> - /* path is already present, use the raw version we have */
> - if (si && strlen (subpath) == strlen (path)) {
> - f = g_strdup (camel_nntp_store_info_full_name (s, si));
> - camel_store_summary_info_free ((CamelStoreSummary *) s, si);
> - return f;
> - }
> -
> - f = full = g_alloca (strlen (path)*2+1);
> - if (si)
> - p = path + strlen (subpath);
> - else
> - p = path;
> -
> - while ((c = camel_utf8_getc ((const unsigned char **) &p))) {
> - switch (state) {
> - case 0:
> - if (c == '%') {
> - state = 1;
> - } else {
> - if (c == '/')
> - c = dir_sep;
> - camel_utf8_putc(&f, c);
> - }
> - break;
> - case 1:
> - state = 2;
> - v = hexnib (c) << 4;
> - break;
> - case 2:
> - state = 0;
> - v |= hexnib (c);
> - camel_utf8_putc (&f, v);
> - break;
> - }
> - }
> - camel_utf8_putc (&f, c);
> -
> - /* merge old path part if required */
> - f = camel_utf8_utf7 (full);
> - if (si) {
> - full = g_strdup_printf ("%s%s", camel_nntp_store_info_full_name (s, si), f);
> - g_free (f);
> - camel_store_summary_info_free ((CamelStoreSummary *) s, si);
> - f = full;
> - }
> -
> - return f;
> -}
> -
> -CamelNNTPStoreInfo *
> -camel_nntp_store_summary_add_from_full (CamelNNTPStoreSummary *s, const char *full, char dir_sep)
> -{
> - CamelNNTPStoreInfo *info;
> - char *pathu8;
> - int len;
> - char *full_name;
> -
> - d(printf("adding full name '%s' '%c'\n", full, dir_sep));
> -
> - len = strlen (full);
> - full_name = g_alloca (len+1);
> - strcpy(full_name, full);
> - if (full_name[len-1] == dir_sep)
> - full_name[len-1] = 0;
> -
> - info = camel_nntp_store_summary_full_name (s, full_name);
> - if (info) {
> - camel_store_summary_info_free ((CamelStoreSummary *) s, (CamelStoreInfo *) info);
> - d(printf(" already there\n"));
> - return info;
> - }
> -
> - pathu8 = camel_nntp_store_summary_full_to_path (s, full_name, dir_sep);
> -
> - info = (CamelNNTPStoreInfo *) camel_store_summary_add_from_path ((CamelStoreSummary *) s, pathu8);
> - if (info) {
> - d(printf(" '%s' -> '%s'\n", pathu8, full_name));
> - camel_store_info_set_string((CamelStoreSummary *)s, (CamelStoreInfo *)info, CAMEL_NNTP_STORE_INFO_FULL_NAME, full_name);
> - } else
> - d(printf(" failed\n"));
> -
> - return info;
> -}
> -
> static int
> summary_header_load (CamelStoreSummary *s, FILE *in)
> {
> --- /home/meilof/cvs/evolution-cvs-orig//camel/providers/nntp/camel-nntp-summary.c 2004-01-29 22:07:34.000000000 -0500
> +++ camel/providers/nntp/camel-nntp-summary.c 2004-01-29 22:17:46.000000000 -0500
> @@ -276,7 +276,7 @@
> a cached message that might be in another folder - not that important as
> it is a true cache */
> msgid = strchr(uid, ',');
> - if (msgid)
> + if (msgid && store->cache)
> camel_data_cache_remove(store->cache, "cache", msgid+1, NULL);
> camel_folder_change_info_remove_uid(changes, uid);
> camel_folder_summary_remove(s, mi);
> --- /home/meilof/cvs/evolution-cvs-orig//camel/providers/nntp/camel-nntp-store-summary.h 2004-01-29 22:07:34.000000000 -0500
> +++ camel/providers/nntp/camel-nntp-store-summary.h 2004-01-29 22:17:46.000000000 -0500
> @@ -71,27 +71,8 @@
> CamelType camel_nntp_store_summary_get_type (void);
> CamelNNTPStoreSummary *camel_nntp_store_summary_new (void);
>
> -/* TODO: this api needs some more work, needs to support lists */
> -/*CamelNNTPStoreNamespace *camel_nntp_store_summary_namespace_new(CamelNNTPStoreSummary *s, const char *full_name, char dir_sep);*/
> -/*void camel_nntp_store_summary_namespace_set(CamelNNTPStoreSummary *s, CamelNNTPStoreNamespace *ns);*/
> -/*CamelNNTPStoreNamespace *camel_nntp_store_summary_namespace_find_path(CamelNNTPStoreSummary *s, const char *path);*/
> -/*CamelNNTPStoreNamespace *camel_nntp_store_summary_namespace_find_full(CamelNNTPStoreSummary *s, const char *full_name);*/
> -
> -/* helper macro's */
> -#define camel_nntp_store_info_full_name(s, i) (camel_store_info_string((CamelStoreSummary *)s, (const CamelStoreInfo *)i, CAMEL_NNTP_STORE_INFO_FULL_NAME))
> -
> -/* converts to/from utf8 canonical nasmes */
> -char *camel_nntp_store_summary_full_to_path(CamelNNTPStoreSummary *s, const char *full_name, char dir_sep);
> -
> -char *camel_nntp_store_summary_path_to_full(CamelNNTPStoreSummary *s, const char *path, char dir_sep);
> -char *camel_nntp_store_summary_dotted_to_full(CamelNNTPStoreSummary *s, const char *dotted, char dir_sep);
>
> CamelNNTPStoreInfo *camel_nntp_store_summary_full_name(CamelNNTPStoreSummary *s, const char *full_name);
> -CamelNNTPStoreInfo *camel_nntp_store_summary_add_from_full(CamelNNTPStoreSummary *s, const char *full_name, char dir_sep);
> -
> -/* a convenience lookup function. always use this if path known */
> -char *camel_nntp_store_summary_full_from_path(CamelNNTPStoreSummary *s, const char *path);
> -
>
> #ifdef __cplusplus
> }
> --- /home/meilof/cvs/evolution-cvs-orig//composer/e-msg-composer-hdrs.c 2004-01-29 22:07:39.000000000 -0500
> +++ composer/e-msg-composer-hdrs.c 2004-01-29 22:17:46.000000000 -0500
> @@ -650,7 +650,7 @@
> static void
> set_pair_visibility (EMsgComposerHdrs *h, EMsgComposerHdrPair *pair, int visible)
> {
> - if (visible /*& h->visible_mask*/) {
> + if (visible) {
> gtk_widget_show (pair->label);
> gtk_widget_show (pair->entry);
> } else {
> @@ -1023,14 +1023,6 @@
> eab_destination_freev (cc_destv);
> eab_destination_freev (bcc_destv);
> }
> -
> -#if 0
> - if (hdrs->visible_mask & E_MSG_COMPOSER_VISIBLE_POSTTO) {
> - header = e_msg_composer_hdrs_get_post_to (hdrs);
> - camel_medium_set_header (CAMEL_MEDIUM (msg), "X-Evolution-PostTo", header);
> - g_free (header);
> - }
> -#endif
> }
>
>
> @@ -1208,6 +1200,7 @@
>
> if (hdrs->account->source && hdrs->account->source->url) {
> url = camel_url_new (hdrs->account->source->url, NULL);
> + camel_url_set_path (url, "/");
> ret = camel_url_to_string (url, CAMEL_URL_HIDE_ALL);
> camel_url_free (url);
> }
> @@ -1239,30 +1232,30 @@
> e_msg_composer_hdrs_set_post_to_list (EMsgComposerHdrs *hdrs, GList *urls)
> {
> /* compile the name */
> - char *caption, *tmp, *tmp2;
> + GString *caption;
> + char *tmp;
> gboolean post_custom;
>
> if (hdrs->priv->post_to.entry == NULL)
> return;
>
> - caption = g_strdup ("");
> + caption = g_string_new("");
>
> while (urls) {
> - tmp = folder_name_to_string (hdrs, (char *)urls->data);
> + tmp = folder_name_to_string (hdrs, (char *) urls->data);
> if (tmp) {
> - tmp2 = g_strconcat (caption, ", ", tmp, NULL);
> - g_free (caption);
> - caption = tmp2;
> + g_string_append (caption, ", ");
> + g_string_append (caption, tmp);
> g_free (tmp);
> }
> -
> urls = g_list_next (urls);
> }
>
> post_custom = hdrs->priv->post_custom;
> - gtk_entry_set_text (GTK_ENTRY (hdrs->priv->post_to.entry), caption[0] ? caption + 2 : "");
> + gtk_entry_set_text (GTK_ENTRY (hdrs->priv->post_to.entry), caption->str[0] ? caption->str + 2 : "");
> hdrs->priv->post_custom = post_custom;
> - g_free (caption);
> + g_string_free (caption, TRUE);
> +
> }
>
> void
> @@ -1270,33 +1263,34 @@
> const char *base, const char *post_to)
> {
> GList *lst, *curlist;
> - char *hdr_copy = g_strdup (post_to), *caption, *tmp, *tmp2;
> + char *hdr_copy = g_strdup (post_to), *tmp, *tmp2;
> gboolean post_custom;
> + GString *caption;
>
> /* split to newsgroup names */
> lst = newsgroups_list_split (hdr_copy);
> curlist = lst;
>
> /* compile the name */
> - caption = g_strdup ("");
> + caption = g_string_new("");
>
> while (curlist) {
> - tmp2 = g_strdup_printf ("%s/%s", base, (char *)curlist->data);
> + tmp2 = g_strdup_printf ("%s/%s", base, (char *) curlist->data);
> tmp = folder_name_to_string (hdrs, tmp2);
> g_free (tmp2);
> +
> if (tmp) {
> - tmp2 = g_strconcat (caption, ", ", tmp, NULL);
> - g_free (caption);
> - caption = tmp2;
> + g_string_append (caption, ", ");
> + g_string_append (caption, tmp);
> g_free (tmp);
> }
> curlist = g_list_next (curlist);
> }
>
> post_custom = hdrs->priv->post_custom;
> - gtk_entry_set_text (GTK_ENTRY (hdrs->priv->post_to.entry), caption[0] ? caption + 2 : "");
> + gtk_entry_set_text (GTK_ENTRY (hdrs->priv->post_to.entry), caption->str[0] ? caption->str + 2 : "");
> hdrs->priv->post_custom = post_custom;
> - g_free (caption);
> + g_string_free (caption, TRUE);
>
> g_list_foreach (lst, (GFunc) g_free, NULL);
> g_list_free (lst);
> --- /home/meilof/cvs/evolution-cvs-orig//mail/em-folder-selection-button.c 2004-01-29 22:07:48.000000000 -0500
> +++ mail/em-folder-selection-button.c 2004-01-29 22:17:46.000000000 -0500
> @@ -268,7 +268,10 @@
> em_folder_selection_button_set_selection_mult (EMFolderSelectionButton *button, GList *uris)
> {
> struct _EMFolderSelectionButtonPrivate *priv = button->priv;
> - char *caption, *tmp, *tmp2;
> + char *tmp;
> + GList *uri_next;
> + GString *caption = NULL;
> +
>
> g_return_if_fail (EM_IS_FOLDER_SELECTION_BUTTON (button));
>
> @@ -281,30 +284,30 @@
> priv->uris = uris;
>
> /* compile the name */
> - caption = g_strdup ("");
> + caption = g_string_new ("");
>
> while (uris) {
> tmp = em_utils_folder_name_from_uri (uris->data);
> if (tmp) {
> - tmp2 = g_strconcat (caption, ", ", tmp, NULL);
> - g_free (caption);
> - caption = tmp2;
> + g_string_append (caption, ", ");
> + g_string_append (caption, tmp);
> g_free (tmp);
> - uris = uris->next;
> + uris = g_list_next (uris);
> } else {
> /* apparently, we do not know this folder, so we'll just skip it */
> g_free (uris->data);
> - uris = g_list_next (uris);
> - priv->uris = g_list_remove (priv->uris, uris->data);
> + uri_next = g_list_next (uris);
> + priv->uris = g_list_remove_link (priv->uris, uris);
> + uris = uri_next;
> }
> }
>
> - if (caption[0])
> - gtk_label_set_text (GTK_LABEL (priv->label), caption + 2);
> + if (caption->str[0])
> + gtk_label_set_text (GTK_LABEL (priv->label), caption->str + 2);
> else
> set_contents_unselected (button);
>
> - g_free (caption);
> + g_string_free (caption, TRUE);
> }
>
> GList *
> --- /home/meilof/cvs/evolution-cvs-orig//mail/em-folder-tree.c 2004-01-29 22:07:48.000000000 -0500
> +++ mail/em-folder-tree.c 2004-01-29 22:17:46.000000000 -0500
> @@ -1946,7 +1946,7 @@
> m->root = gtk_tree_row_reference_copy (row);
> m->store = store;
> m->emft = emft;
> - m->top = top ? g_strdup (top) : NULL;
> + m->top = top ? g_strdup (top) : g_strdup("");
> m->flags = CAMEL_STORE_FOLDER_INFO_FAST | CAMEL_STORE_FOLDER_INFO_RECURSIVE;
> m->select_uri = g_strdup (uri);
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]