aboutsummaryrefslogtreecommitdiff
path: root/libsylph
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-11-21 06:16:53 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2006-11-21 06:16:53 +0000
commit706387299924733de026545cc7fd99fa15624278 (patch)
treeeab31a4d5bda5f9d27fe54791ba21b00b6da1902 /libsylph
parent3bc4ce303283eb3f6652ffc0c6a1243f1002a400 (diff)
merged from LibSylph branch.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1330 ee746299-78ed-0310-b773-934348b2243d
Diffstat (limited to 'libsylph')
-rw-r--r--libsylph/session.c43
-rw-r--r--libsylph/session.h9
-rw-r--r--libsylph/smtp.h2
-rw-r--r--libsylph/socket.h2
-rw-r--r--libsylph/utils.c2
5 files changed, 37 insertions, 21 deletions
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());