Commit Graph

31 Commits

Author SHA1 Message Date
a58c26d7a5 Use camel_read(). (stream_write): Use camel_write().
2003-07-08  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-tcp-stream-raw.c (stream_read): Use camel_read().
	(stream_write): Use camel_write().

	* camel-stream-fs.c (stream_read): Use camel_read().
	(stream_write): Use camel_write().

svn path=/trunk/; revision=21758
2003-07-08 17:48:32 +00:00
a11414daf6 Updated to use the new API from a fe commits ago for the NSS stream. This
2003-03-03  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-tcp-stream-openssl.c (camel_tcp_stream_ssl_new): Updated
	to use the new API from a fe commits ago for the NSS stream. This
	is just to make it compile, but does not update the behaviour to
	act like the NSS stream. Note that people shouldn't be using
	OpenSSL anyway.
	(camel_tcp_stream_ssl_new_raw): Same.

	* camel-process.[c,h]: New source file containing convenience
	functions for process creation/termination mainly for use with
	Pipe filters but should be usable for anything we want.

	* camel-io.[c,h]: New source files implementing read/write system
	calls with proper error checking and cancellation
	(ie. StreamFs::read/write and CamelTcpStreamRaw::read/write). No
	sense duplicating the same code over and over. Now I can use this
	same code easily in other i/o code (such as Pipe filters and gpg
	code?).

