[Commits] [SCM] claws branch, master, updated. 3.13.2-219-g465c34e

ticho at claws-mail.org ticho at claws-mail.org
Mon Aug 1 21:09:20 CEST 2016


The branch, master has been updated
       via  465c34ef0908e8c9fc212b384107918b2971a529 (commit)
      from  4836dd93f690f7432f6479bf166d0f7226399433 (commit)

Summary of changes:
 src/common/session.c                  |    2 +-
 src/common/session.h                  |   11 ----------
 src/common/smtp.c                     |   38 +++++++++++++++------------------
 src/plugins/managesieve/managesieve.c |   31 +++++++++++----------------
 src/pop.c                             |    2 +-
 5 files changed, 32 insertions(+), 52 deletions(-)


- Log -----------------------------------------------------------------
commit 465c34ef0908e8c9fc212b384107918b2971a529
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Mon Aug 1 21:07:59 2016 +0200

    Removed SessionMsgType enum and its use, since it is useless.
    
    The only user was session_send_msg(), which did nothing
    with its SessionMsgType parameter.

diff --git a/src/common/session.c b/src/common/session.c
index 3285e32..356c321 100644
--- a/src/common/session.c
+++ b/src/common/session.c
@@ -406,7 +406,7 @@ gint session_start_tls(Session *session)
 }
 #endif
 
-gint session_send_msg(Session *session, SessionMsgType type, const gchar *msg)
+gint session_send_msg(Session *session, const gchar *msg)
 {
 	gboolean ret;
 
diff --git a/src/common/session.h b/src/common/session.h
index cd4b774..72b4512 100644
--- a/src/common/session.h
+++ b/src/common/session.h
@@ -55,16 +55,6 @@ typedef enum {
 	SESSION_DISCONNECTED
 } SessionState;
 
-typedef enum
-{
-	SESSION_MSG_NORMAL,
-	SESSION_MSG_SEND_DATA,
-	SESSION_MSG_RECV_DATA,
-	SESSION_MSG_CONTROL,
-	SESSION_MSG_ERROR,
-	SESSION_MSG_UNKNOWN
-} SessionMsgType;
-
 typedef gint (*RecvMsgNotify)			(Session	*session,
 						 const gchar	*msg,
 						 gpointer	 user_data);
@@ -203,7 +193,6 @@ gint session_start_tls	(Session	*session);
 #endif
 
 gint session_send_msg	(Session	*session,
-			 SessionMsgType	 type,
 			 const gchar	*msg);
 gint session_recv_msg	(Session	*session);
 gint session_send_data	(Session	*session,
diff --git a/src/common/smtp.c b/src/common/smtp.c
index a680836..144caf0 100644
--- a/src/common/smtp.c
+++ b/src/common/smtp.c
@@ -146,7 +146,7 @@ gint smtp_from(SMTPSession *session)
 
 	g_free(mail_size);
 
-	if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf) < 0)
+	if (session_send_msg(SESSION(session), buf) < 0)
 		return SM_ERROR;
 	log_print(LOG_PROTOCOL, "%sSMTP> %s\n", (session->is_esmtp?"E":""), buf);
 
@@ -197,8 +197,7 @@ static gint smtp_auth_recv(SMTPSession *session, const gchar *msg)
 		if (!strncmp(msg, "334 ", 4)) {
 			tmp = g_base64_encode(session->user, strlen(session->user));
 
-			if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL,
-					 tmp) < 0) {
+			if (session_send_msg(SESSION(session), tmp) < 0) {
 				g_free(tmp);
 				return SM_ERROR;
 			}
@@ -206,8 +205,7 @@ static gint smtp_auth_recv(SMTPSession *session, const gchar *msg)
 			log_print(LOG_PROTOCOL, "ESMTP> [USERID]\n");
 		} else {
 			/* Server rejects AUTH */
-			if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL,
-					 "*") < 0)
+			if (session_send_msg(SESSION(session), "*") < 0)
 				return SM_ERROR;
 			log_print(LOG_PROTOCOL, "ESMTP> *\n");
 		}
@@ -237,8 +235,7 @@ static gint smtp_auth_recv(SMTPSession *session, const gchar *msg)
 			response64 = g_base64_encode(response, strlen(response));
 			g_free(response);
 
