aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rw-r--r--ChangeLog.ja10
-rw-r--r--libsylph/utils.c31
-rw-r--r--libsylph/utils.h12
-rw-r--r--src/imap.c5
-rw-r--r--src/inc.c3
-rw-r--r--src/main.c3
-rw-r--r--src/news.c5
-rw-r--r--src/send_message.c5
9 files changed, 71 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index 6e77192a..7b5e5663 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2005-09-05
+ * libsylph/utils.[ch]
+ src/inc.c
+ src/main.c
+ src/imap.c
+ src/send_message.c
+ src/news.c: made query-password function UI independent.
+ Added UI independent print status func.
+
+2005-09-05
+
* src/main.c
src/procmsg.[ch]
src/send_message.[ch]
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 6335ad2b..34a6c870 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,5 +1,15 @@
2005-09-05
+ * libsylph/utils.[ch]
+ src/inc.c
+ src/main.c
+ src/imap.c
+ src/send_message.c
+ src/news.c: パスワード入力関数を UI 非依存にした。
+ UI 非依存のステータス表示関数を追加。
+
+2005-09-05
+
* src/main.c
src/procmsg.[ch]
src/send_message.[ch]
diff --git a/libsylph/utils.c b/libsylph/utils.c
index dc72b814..ac4ffa6c 100644
--- a/libsylph/utils.c
+++ b/libsylph/utils.c
@@ -3263,6 +3263,25 @@ size_t my_strftime(gchar *s, size_t max, const gchar *format,
return strftime(s, max, format, tm);
}
+/* user input */
+
+static QueryPasswordFunc query_password_func = NULL;
+
+void set_input_query_password_func(QueryPasswordFunc func)
+{
+ query_password_func = func;
+}
+
+gchar *input_query_password(const gchar *server, const gchar *user)
+{
+ if (query_password_func)
+ return query_password_func(server, user);
+ else
+ return NULL;
+}
+
+/* logging */
+
static FILE *log_fp = NULL;
void set_log_file(const gchar *filename)
@@ -3340,6 +3359,18 @@ void debug_print(const gchar *format, ...)
g_print("%s", buf);
}
+void print_status(const gchar *format, ...)
+{
+ va_list args;
+ gchar buf[BUFFSIZE];
+
+ va_start(args, format);
+ g_vsnprintf(buf, sizeof(buf), format, args);
+ va_end(args);
+
+ log_show_status_func(buf);
+}
+
#define TIME_LEN 11
void log_print(const gchar *format, ...)
diff --git a/libsylph/utils.h b/libsylph/utils.h
index fbda26a3..ee394083 100644
--- a/libsylph/utils.h
+++ b/libsylph/utils.h
@@ -176,7 +176,9 @@ gint g_chmod (const gchar *path,
perror(func); \
}
-typedef void (*LogFunc) (const gchar *str);
+typedef gchar * (*QueryPasswordFunc) (const gchar *server,
+ const gchar *user);
+typedef void (*LogFunc) (const gchar *str);
/* for macro expansion */
#define Str(x) #x
@@ -470,6 +472,12 @@ size_t my_strftime (gchar *s,
const gchar *format,
const struct tm *tm);
+/* user input */
+void set_input_query_password_func (QueryPasswordFunc func);
+
+gchar *input_query_password (const gchar *server,
+ const gchar *user);
+
/* logging */
void set_log_file (const gchar *filename);
void close_log_file (void);
@@ -485,6 +493,8 @@ void set_log_ui_func (LogFunc print_func,
void set_log_show_status_func (LogFunc status_func);
void debug_print (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
+void print_status (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
+
void log_print (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
void log_message (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
void log_warning (const gchar *format, ...) G_GNUC_PRINTF(1, 2);
diff --git a/src/imap.c b/src/imap.c
index f510fea8..a179c23c 100644
--- a/src/imap.c
+++ b/src/imap.c
@@ -49,7 +49,6 @@
#include "base64.h"
#include "utils.h"
#include "prefs_common.h"
-#include "inputdialog.h"
#define IMAP4_PORT 143
#if USE_SSL
@@ -596,8 +595,8 @@ static gint imap_session_connect(IMAPSession *session)
pass = account->passwd;
if (!pass) {
gchar *tmp_pass;
- tmp_pass = input_dialog_query_password(account->recv_server,
- account->userid);
+ tmp_pass = input_query_password(account->recv_server,
+ account->userid);
if (!tmp_pass)
return IMAP_ERROR;
Xstrdup_a(pass, tmp_pass,
diff --git a/src/inc.c b/src/inc.c
index 0fe78bbb..4e0a206c 100644
--- a/src/inc.c
+++ b/src/inc.c
@@ -54,7 +54,6 @@
#include "manage_window.h"
#include "stock_pixmap.h"
#include "progressdialog.h"
-#include "inputdialog.h"
#include "alertpanel.h"
#include "trayicon.h"
#include "filter.h"
@@ -496,7 +495,7 @@ static gint inc_start(IncProgressDialog *inc_dialog)
(inc_dialog->dialog->window,
NULL, NULL);
- pass = input_dialog_query_password
+ pass = input_query_password
(pop3_session->ac_prefs->recv_server,
pop3_session->user);
diff --git a/src/main.c b/src/main.c
index 22091e05..5656fa8f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -67,6 +67,7 @@
#include "import.h"
#include "manage_window.h"
#include "alertpanel.h"
+#include "inputdialog.h"
#include "statusbar.h"
#include "addressbook.h"
#include "addrindex.h"
@@ -194,6 +195,8 @@ int main(int argc, char *argv[])
}
set_log_file("sylpheed.log");
+ set_input_query_password_func(input_dialog_query_password);
+
CHDIR_EXIT_IF_FAIL(get_home_dir(), 1);
prefs_common_read_config();
diff --git a/src/news.c b/src/news.c
index 6e52f319..28181b32 100644
--- a/src/news.c
+++ b/src/news.c
@@ -44,8 +44,6 @@
#include "utils.h"
#include "prefs_common.h"
#include "prefs_account.h"
-#include "inputdialog.h"
-#include "alertpanel.h"
#if USE_SSL
# include "ssl.h"
#endif
@@ -234,8 +232,7 @@ static Session *news_session_new_for_folder(Folder *folder)
if (ac->passwd && ac->passwd[0])
passwd = g_strdup(ac->passwd);
else
- passwd = input_dialog_query_password(ac->nntp_server,
- userid);
+ passwd = input_query_password(ac->nntp_server, userid);
}
#if USE_SSL
diff --git a/src/send_message.c b/src/send_message.c
index 0579c619..ff5f7dee 100644
--- a/src/send_message.c
+++ b/src/send_message.c
@@ -49,7 +49,6 @@
#include "filter.h"
#include "progressdialog.h"
#include "statusbar.h"
-#include "inputdialog.h"
#include "alertpanel.h"
#include "manage_window.h"
#include "socket.h"
@@ -482,7 +481,7 @@ static gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp)
g_strdup(ac_prefs->tmp_smtp_pass);
else {
smtp_session->pass =
- input_dialog_query_password
+ input_query_password
(ac_prefs->smtp_server,
smtp_session->user);
if (!smtp_session->pass)
@@ -499,7 +498,7 @@ static gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp)
g_strdup(ac_prefs->tmp_pass);
else {
smtp_session->pass =
- input_dialog_query_password
+ input_query_password
(ac_prefs->smtp_server,
smtp_session->user);
if (!smtp_session->pass)