svn path=/trunk/; revision=20132
2003-03-03 22:53:15 +00:00
3eabd14ace Use g_strerror when setting an exception string (we need it to be in
2002-11-11  Jeffrey Stedfast  <fejj@ximian.com>

	* providers/local/camel-spool-summary.c (spool_summary_sync_full):
	Use g_strerror when setting an exception string (we need it to be
	in UTF-8).
	(spool_summary_check): Here too.

	* providers/local/camel-spool-store.c (construct): Use g_strerror
	when setting an exception string (we need it to be in UTF-8).
	(get_folder): Same.
	(scan_dir): Here too.

	* providers/local/camel-spool-folder.c (spool_lock): Use
	g_strerror when setting an exception string (we need it to be in
	UTF-8).

	* providers/local/camel-mh-summary.c (mh_summary_check): Use
	g_strerror when setting an exception string (we need it to be in
	UTF-8).

	* providers/local/camel-mh-store.c (delete_folder): Use g_strerror
	when setting an exception string (we need it to be in UTF-8).

	* providers/local/camel-mbox-summary.c (summary_update): Use
	g_strerror when setting an exception string (we need it to be in
	UTF-8).
	(mbox_summary_sync_full): Here too.
	(mbox_summary_sync_quick): Same.
	(mbox_summary_sync): Also here.
	(camel_mbox_summary_sync_mbox): Again here.

	* providers/local/camel-mbox-folder.c (mbox_lock): Use g_strerror
	when setting an exception string (we need it to be in UTF-8).
	(mbox_append_message): Same.
	(mbox_get_message): Here too.

	* providers/local/camel-maildir-summary.c (maildir_summary_load):
	Use g_strerror when setting an exception string (we need it to be
	in UTF-8).
	(maildir_summary_check): Same.

	* providers/local/camel-maildir-store.c (get_folder): Use
	g_strerror when setting an exception string (we need it to be in
	UTF-8).
	(delete_folder): Same.
	(delete_folder): Here too.

	* providers/local/camel-local-summary.c (local_summary_sync): Use
	g_strerror when setting an exception string (we need it to be in
	UTF-8).

	* providers/local/camel-local-store.c (get_folder): Use g_strerror
	when setting an exception string (we need it to be in UTF-8).
	(create_folder): Same.
	(xrename): Here too.
	(rename_folder): And here.
	(delete_folder): Also here.

	* camel-provider.c (camel_provider_init): For debugging printfs,
	we want to use normal strerror (we want locale charset, not
	UTF-8).

	* camel-movemail.c (camel_movemail): Use g_strerror when setting
	an exception string (we need it to be in UTF-8).
	(movemail_external): Same.
	(camel_movemail_copy_file): Here too.
	(camel_movemail_solaris): Also here.

	* camel-mime-utils.c (rfc2047_decode_word): For debugging printfs,
	we want to use normal strerror (we want locale charset, not
	UTF-8).
	(header_encode_param): Same.

	* camel-mime-part-utils.c (convert_buffer): For debugging printfs,
	we want to use normal strerror (we want locale charset, not
	UTF-8).

	* camel-lock-client.c (camel_lock_helper_init): Use g_strerror
	when setting an exception string (we need it to be in UTF-8).

	* camel-data-cache.c (camel_data_cache_remove): Use g_strerror
	when setting an exception string (we need it to be in UTF-8).

	* camel-tcp-stream-raw.c (flaky_tcp_write): For debugging printfs,
	we want to use normal strerror (we want locale charset, not
	UTF-8).
	(flaky_tcp_read): Same.

	* camel-gpg-context.c (gpg_ctx_op_step): For debugging printfs, we
	want to use normal strerror (we want locale charset, not UTF-8).

	* camel-service.c (camel_gethostbyname): Use g_strerror when
	setting an exception string (we need it to be in UTF-8).

	* camel-lock.c (camel_lock_dot): Use g_strerror when setting an
	exception string (we need it to be in UTF-8).
	(camel_lock_fcntl): Same.

svn path=/trunk/; revision=18689
2002-11-11 06:24:56 +00:00
1bde941413 simplified
svn path=/trunk/; revision=17912
2002-08-29 03:41:08 +00:00
bb98624d59 Fixed `set' to hold the correct value when setting the flags.
2002-08-28  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-tcp-stream-raw.c (stream_setsockopt): Fixed `set' to hold
	the correct value when setting the flags.

svn path=/trunk/; revision=17911
2002-08-29 03:40:07 +00:00
8137a35173 Update the comment.
2002-07-30  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-tcp-stream.c (camel_tcp_address_new): Update the comment.

	* camel-tcp-stream-raw.c (socket_connect): If building with IPv6
	support and the address is an IPv6 address, connect using a
	sockaddr_in6 otherwise use the standard IPv4 sockaddr_in
	structure.
	(stream_get_local_address): Fix to work with IPv6 addresses.
	(stream_get_remote_address): Same.

	* camel-tcp-stream-openssl.c (socket_connect): Same as above.
	(stream_get_local_address): Fix to work with IPv6 addresses.
	(stream_get_remote_address): Same.

	* camel-tcp-stream-ssl.c (stream_connect): If building with IPv6
	support and the address is an IPv6 address, initialise the
	PRNetAddr accordingly.
	(stream_get_local_address): Fix to work with IPv6 addresses.
	(stream_get_remote_address): Same.

svn path=/trunk/; revision=17651
2002-07-31 01:03:10 +00:00
3ba5507ba7 Don't bother with counting down the timeout.
2002-05-06  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-tcp-stream-raw.c (socket_connect): Don't bother with
	counting down the timeout.

svn path=/trunk/; revision=16690
2002-05-06 18:59:01 +00:00
dd2a60f012 Same fix as the tcp stream. (stream_write): Again here. Just like tcp
2002-05-02  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-stream-fs.c (stream_read): Same fix as the tcp stream.
	(stream_write): Again here. Just like tcp stream's stream_write(),
	also make sure to save errno before calling fcntl to restore the
	fd flags.

	* camel-tcp-stream-raw.c (stream_read): Handle EINTR errors for
	select().
	(stream_write): Same and also preserve errno when setting the fd
	flags back. If w == -1, return -1.

svn path=/trunk/; revision=16673
2002-05-03 01:16:17 +00:00
fc281a966c Get rid of an unused variable.
2002-04-16  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-filter-driver.c (camel_filter_driver_filter_folder): Get
	rid of an unused variable.

	* providers/smtp/camel-smtp-transport.c (smtp_helo): Use
	camel_gethostbyaddr since gethostbyaddr is not reentrant.

	* camel-http-stream.c (http_connect): Updated after the rename of
	camel_get_host_byname.

	* camel-service.c (camel_gethostbyname): Renamed.
	(camel_gethostbyaddr): New cancellable/reentrant version of
	gethostbyaddr.

svn path=/trunk/; revision=16484
2002-04-17 01:25:28 +00:00
b1b809031f Remove this: it couldn't be generically used, because different subclasses
* camel-tcp-stream.c (camel_tcp_stream_get_socket): Remove this:
	it couldn't be generically used, because different subclasses
	returned entirely different types of data.
	(camel_tcp_stream_get_local_address,
	camel_tcp_stream_get_remote_address): Add these to replace what
	get_socket was being used for.
	(camel_tcp_address_new, camel_tcp_address_free): Utility functions
	for get_{local,remote}_address.

	* providers/smtp/camel-smtp-transport.c: Change localaddr to a
        CamelTcpAddress *.
        (connect_to_server): Call camel_tcp_stream_get_local_address to
	get the local IP address.
        (smtp_disconnect): free	localaddr.
        (smtp_helo): Update for localaddr change.

        * camel-tcp-stream-raw.c (stream_get_socket): Remove
	(stream_get_local_address, stream_get_remote_address): Implement.

	* camel-tcp-stream-ssl.c (stream_get_socket): Remove
	(stream_get_local_address, stream_get_remote_address): Implement.

        * camel-tcp-stream-openssl.c (stream_get_socket): Remove
	(stream_get_local_address, stream_get_remote_address): Implement.

svn path=/trunk/; revision=16092
2002-03-11 00:53:49 +00:00
95fb75425d merged some changes from the 1-0 branch that apparently never got merged into HEAD
svn path=/trunk/; revision=15019
2001-12-13 20:32:42 +00:00
c0cf9754b8 Make sure we've actually read data before checking if p[-] is '\r' or not.
2001-10-28  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-stream-buffer.c (camel_stream_buffer_read_line): Make sure
	we've actually read data before checking if p[-] is '\r' or not.

svn path=/trunk/; revision=14288
2001-10-28 09:37:36 +00:00
2c2cdb4ee5 Same.
2001-10-28  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-tcp-stream-raw.c (stream_write): Same.

	* camel-stream-fs.c (stream_write): If errno isn't EAGAIN, just
	exit with -1 and instead of using continue (which doesn't go to
	the top of the do-while thus making our logic suck), just set w to
	0. Still seems to be a bug in select() if it's telling us the
	socket is ready for data when it really isn't but oh well.

svn path=/trunk/; revision=14286
2001-10-28 07:03:32 +00:00
42606efd98 More fixing of the license texts.
svn path=/trunk/; revision=14216
2001-10-27 18:06:04 +00:00
d09dd29be0 Check for EWOULDBLOCK too? (stream_read): Same. (stream_flush): Return 0
2001-10-26  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-tcp-stream-raw.c (stream_write): Check for EWOULDBLOCK
	too?
	(stream_read): Same.
	(stream_flush): Return 0 always, fsync() and tcp sockets don't
	play nice :-)

	* providers/imap/camel-imap-message-cache.c
	(camel_imap_message_cache_get): Lets try putting a
	camel_stream_reset() here. Logic being that the stream may have
	been read from since it was cached and thus our caller may try
	reading from it and get no data from it since it is already at the
	EOS. This may fix bug #12943.

