Re: Fixed: PATCH: Allow use of an IMAP mailbox as Sentbox
- From: Manuel McLure <manuel mclure org>
- To: balsa-list gnome org
- Subject: Re: Fixed: PATCH: Allow use of an IMAP mailbox as Sentbox
- Date: Tue, 10 Jul 2001 12:57:41 -0700
On 2001.07.10 12:49 Manuel McLure wrote:
> Great! I was supposing that if you had Sentbox on IMAP, you would have
> INBOX as IMAP, but your solution is much better. I did take the liberty
> of
> cleaning up the patch a bit (using the type conversion macros instead of
> direct casting and changing some nasty structure member access in my
> original code) - here's the new patch.
A little more cleanup on the patch...
--
Manuel A. McLure KE6TAW | ...for in Ulthar, according to an ancient
<manuel@mclure.org> | and significant law, no man may kill a cat.
<http://www.mclure.org> | -- H.P. Lovecraft
*** balsa-1.1.6/libbalsa/mailbox_imap.c Sat Jun 23 10:47:26 2001
--- balsa-1.1.6-test/libbalsa/mailbox_imap.c Tue Jul 10 12:37:47 2001
***************
*** 211,217 ****
server_settings_changed(server, mailbox);
}
! static void
reset_mutt_passwords(LibBalsaServer* server)
{
if (ImapUser)
--- 211,217 ----
server_settings_changed(server, mailbox);
}
! void
reset_mutt_passwords(LibBalsaServer* server)
{
if (ImapUser)
*** balsa-1.1.6/libbalsa/mailbox_imap.h Sun Mar 4 11:31:33 2001
--- balsa-1.1.6-test/libbalsa/mailbox_imap.h Tue Jul 10 12:37:47 2001
***************
*** 61,64 ****
--- 61,66 ----
void libbalsa_imap_close_all_connections(void);
+ void reset_mutt_passwords(LibBalsaServer *);
+
#endif /* __LIBBALSA_MAILBOX_IMAP_H__ */
*** balsa-1.1.6/libbalsa/send.c Mon Jul 9 00:35:31 2001
--- balsa-1.1.6-test/libbalsa/send.c Tue Jul 10 12:54:50 2001
***************
*** 32,37 ****
--- 32,39 ----
#include "libbalsa_private.h"
#include "mailbackend.h"
+ #include "mailbox_imap.h"
+ #include "information.h"
#ifdef BALSA_USE_THREADS
#include "threads.h"
***************
*** 225,230 ****
--- 227,236 ----
LibBalsaMailbox * fccbox, gint encoding)
{
MessageQueueItem *mqi;
+ LibBalsaMailboxImap *imapfccbox;
+ LibBalsaServer *server;
+ char imappath[_POSIX_PATH_MAX];
+
g_return_if_fail(message);
***************
*** 236,245 ****
mutt_write_fcc(LIBBALSA_MAILBOX_LOCAL(outbox)->path,
mqi->message, NULL, 0, NULL);
libbalsa_unlock_mutt();
! if (fccbox && LIBBALSA_IS_MAILBOX_LOCAL(fccbox)) {
libbalsa_lock_mutt();
mutt_write_fcc(LIBBALSA_MAILBOX_LOCAL(fccbox)->path,
mqi->message, NULL, 0, NULL);
libbalsa_unlock_mutt();
libbalsa_mailbox_check(fccbox);
}
--- 242,285 ----
mutt_write_fcc(LIBBALSA_MAILBOX_LOCAL(outbox)->path,
mqi->message, NULL, 0, NULL);
libbalsa_unlock_mutt();
! if (fccbox && (LIBBALSA_IS_MAILBOX_LOCAL(fccbox)
! || LIBBALSA_IS_MAILBOX_IMAP(fccbox))) {
libbalsa_lock_mutt();
+ if (LIBBALSA_IS_MAILBOX_LOCAL(fccbox)) {
mutt_write_fcc(LIBBALSA_MAILBOX_LOCAL(fccbox)->path,
mqi->message, NULL, 0, NULL);
+ } else if (LIBBALSA_IS_MAILBOX_IMAP(fccbox)) {
+ imapfccbox = LIBBALSA_MAILBOX_IMAP(fccbox);
+ server = LIBBALSA_MAILBOX_REMOTE(fccbox)->server;
+ if(!CLIENT_CONTEXT_OPEN(fccbox)) /* Has not been opened */
+ {
+ /* We cannot use LIBBALSA_REMOTE_MAILBOX_SERVER() here because */
+ /* it will lock up when NO IMAP mailbox has been accessed since */
+ /* balsa was started. This should be safe because we have already */
+ /* established that fccbox is in fact an IMAP mailbox */
+ if(server == (LibBalsaServer *)0) {
+ libbalsa_unlock_mutt();
+ libbalsa_information(LIBBALSA_INFORMATION_ERROR, "Unable to open sentbox - could not get server information");
+ return;
+ }
+ if (!(server->passwd && *server->passwd) &&
+ !(server->passwd = libbalsa_server_get_password(server, fccbox))) {
+ libbalsa_unlock_mutt();
+ libbalsa_information(LIBBALSA_INFORMATION_ERROR, "Unable to open sentbox - could not get passwords for server");
+ return;
+ }
+ reset_mutt_passwords(server);
+ }
+
+ /* Passwords are guaranteed to be set now */
+
+ snprintf(imappath, _POSIX_PATH_MAX, "{%s:%d}%s",
+ server->host,
+ server->port,
+ imapfccbox->path);
+ mutt_write_fcc(imappath,
+ mqi->message, NULL, 0, NULL);
+ }
libbalsa_unlock_mutt();
libbalsa_mailbox_check(fccbox);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]