summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Lebl <jirka@5z.com>2001-04-26 04:27:08 +0000
committerGeorge Lebl <jirka@src.gnome.org>2001-04-26 04:27:08 +0000
commit8b3735f4a78d216aead45692c5a010dd424cacaf (patch)
treea25218d9c61d79a1e178ab9b864cfe8d7e3e5f7a
parent7da0a1f5cbc52f13f16122b8b50bfc0c4185ef33 (diff)
apply patch from Rob Funk (rfunk@funknet.net) to add support for multipleGNOME_CORE_1_4_0_4GNOME_CORE_1_4_0_3
Wed Apr 25 21:17:51 2001 George Lebl <jirka@5z.com> * gen_util/popcheck.[ch], gen_util/remote-helper.[ch], gen_util/mailcheck.c: apply patch from Rob Funk (rfunk@funknet.net) to add support for multiple IMAP mailboxes
-rw-r--r--mailcheck/ChangeLog6
-rw-r--r--mailcheck/mailcheck.c44
-rw-r--r--mailcheck/popcheck.c10
-rw-r--r--mailcheck/popcheck.h5
-rw-r--r--mailcheck/remote-helper.c6
-rw-r--r--mailcheck/remote-helper.h3
6 files changed, 62 insertions, 12 deletions
diff --git a/mailcheck/ChangeLog b/mailcheck/ChangeLog
index b519358f7..dc3ee6816 100644
--- a/mailcheck/ChangeLog
+++ b/mailcheck/ChangeLog
@@ -1,3 +1,9 @@
+Wed Apr 25 21:17:51 2001 George Lebl <jirka@5z.com>
+
+ * gen_util/popcheck.[ch], gen_util/remote-helper.[ch],
+ gen_util/mailcheck.c: apply patch from Rob Funk
+ (rfunk@funknet.net) to add support for multiple IMAP mailboxes
+
2001-04-02 Fatih Demir <kabalak@gtranslator.org>
* gen_util/mailcheck.soundlist: Small update of the Turkish
diff --git a/mailcheck/mailcheck.c b/mailcheck/mailcheck.c
index 07a64480c..242df9188 100644
--- a/mailcheck/mailcheck.c
+++ b/mailcheck/mailcheck.c
@@ -123,13 +123,13 @@ struct _MailCheck {
char *animation_file;
GtkWidget *mailfile_entry, *mailfile_label, *mailfile_fentry;
- GtkWidget *remote_server_entry, *remote_username_entry, *remote_password_entry;
- GtkWidget *remote_server_label, *remote_username_label, *remote_password_label;
+ GtkWidget *remote_server_entry, *remote_username_entry, *remote_password_entry, *remote_folder_entry;
+ GtkWidget *remote_server_label, *remote_username_label, *remote_password_label, *remote_folder_label;
GtkWidget *pre_remote_command_label, *pre_remote_command_entry;
GtkWidget *remote_option_menu;
GtkWidget *play_sound_check;
- char *pre_remote_command, *remote_server, *remote_username, *remote_password, *real_password;
+ char *pre_remote_command, *remote_server, *remote_username, *remote_password, *real_password, *remote_folder;
MailboxType mailbox_type; /* local = 0; maildir = 1; pop3 = 2; imap = 3 */
MailboxType mailbox_type_temp;
@@ -309,7 +309,8 @@ check_mail_file_status (MailCheck *mc)
mc->pre_remote_command,
mc->remote_server,
mc->remote_username,
- mc->real_password);
+ mc->real_password,
+ mc->remote_folder);
}
}
else if (mc->mailbox_type == MAILBOX_LOCAL) {
@@ -564,6 +565,7 @@ mailcheck_destroy (GtkWidget *widget, gpointer data)
g_free (mc->pre_remote_command);
g_free (mc->remote_username);
g_free (mc->remote_password);
+ g_free (mc->remote_folder);
g_free (mc->real_password);
g_free (mc->animation_file);
@@ -882,6 +884,16 @@ apply_properties_callback (GtkWidget *widget, gint page, gpointer data)
if (strlen(text) > 0)
mc->remote_password = g_strdup(text);
+ if (mc->remote_folder) {
+ g_free(mc->remote_folder);
+ mc->remote_folder = NULL;
+ }
+
+ text = gtk_entry_get_text (GTK_ENTRY(mc->remote_folder_entry));
+
+ if (strlen(text) > 0)
+ mc->remote_folder = g_strdup(text);
+
if (mc->pre_remote_command) {
g_free(mc->pre_remote_command);
mc->pre_remote_command = NULL;
@@ -909,6 +921,7 @@ make_remote_widgets_sensitive(MailCheck *mc)
{
gboolean b = mc->mailbox_type_temp != MAILBOX_LOCAL &&
mc->mailbox_type_temp != MAILBOX_LOCALDIR;
+ gboolean f = mc->mailbox_type_temp == MAILBOX_IMAP;
gtk_widget_set_sensitive (mc->mailfile_fentry, !b);
gtk_widget_set_sensitive (mc->mailfile_label, !b);
@@ -916,9 +929,11 @@ make_remote_widgets_sensitive(MailCheck *mc)
gtk_widget_set_sensitive (mc->remote_server_entry, b);
gtk_widget_set_sensitive (mc->remote_password_entry, b);
gtk_widget_set_sensitive (mc->remote_username_entry, b);
+ gtk_widget_set_sensitive (mc->remote_folder_entry, f);
gtk_widget_set_sensitive (mc->remote_server_label, b);
gtk_widget_set_sensitive (mc->remote_password_label, b);
gtk_widget_set_sensitive (mc->remote_username_label, b);
+ gtk_widget_set_sensitive (mc->remote_folder_label, f);
gtk_widget_set_sensitive (mc->pre_remote_command_entry, b);
gtk_widget_set_sensitive (mc->pre_remote_command_label, b);
}
@@ -1065,6 +1080,24 @@ mailbox_properties_page(MailCheck *mc)
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
+ mc->remote_folder_label = l = gtk_label_new(_("Folder:"));
+ gtk_widget_show(l);
+ gtk_box_pack_start (GTK_BOX (hbox), l, FALSE, FALSE, 0);
+
+ mc->remote_folder_entry = l = gtk_entry_new();
+ if (mc->remote_folder)
+ gtk_entry_set_text(GTK_ENTRY(l), mc->remote_folder);
+
+ gtk_widget_show(l);
+ gtk_box_pack_start (GTK_BOX (hbox), l, FALSE, FALSE, 0);
+
+ gtk_signal_connect(GTK_OBJECT(l), "changed",
+ GTK_SIGNAL_FUNC(property_box_changed), mc);
+
+ hbox = gtk_hbox_new (FALSE, 6);
+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
+ gtk_widget_show (hbox);
+
mc->pre_remote_command_label = l = gtk_label_new(_("Command to run before we check for mail:"));
gtk_widget_show(l);
gtk_box_pack_start (GTK_BOX (hbox), l, FALSE, FALSE, 0);
@@ -1306,6 +1339,8 @@ applet_save_session(GtkWidget *w,
mc->remote_username?mc->remote_username:"");
gnome_config_private_set_string("mail/remote_password",
mc->remote_password?mc->remote_password:"");
+ gnome_config_set_string("mail/remote_folder",
+ mc->remote_folder?mc->remote_folder:"");
gnome_config_private_set_string("mail/pre_remote_command",
mc->pre_remote_command ? mc->pre_remote_command : "");
gnome_config_set_int("mail/mailbox_type", (int) mc->mailbox_type);
@@ -1450,6 +1485,7 @@ make_mailcheck_applet(const gchar *goad_id)
g_free(query);
mc->remote_password = gnome_config_private_get_string("mail/remote_password");
+ mc->remote_folder = gnome_config_get_string("mail/remote_folder");
mc->mailbox_type = gnome_config_get_int("mail/mailbox_type=0");
mc->play_sound = gnome_config_get_bool("mail/play_sound=false");
diff --git a/mailcheck/popcheck.c b/mailcheck/popcheck.c
index 70500f1a3..973b7bb5d 100644
--- a/mailcheck/popcheck.c
+++ b/mailcheck/popcheck.c
@@ -252,7 +252,7 @@ static char *wait_for_imap_answer(int s, char *tag)
return 0;
}
-int imap_check(const char *h, const char* n, const char* e)
+int imap_check(const char *h, const char* n, const char* e, const char* f)
{
int s;
char *c;
@@ -260,6 +260,10 @@ int imap_check(const char *h, const char* n, const char* e)
unsigned int r = (unsigned int) -1;
if (!h || !n || !e) return -1;
+
+ if (f == NULL ||
+ f[0] == '\0')
+ f = "INBOX";
s = connect_socket(h, 143);
@@ -275,7 +279,8 @@ int imap_check(const char *h, const char* n, const char* e)
g_free(c);
if (is_imap_answer_ok(wait_for_imap_answer(s, "A1")))
{
- if (write_line(s, "A2 STATUS INBOX (MESSAGES UNSEEN)"))
+ c = g_strdup_printf("A2 STATUS \"%s\" (MESSAGES UNSEEN)",f);
+ if (write_line(s, c))
{
int total = 0, unseen = 0;
@@ -288,6 +293,7 @@ int imap_check(const char *h, const char* n, const char* e)
if (write_line(s, "A3 LOGOUT"))
read_line(s);
}
+ g_free(c);
}
}
else
diff --git a/mailcheck/popcheck.h b/mailcheck/popcheck.h
index 17a37e16c..1ace3b737 100644
--- a/mailcheck/popcheck.h
+++ b/mailcheck/popcheck.h
@@ -13,11 +13,12 @@
*/
int pop3_check(const char *h, const char* n, const char* e);
-/* Returns how many mails are available on IMAP-server "h" with username "n" and password "e"
+/* Returns how many mails are available on IMAP-server "h"
+ * in folder "f" with username "n" and password "e"
* Hi: unseen/recent; Lo: total
* The server-name may be given with or without port-number in form "host:port".
*/
-int imap_check(const char *h, const char* n, const char* e);
+int imap_check(const char *h, const char* n, const char* e, const char* f);
#endif
diff --git a/mailcheck/remote-helper.c b/mailcheck/remote-helper.c
index 07ddc5bd4..e19da8edb 100644
--- a/mailcheck/remote-helper.c
+++ b/mailcheck/remote-helper.c
@@ -191,14 +191,14 @@ gpointer
helper_imap_check (RemoteHandler handler, gpointer data,
GDestroyNotify destroy_notify,
const char *command,
- const char *h, const char* n, const char* e)
+ const char *h, const char* n, const char* e, const char *f)
{
RemoteHandlerData *handler_data;
handler_data = fork_new_handler (handler, data, destroy_notify);
if (handler_data == NULL) {
- handler (imap_check (h, n, e), data);
+ handler (imap_check (h, n, e, f), data);
return NULL;
}
@@ -209,7 +209,7 @@ helper_imap_check (RemoteHandler handler, gpointer data,
command[0] != '\0')
system (command);
- mails = imap_check (h, n, e);
+ mails = imap_check (h, n, e, f);
write (handler_data->fd, &mails, sizeof (mails));
diff --git a/mailcheck/remote-helper.h b/mailcheck/remote-helper.h
index 8b2b8f43f..81696b515 100644
--- a/mailcheck/remote-helper.h
+++ b/mailcheck/remote-helper.h
@@ -17,7 +17,8 @@ gpointer helper_pop3_check (RemoteHandler handler, gpointer data,
gpointer helper_imap_check (RemoteHandler handler, gpointer data,
GDestroyNotify destroy_notify,
const char *command,
- const char *h, const char* n, const char* e);
+ const char *h, const char* n, const char* e,
+ const char *f);
void helper_whack_handle (gpointer handle);
#endif