commit ba63e16: [Minor] Fix getting of emails

Vsevolod Stakhov vsevolod at highsecure.ru
Sat Feb 16 14:49:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-02-16 14:42:11 +0000
URL: https://github.com/rspamd/rspamd/commit/ba63e160b52fa55478968c97053b9651f7d571c8 (HEAD -> master)

[Minor] Fix getting of emails

---
 src/lua/lua_task.c |  1 +
 src/lua/lua_url.c  | 23 +----------------------
 2 files changed, 2 insertions(+), 22 deletions(-)

diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 7067ee836..f9c1f3a39 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -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 {
diff --git a/src/lua/lua_url.c b/src/lua/lua_url.c
index 69a12e028..0a301e96d 100644
--- a/src/lua/lua_url.c
+++ b/src/lua/lua_url.c
@@ -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 {


More information about the Commits mailing list