svn path=/trunk/; revision=14180
2001-10-26 22:54:02 +00:00
7ef153696b Check for EWOULDBLOCK too? (stream_read): Same.
2001-10-26  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-tcp-stream-raw.c (stream_write): Check for EWOULDBLOCK too?
	(stream_read): Same.

	* providers/imap/camel-imap-message-cache.c
	(camel_imap_message_cache_get): Lets try putting a
	camel_stream_reset() here. Logic being that the stream may have
	been read from since it was cached and thus our caller may try
	reading from it and get no data from it since it is already at the
	EOS. This may fix bug #12943.

svn path=/trunk/; revision=14179
2001-10-26 22:52:15 +00:00
1569d31133 updated the SIMULATE_FLAKY_NETWORK code
svn path=/trunk/; revision=13995
2001-10-24 22:15:47 +00:00
66c5805817 Same as in the TcpStreamRaw code. (stream_write): And again here...
2001-10-24  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-stream-fs.c (stream_read): Same as in the TcpStreamRaw code.
	(stream_write): And again here...

	* camel-tcp-stream-raw.c (stream_read): Handle the EAGAIN error
	case as well.
	(stream_write): Same here, this might fix the SMTP truncation
	thing? I hope?

svn path=/trunk/; revision=13993
2001-10-24 21:09:35 +00:00
846fe128cb As below.
2001-10-17  Not Zed  <NotZed@Ximian.com>

        * camel-tcp-stream-raw.c (stream_write): As below.

        * camel-stream-fs.c (stream_write): If not checking cancellation,
        make sure we write out everything asked of us.