-			if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL,
-					 response64) < 0) {
+			if (session_send_msg(SESSION(session), response64) < 0) {
 				g_free(response64);
 				return SM_ERROR;
 			}
@@ -246,8 +243,7 @@ static gint smtp_auth_recv(SMTPSession *session, const gchar *msg)
 			g_free(response64);
 		} else {
 			/* Server rejects AUTH */
-			if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL,
-					 "*") < 0)
+			if (session_send_msg(SESSION(session), "*") < 0)
 				return SM_ERROR;
 			log_print(LOG_PROTOCOL, "ESMTP> *\n");
 		}
@@ -255,7 +251,7 @@ static gint smtp_auth_recv(SMTPSession *session, const gchar *msg)
 	case SMTPAUTH_DIGEST_MD5:
         default:
         	/* stop smtp_auth when no correct authtype */
-		if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "*") < 0)
+		if (session_send_msg(SESSION(session), "*") < 0)
 			return SM_ERROR;
 		log_print(LOG_PROTOCOL, "ESMTP> *\n");
 		break;
@@ -277,7 +273,7 @@ static gint smtp_auth_login_user_recv(SMTPSession *session, const gchar *msg)
 		tmp = g_strdup("*");
 	}
 
-	if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, tmp) < 0) {
+	if (session_send_msg(SESSION(session), tmp) < 0) {
 		g_free(tmp);
 		return SM_ERROR;
 	}
@@ -298,7 +294,7 @@ static gint smtp_ehlo(SMTPSession *session)
 
 	g_snprintf(buf, sizeof(buf), "EHLO %s",
 		   session->hostname ? session->hostname : get_domain_name());
-	if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf) < 0)
+	if (session_send_msg(SESSION(session), buf) < 0)
 		return SM_ERROR;
 	log_print(LOG_PROTOCOL, "ESMTP> %s\n", buf);
 
@@ -347,7 +343,7 @@ static gint smtp_starttls(SMTPSession *session)
 {
 	session->state = SMTP_STARTTLS;
 
-	if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "STARTTLS") < 0)
+	if (session_send_msg(SESSION(session), "STARTTLS") < 0)
 		return SM_ERROR;
 	log_print(LOG_PROTOCOL, "ESMTP> STARTTLS\n");
 
@@ -360,7 +356,7 @@ static gint smtp_auth_cram_md5(SMTPSession *session)
 	session->state = SMTP_AUTH;
 	session->auth_type = SMTPAUTH_CRAM_MD5;
 
-	if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "AUTH CRAM-MD5") < 0)
+	if (session_send_msg(SESSION(session), "AUTH CRAM-MD5") < 0)
 		return SM_ERROR;
 	log_print(LOG_PROTOCOL, "ESMTP> AUTH CRAM-MD5\n");
 
@@ -383,7 +379,7 @@ static gint smtp_auth_plain(SMTPSession *session)
 	out = g_strconcat("AUTH PLAIN ", b64buf, NULL);
 	g_free(b64buf);
 
-	if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, out) < 0) {
+	if (session_send_msg(SESSION(session), out) < 0) {
 		g_free(out);
 		return SM_ERROR;
 	}
@@ -400,7 +396,7 @@ static gint smtp_auth_login(SMTPSession *session)
 	session->state = SMTP_AUTH;
 	session->auth_type = SMTPAUTH_LOGIN;
 
-	if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "AUTH LOGIN") < 0)
+	if (session_send_msg(SESSION(session), "AUTH LOGIN") < 0)
 		return SM_ERROR;
 	log_print(LOG_PROTOCOL, "ESMTP> AUTH LOGIN\n");
 
@@ -415,7 +411,7 @@ static gint smtp_helo(SMTPSession *session)
 
 	g_snprintf(buf, sizeof(buf), "HELO %s",
 		   session->hostname ? session->hostname : get_domain_name());
-	if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf) < 0)
+	if (session_send_msg(SESSION(session), buf) < 0)
 		return SM_ERROR;
 	log_print(LOG_PROTOCOL, "SMTP> %s\n", buf);
 
