diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | ChangeLog.ja | 11 | ||||
-rw-r--r-- | libsylph/session.c | 43 | ||||
-rw-r--r-- | libsylph/session.h | 9 | ||||
-rw-r--r-- | libsylph/smtp.h | 2 | ||||
-rw-r--r-- | libsylph/socket.h | 2 | ||||
-rw-r--r-- | libsylph/utils.c | 2 |
7 files changed, 58 insertions, 21 deletions
@@ -1,3 +1,13 @@ +2006-11-21 + + * merged from LibSylph branch. + * libsylph/utils.c: my_tmpfile(): guard against unset progname. + * libsylph/session.c: check whether notify callback is set. + * libsylph/smtp.h + libsylph/session.h + libsylph/socket.h: fixed the offset of struct members independent + from configuration. + 2006-11-20 * libsylph/folder.[ch]: added folder_scan_tree() and diff --git a/ChangeLog.ja b/ChangeLog.ja index 22345418..4e74f56e 100644 --- a/ChangeLog.ja +++ b/ChangeLog.ja @@ -1,3 +1,14 @@ +2006-11-21 + + * LibSylph ブランチからマージ。 + * libsylph/utils.c: my_tmpfile(): progname が未指定の場合に対応。 + * libsylph/session.c: 通知コールバックがセットされているかどうかを + チェック。 + * libsylph/smtp.h + libsylph/session.h + libsylph/socket.h: 設定に関わらず構造体メンバのオフセットを固定 + するようにした。 + 2006-11-20 * libsylph/folder.[ch]: folder_scan_tree() と folder_create_tree() diff --git a/libsylph/session.c b/libsylph/session.c index 8a2779f7..3109a478 100644 --- a/libsylph/session.c +++ b/libsylph/session.c @@ -614,7 +614,9 @@ static gboolean session_read_msg_cb(SockInfo *source, GIOCondition condition, g_string_truncate(session->read_msg_buf, 0); ret = session->recv_msg(session, msg); - session->recv_msg_notify(session, msg, session->recv_msg_notify_data); + if (session->recv_msg_notify) + session->recv_msg_notify(session, msg, + session->recv_msg_notify_data); g_free(msg); @@ -698,9 +700,10 @@ static gboolean session_read_data_cb(SockInfo *source, GIOCondition condition, if (tv_cur.tv_sec - session->tv_prev.tv_sec > 0 || tv_cur.tv_usec - session->tv_prev.tv_usec > UI_REFRESH_INTERVAL) { - session->recv_data_progressive_notify - (session, data_buf->len, 0, - session->recv_data_progressive_notify_data); + if (session->recv_data_progressive_notify) + session->recv_data_progressive_notify + (session, data_buf->len, 0, + session->recv_data_progressive_notify_data); g_get_current_time(&session->tv_prev); } return TRUE; @@ -720,8 +723,9 @@ static gboolean session_read_data_cb(SockInfo *source, GIOCondition condition, g_byte_array_set_size(data_buf, 0); - session->recv_data_notify(session, data_len, - session->recv_data_notify_data); + if (session->recv_data_notify) + session->recv_data_notify(session, data_len, + session->recv_data_notify_data); if (ret < 0) session->state = SESSION_ERROR; @@ -851,9 +855,10 @@ static gboolean session_read_data_as_file_cb(SockInfo *source, if (tv_cur.tv_sec - session->tv_prev.tv_sec > 0 || tv_cur.tv_usec - session->tv_prev.tv_usec > UI_REFRESH_INTERVAL) { - session->recv_data_progressive_notify - (session, session->read_data_pos, 0, - session->recv_data_progressive_notify_data); + if (session->recv_data_progressive_notify) + session->recv_data_progressive_notify + (session, session->read_data_pos, 0, + session->recv_data_progressive_notify_data); g_get_current_time(&session->tv_prev); } @@ -896,8 +901,9 @@ static gboolean session_read_data_as_file_cb(SockInfo *source, fclose(session->read_data_fp); session->read_data_fp = NULL; - session->recv_data_notify(session, session->read_data_pos, - session->recv_data_notify_data); + if (session->recv_data_notify) + session->recv_data_notify(session, session->read_data_pos, + session->recv_data_notify_data); session->read_data_pos = 0; @@ -1059,10 +1065,12 @@ static gboolean session_write_data_cb(SockInfo *source, tv_cur.tv_usec - session->tv_prev.tv_usec > UI_REFRESH_INTERVAL) { session_set_timeout(session, session->timeout_interval); - session->send_data_progressive_notify - (session, - session->write_data_pos, write_data_len, - session->send_data_progressive_notify_data); + if (session->send_data_progressive_notify) + session->send_data_progressive_notify + (session, + session->write_data_pos, + write_data_len, + session->send_data_progressive_notify_data); g_get_current_time(&session->tv_prev); } return TRUE; @@ -1075,8 +1083,9 @@ static gboolean session_write_data_cb(SockInfo *source, /* callback */ ret = session->send_data_finished(session, write_data_len); - session->send_data_notify(session, write_data_len, - session->send_data_notify_data); + if (session->send_data_notify) + session->send_data_notify(session, write_data_len, + session->send_data_notify_data); return FALSE; } diff --git a/libsylph/session.h b/libsylph/session.h index e1d5fee6..5ff12984 100644 --- a/libsylph/session.h +++ b/libsylph/session.h @@ -65,6 +65,13 @@ typedef enum SESSION_MSG_UNKNOWN } SessionMsgType; +#ifndef USE_SSL +typedef enum +{ + SSL_NONE +} SSLType; +#endif + typedef gint (*RecvMsgNotify) (Session *session, const gchar *msg, gpointer user_data); @@ -92,9 +99,7 @@ struct _Session gchar *server; gushort port; -#if USE_SSL SSLType ssl_type; -#endif gboolean nonblocking; diff --git a/libsylph/smtp.h b/libsylph/smtp.h index 1375828c..6a087773 100644 --- a/libsylph/smtp.h +++ b/libsylph/smtp.h @@ -89,9 +89,7 @@ struct _SMTPSession SMTPState state; -#if USE_SSL gboolean tls_init_done; -#endif gchar *hostname; diff --git a/libsylph/socket.h b/libsylph/socket.h index 7955005a..aaa6b895 100644 --- a/libsylph/socket.h +++ b/libsylph/socket.h @@ -55,6 +55,8 @@ struct _SockInfo gint sock; #if USE_SSL SSL *ssl; +#else + gpointer ssl; #endif GIOChannel *sock_ch; diff --git a/libsylph/utils.c b/libsylph/utils.c index 5e21fa60..bd104e6e 100644 --- a/libsylph/utils.c +++ b/libsylph/utils.c @@ -3273,6 +3273,8 @@ FILE *my_tmpfile(void) tmpdir = get_tmp_dir(); tmplen = strlen(tmpdir); progname = g_get_prgname(); + if (!progname) + progname = "sylph"; proglen = strlen(progname); Xalloca(fname, tmplen + 1 + proglen + sizeof(suffix), return tmpfile()); |