svn path=/trunk/; revision=13717
2001-10-17 04:09:17 +00:00
f1e3395ff2 Likewise.
2001-09-08  Not Zed  <NotZed@Ximian.com>

        * providers/local/camel-spool-summary.c (spool_summary_sync_full): Likewise.

        * providers/local/camel-mbox-summary.c (mbox_summary_sync_full): Fix the wording.

        * camel-tcp-stream-raw.c (stream_read): Save errno around fcntl
        call in cancellable read case.  Also, loop while we get EINTR.
        This might fix some weird reconnect behaviour with pop.
        (stream_write): "

svn path=/trunk/; revision=12700
2001-09-08 00:45:24 +00:00
0a99920bfe s/IMAPv4/IMAP
2001-08-27  Jeffrey Stedfast  <fejj@ximian.com>

	* providers/imap/camel-imap-provider.c: s/IMAPv4/IMAP

svn path=/trunk/; revision=12485
2001-08-27 18:28:06 +00:00
fe962a2055 Big header cleanups and nntp compile fix
svn path=/trunk/; revision=9024
2001-03-29 20:31:40 +00:00
a9df5de4af Print info about the issuer of the certificate.
2001-03-16  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-tcp-stream-ssl.c (ssl_bad_cert): Print info about the
	issuer of the certificate.

	* providers/smtp/camel-smtp-transport.c (smtp_connect): Use
	camel_tcp_stream_get_socket().

	* camel-tcp-stream-openssl.c (stream_get_socket): Implemented.

	* camel-tcp-stream-ssl.c (stream_get_socket): Implemented.

	* camel-tcp-stream-raw.c (stream_get_socket): Implemented.

	* camel-tcp-stream.c (camel_tcp_stream_get_socket): New function.

svn path=/trunk/; revision=8764
2001-03-16 23:02:04 +00:00
83b4aa2b1d Check for a new type of mailing list header.
2001-03-14  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-mime-utils.c: Check for a new type of mailing list header.

svn path=/trunk/; revision=8702
2001-03-14 06:16:28 +00:00
24bb645439 Made cancellable. (stream_write): Same. (stream_connect): Removed checks
2001-03-13  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-tcp-stream-raw.c (stream_read): Made cancellable.
	(stream_write): Same.
	(stream_connect): Removed checks for DIVINE_INTERVENTION as the
	code worked fine.

	* camel-tcp-stream-ssl.c (stream_write): get rid of 'w' as it
	wasn't really needed.
	(set_errno): New function to set errno based on the NSPR error
	code.
	(stream_read): If an error occured, call set_errno().
	(stream_write): Same.

svn path=/trunk/; revision=8701
2001-03-14 04:31:58 +00:00
e258958d9e Oops. Make this a subclass of CamelTcpStream, not CamelStream.
2001-03-13  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-tcp-stream-ssl.c (camel_tcp_stream_ssl_get_type):
	Oops. Make this a subclass of CamelTcpStream, not CamelStream.

	* camel-types.h: Add the defs for CamelTcpStream and
	CamelTcpStreamRaw

	* Makefile.am: Add camel-tcp-stream and camel-tcp-stream-raw to
	the build.

	* camel-remote-store.c (remote_connect): Update to use
	CamelTcpStreams.

	* camel-tcp-stream-raw.c (stream_connect): Made cancellable by
	copying the currently used code in camel-remote-store.c.
	(stream_setsockopt): Oops, flags = fcntl (..., GET_FL);
	(camel_tcp_stream_raw_get_type): Oops. Make this a subclass of
	CamelTcpStream, not CamelStream.