@@ -437,7 +433,7 @@ static gint smtp_rcpt(SMTPSession *session)
 		g_snprintf(buf, sizeof(buf), "RCPT TO:%s", to);
 	else
 		g_snprintf(buf, sizeof(buf), "RCPT TO:<%s>", to);
-	if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf) < 0)
+	if (session_send_msg(SESSION(session), buf) < 0)
 		return SM_ERROR;
 	log_print(LOG_PROTOCOL, "SMTP> %s\n", buf);
 
@@ -450,7 +446,7 @@ static gint smtp_data(SMTPSession *session)
 {
 	session->state = SMTP_DATA;
 
-	if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "DATA") < 0)
+	if (session_send_msg(SESSION(session), "DATA") < 0)
 		return SM_ERROR;
 	log_print(LOG_PROTOCOL, "SMTP> DATA\n");
 
@@ -478,7 +474,7 @@ gint smtp_quit(SMTPSession *session)
 {
 	session->state = SMTP_QUIT;
 
-	session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "QUIT");
+	session_send_msg(SESSION(session), "QUIT");
 	log_print(LOG_PROTOCOL, "SMTP> QUIT\n");
 
 	return SM_OK;
@@ -488,7 +484,7 @@ static gint smtp_eom(SMTPSession *session)
 {
 	session->state = SMTP_EOM;
 
-	if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, ".") < 0)
+	if (session_send_msg(SESSION(session), ".") < 0)
 		return SM_ERROR;
 	log_print(LOG_PROTOCOL, "SMTP> . (EOM)\n");
 
diff --git a/src/plugins/managesieve/managesieve.c b/src/plugins/managesieve/managesieve.c
index 0fb4ac7..6dac66f 100644
--- a/src/plugins/managesieve/managesieve.c
+++ b/src/plugins/managesieve/managesieve.c
@@ -263,7 +263,7 @@ static gint sieve_auth_recv(SieveSession *session, const gchar *msg)
 			tmp = g_base64_encode(session->user, strlen(session->user));
 			g_snprintf(buf, sizeof(buf), "\"%s\"", tmp);
 
-			if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf) < 0) {
+			if (session_send_msg(SESSION(session), buf) < 0) {
 				g_free(tmp);
 				return SE_ERROR;
 			}
@@ -271,8 +271,7 @@ static gint sieve_auth_recv(SieveSession *session, const gchar *msg)
 			log_print(LOG_PROTOCOL, "Sieve> [USERID]\n");
 		} else {
 			/* Server rejects AUTH */
-			if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL,
-					 "\"*\"") < 0)
+			if (session_send_msg(SESSION(session), "\"*\"") < 0)
 				return SE_ERROR;
 			log_print(LOG_PROTOCOL, "Sieve> *\n");
 		}
@@ -307,8 +306,7 @@ static gint sieve_auth_recv(SieveSession *session, const gchar *msg)
 			response = g_strdup_printf("\"%s\"", response64);
 			g_free(response64);
 
-			if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL,
-					 response) < 0) {
+			if (session_send_msg(SESSION(session), response) < 0) {
 				g_free(response);
 				return SE_ERROR;
 			}
@@ -316,15 +314,14 @@ static gint sieve_auth_recv(SieveSession *session, const gchar *msg)
 			g_free(response);
 		} else {
 			/* Server rejects AUTH */
-			if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL,
-					 "\"*\"") < 0)
+			if (session_send_msg(SESSION(session), "\"*\"") < 0)
 				return SE_ERROR;
 			log_print(LOG_PROTOCOL, "Sieve> *\n");
 		}
 		break;
 	default:
 		/* stop sieve_auth when no correct authtype */
-		if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, "*") < 0)
+		if (session_send_msg(SESSION(session), "*") < 0)
 			return SE_ERROR;
 		log_print(LOG_PROTOCOL, "Sieve> *\n");
 		break;
@@ -348,7 +345,7 @@ static gint sieve_auth_login_user_recv(SieveSession *session, const gchar *msg)
 		tmp = g_strdup("\"*\"");
 	}
 
