]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix getting of emails
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 16 Feb 2019 14:42:11 +0000 (14:42 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 16 Feb 2019 14:42:11 +0000 (14:42 +0000)
src/lua/lua_task.c
src/lua/lua_url.c

index 7067ee836ad54365100cbbd4eff4260cc63144dd..f9c1f3a397805b08d7a19d7a73ea5e8b93b1d1e0 100644 (file)
@@ -2072,6 +2072,7 @@ lua_task_get_emails (lua_State * L)
                lua_createtable (L, g_hash_table_size (task->emails), 0);
                cb.i = 1;
                cb.L = L;
+               cb.mask = PROTOCOL_MAILTO;
                g_hash_table_foreach (task->emails, lua_tree_url_callback, &cb);
        }
        else {
index 69a12e028e7e2e15011e6ba71b36d88ee7866603..0a301e96d08ac90e1439e01103ca2e1103b391c8 100644 (file)
@@ -720,28 +720,7 @@ lua_url_to_table (lua_State *L)
 
 
                lua_pushstring (L, "protocol");
-
-               switch (u->protocol) {
-               case PROTOCOL_FILE:
-                       lua_pushstring (L, "file");
-                       break;
-               case PROTOCOL_FTP:
-                       lua_pushstring (L, "ftp");
-                       break;
-               case PROTOCOL_HTTP:
-                       lua_pushstring (L, "http");
-                       break;
-               case PROTOCOL_HTTPS:
-                       lua_pushstring (L, "https");
-                       break;
-               case PROTOCOL_MAILTO:
-                       lua_pushstring (L, "mailto");
-                       break;
-               case PROTOCOL_UNKNOWN:
-               default:
-                       lua_pushstring (L, "unknown");
-                       break;
-               }
+               lua_pushstring (L, rspamd_url_protocol_name (u->protocol));
                lua_settable (L, -3);
        }
        else {