Removed SessionMsgType enum and its use, since it is useless.
authorAndrej Kacian <ticho@claws-mail.org>
Mon, 1 Aug 2016 19:07:59 +0000 (21:07 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Mon, 1 Aug 2016 19:07:59 +0000 (21:07 +0200)
The only user was session_send_msg(), which did nothing
with its SessionMsgType parameter.

src/common/session.c
src/common/session.h
src/common/smtp.c
src/plugins/managesieve/managesieve.c
src/pop.c

index 3285e32e8912b82216a3ffedfa6974ea0811f0be..356c32187e780ee50548d2a34c21b81f639bbd44 100644 (file)
@@ -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;
 
index cd4b774dbd6b5f705acca0bc364f1344541d3306..72b451261c5a08eec72b67c79b511cdf85760c1f 100644 (file)
@@ -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,
index a68083664d91bce562b7ac729c931ed119cc1fa6..144caf04aa12d3d05613f0c289ec42ef473ff3bb 100644 (file)
@@ -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");
 
index 0fb4ac74d1bce9d71ff286ae7d9eb2819f569543..6dac66f8f38fc401f6a255a6238445acb1c02100 100644 (file)
@@ -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 */
                }
        }
index 2aad860df7a0cfda743800147c42499eeb1e0ec4..ee2db434e10ab270cedede0015e3e6c24d11a8e8 100644 (file)
--- 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)