-	if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, tmp) < 0) {
+	if (session_send_msg(SESSION(session), tmp) < 0) {
 		g_free(tmp);
 		return SE_ERROR;
 	}
@@ -365,8 +362,7 @@ static gint sieve_auth_cram_md5(SieveSession *session)
 	session->state = SIEVE_AUTH;
 	session->auth_type = SIEVEAUTH_CRAM_MD5;
 
-	if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL,
-				"Authenticate \"CRAM-MD5\"") < 0)
+	if (session_send_msg(SESSION(session), "Authenticate \"CRAM-MD5\"") < 0)
 		return SE_ERROR;
 	log_print(LOG_PROTOCOL, "Sieve> Authenticate CRAM-MD5\n");
 
@@ -389,7 +385,7 @@ static gint sieve_auth_plain(SieveSession *session)
 	out = g_strconcat("Authenticate \"PLAIN\" \"", b64buf, "\"", NULL);
 	g_free(b64buf);
 
-	if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL, out) < 0) {
+	if (session_send_msg(SESSION(session), out) < 0) {
 		g_free(out);
 		return SE_ERROR;
 	}
@@ -406,8 +402,7 @@ static gint sieve_auth_login(SieveSession *session)
 	session->state = SIEVE_AUTH;
 	session->auth_type = SIEVEAUTH_LOGIN;
 
-	if (session_send_msg(SESSION(session), SESSION_MSG_NORMAL,
-				"Authenticate \"LOGIN\"") < 0)
+	if (session_send_msg(SESSION(session), "Authenticate \"LOGIN\"") < 0)
 		return SE_ERROR;
 	log_print(LOG_PROTOCOL, "Sieve> Authenticate LOGIN\n");
 
@@ -552,7 +547,7 @@ static gint sieve_pop_send_queue(SieveSession *session)
 	log_send(session, cmd);
 	session->state = cmd->next_state;
 	session->current_cmd = cmd;
-	if (session_send_msg(SESSION(session), SESSION_SEND, cmd->msg) < 0)
+	if (session_send_msg(SESSION(session), cmd->msg) < 0)
 		return SE_ERROR;
 
 	return SE_OK;
@@ -696,7 +691,7 @@ static gint sieve_session_recv_msg(Session *session, const gchar *msg)
 					sieve_session->config->tls_type != SIEVE_TLS_NO) {
 				if (sieve_session->capability.starttls) {
 					log_print(LOG_PROTOCOL, "Sieve> STARTTLS\n");
-					session_send_msg(session, SESSION_SEND, "STARTTLS");
+					session_send_msg(session, "STARTTLS");
 					sieve_session->state = SIEVE_STARTTLS;
 				} else if (sieve_session->config->tls_type == SIEVE_TLS_YES) {
 					log_warning(LOG_PROTOCOL, "Sieve: does not support STARTTLS\n");
@@ -957,7 +952,7 @@ static gint sieve_cmd_noop(SieveSession *session)
 {
 	log_print(LOG_PROTOCOL, "Sieve> NOOP\n");
 	session->state = SIEVE_NOOP;
-	if (session_send_msg(SESSION(session), SESSION_SEND, "NOOP") < 0) {
+	if (session_send_msg(SESSION(session), "NOOP") < 0) {
 		session->state = SIEVE_ERROR;
 		session->error = SE_ERROR;
 		return 1;
@@ -1150,7 +1145,7 @@ static void sieve_queue_send(SieveSession *session, SieveState next_state,
 		session->current_cmd = cmd;
 		session->state = next_state;
 		log_send(session, cmd);
-		if (session_send_msg(SESSION(session), SESSION_SEND, cmd->msg) < 0) {
+		if (session_send_msg(SESSION(session), cmd->msg) < 0) {
 			/* error */
 		}
 	}
diff --git a/src/pop.c b/src/pop.c
index 2aad860..ee2db43 100644
--- a/src/pop.c
+++ b/src/pop.c
@@ -510,7 +510,7 @@ static void pop3_gen_send(Pop3Session *session, const gchar *format, ...)
 	else
 		log_print(LOG_PROTOCOL, "POP3> %s\n", buf);
 
-	session_send_msg(SESSION(session), SESSION_MSG_NORMAL, buf);
+	session_send_msg(SESSION(session), buf);
 }
 
 Session *pop3_session_new(PrefsAccount *account)

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list