From 24ae78bec47b6c27e428542dfc94a5aeb1026962 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sat, 26 Mar 2016 21:07:37 +0000 Subject: [PATCH] [Minor] Remove legacy interface --- src/libserver/protocol.c | 31 +------------------------------ src/libserver/protocol.h | 7 ------- src/libserver/task.h | 8 -------- 3 files changed, 1 insertion(+), 45 deletions(-) diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index fe0a73fb7..ef1c25b19 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -91,7 +91,6 @@ #define NO_LOG_HEADER "Log" #define MLEN_HEADER "Message-Length" -static GList *custom_commands = NULL; static GQuark rspamd_protocol_quark (void) @@ -137,10 +136,8 @@ static gboolean rspamd_protocol_handle_url (struct rspamd_task *task, struct rspamd_http_message *msg) { - GList *cur; GHashTable *query_args; GHashTableIter it; - struct custom_command *cmd; struct http_parser_url u; const gchar *p; gsize pathlen; @@ -225,21 +222,7 @@ rspamd_protocol_handle_url (struct rspamd_task *task, } break; default: - cur = custom_commands; - while (cur) { - cmd = cur->data; - if (g_ascii_strncasecmp (p, cmd->name, pathlen) == 0) { - task->cmd = CMD_OTHER; - task->custom_cmd = cmd; - break; - } - cur = g_list_next (cur); - } - - if (cur == NULL) { - goto err; - } - break; + goto err; } if (u.field_set & (1 << UF_QUERY)) { @@ -1139,15 +1122,3 @@ rspamd_protocol_write_reply (struct rspamd_task *task) task->processed_stages |= RSPAMD_TASK_STAGE_REPLIED; } - -void -register_protocol_command (const gchar *name, protocol_reply_func func) -{ - struct custom_command *cmd; - - cmd = g_malloc (sizeof (struct custom_command)); - cmd->name = name; - cmd->func = func; - - custom_commands = g_list_prepend (custom_commands, cmd); -} diff --git a/src/libserver/protocol.h b/src/libserver/protocol.h index a88a48231..766d48dd5 100644 --- a/src/libserver/protocol.h +++ b/src/libserver/protocol.h @@ -71,11 +71,4 @@ ucl_object_t * rspamd_protocol_write_ucl (struct rspamd_task *task); void rspamd_protocol_write_reply (struct rspamd_task *task); -/** - * Register custom fucntion to extend protocol - * @param name symbolic name of custom function - * @param func callback function for writing reply - */ -void register_protocol_command (const gchar *name, protocol_reply_func func); - #endif diff --git a/src/libserver/task.h b/src/libserver/task.h index f293ef10f..c27d4bcb5 100644 --- a/src/libserver/task.h +++ b/src/libserver/task.h @@ -109,19 +109,11 @@ enum rspamd_task_stage { #define RSPAMD_TASK_IS_PROCESSED(task) (((task)->processed_stages & RSPAMD_TASK_STAGE_DONE)) #define RSPAMD_TASK_IS_CLASSIFIED(task) (((task)->processed_stages & RSPAMD_TASK_STAGE_CLASSIFIERS)) -typedef gint (*protocol_reply_func)(struct rspamd_task *task); - -struct custom_command { - const gchar *name; - protocol_reply_func func; -}; - /** * Worker task structure */ struct rspamd_task { struct rspamd_worker *worker; /**< pointer to worker object */ - struct custom_command *custom_cmd; /**< custom command if any */ guint processed_stages; /**< bits of stages that are processed */ enum rspamd_command cmd; /**< command */ gint sock; /**< socket descriptor */ -- 2.39.5