svn path=/trunk/; revision=8697
2001-03-14 00:46:59 +00:00
3f72f52320 fcntl(fd, F_GETFL) returns the flags as the return value, not via a passed
* camel-tcp-stream-raw.c (stream_getsockopt, stream_setsockopt):
	* camel-stream-fs.c (stream_read, stream_write):
	* camel-remote-store.c (socket_connect): fcntl(fd, F_GETFL)
	returns the flags as the return value, not via a passed in
	pointer. And F_SETFL looks for an int, not a long, and you have to
	pass it what it's expecting because it's a va_arg parameter. (Yes,
	the man page lies on Linux. But check the UNIX98 spec or the glibc
	source.) Also, fix another bug in socket_connect: if we manage to
	connect right away, unset O_NONBLOCK so it doesn't mess us up
	later.

	Fixes a bunch of problems with non-blocking I/O being done in the
	allegedly-blocking case and then returning EWOULDBLOCK.

svn path=/trunk/; revision=7555
2001-01-16 23:27:51 +00:00
d9b76e981f If the close() is successful, set the fd to -1.
2001-01-15  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-stream-fs.c (stream_close): If the close() is successful,
	set the fd to -1.

	* camel-tcp-stream-raw.c: Removed the disconnect() method.
	(stream_close): If the close() is successful, set the sockfd to
	-1.

	* camel-tcp-stream-ssl.c: Removed the disconnect() method.
	(stream_close): If the close() is successful, set the sockfd to
	NULL.

	* camel-tcp-stream.c (camel_tcp_stream_disconnect): Removed,
	easier to just use the close() method as it did the same thing
	anyway.

svn path=/trunk/; revision=7522
2001-01-16 00:54:18 +00:00
ffe3a796ed Updated to be able to get the CAMEL_SOCKOPT_NONBLOCKING socket opt.
2001-01-15  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-tcp-stream-raw.c (stream_getsockopt): Updated to be able
	to get the CAMEL_SOCKOPT_NONBLOCKING socket opt.
	(stream_setsockopt): Updated to be able to set the
	CAMEL_SOCKOPT_NONBLOCKING socket opt.

svn path=/trunk/; revision=7519
2001-01-15 23:31:40 +00:00
24a2d4baa8 Implemented. (stream_setsockopt): Implemented.
2001-01-14  Jeffrey Stedfast  <fejj@ximian.com>

	* camel-tcp-stream-ssl.c (stream_getsockopt): Implemented.
	(stream_setsockopt): Implemented.

	* camel-tcp-stream-raw.c (stream_getsockopt): Implemented.
	(stream_setsockopt): Implemented.

	* camel-tcp-stream.c (camel_tcp_stream_getsockopt): New method.
	(camel_tcp_stream_setsockopt): Another new method. I think you get
	the idea of what these are for so I won't explain them.

svn path=/trunk/; revision=7491
2001-01-14 22:48:09 +00:00
5608af39dd New CamelTcpStream class that implements nspr sockets and eventually will
2001-01-14  Jeffrey Stedfast  <fejj@helixcode.com>

	* camel-tcp-stream-ssl.[c,h]: New CamelTcpStream class that
	implements nspr sockets and eventually will use nss for
	SSL/TLS. Currently doesn't do any SSL/TLS but it should still
	work. It's functionally equivalent to CamelTcpStreamRaw at the
	moment only it uses nspr i/o.

	* camel-tcp-stream-raw.[c,h]: New CamelTcpStream class that
	implements native sockets. Should be usable but may have some bugs
	yet.

svn path=/trunk/; revision=7489
2001-01-14 08:21:00 +00:00