diff --git a/doc/plugins.conf b/doc/plugins.conf
index 491eb74..6e5a9a0 100644
--- a/doc/plugins.conf
+++ b/doc/plugins.conf
@@ -13,6 +13,15 @@
#
plugin /usr/lib/uhub/mod_auth_sqlite.so "file=/etc/uhub/users.db"
+# Topic commands.
+# Note: "topic" == "hub description" (as configured in uhub.conf)
+#
+# !topic - change the topic (op required)
+# !showtopic - show the topic
+# !resettopic - reset the topic to the default (op required)
+#
+# This plugins takes no parameters.
+#plugin /usr/lib/uhub/mod_topic.so
# Log file writer
#
@@ -22,7 +31,8 @@ plugin /usr/lib/uhub/mod_auth_sqlite.so "file=/etc/uhub/users.db"
plugin /usr/lib/uhub/mod_logging.so "file=/var/log/uhub.log"
# A simple example plugin
-# plugin /usr/lib/uhub/mod_example.so
+#plugin /usr/lib/uhub/mod_example.so
+
# A plugin sending a welcome message.
#
# This plugin provides the following commands:
diff --git a/doc/uhub.conf b/doc/uhub.conf
index d379b0c..8df4ee4 100644
--- a/doc/uhub.conf
+++ b/doc/uhub.conf
@@ -104,11 +104,11 @@ msg_auth_invalid_password = Password is wrong
msg_auth_user_not_found = User not found in password database
msg_user_share_size_low = User is not sharing enough
msg_user_share_size_high = User is sharing too much
-msg_user_slots_low = User have too few upload slots
-msg_user_slots_high = User have too many upload slots
+msg_user_slots_low = User has too few upload slots
+msg_user_slots_high = User has too many upload slots
msg_user_hub_limit_low = User is on too few hubs
msg_user_hub_limit_high = User is on too many hubs
-msg_error_no_memory = No memory
+msg_error_no_memory = Out of memory
msg_user_flood_chat = Chat flood detected, messages are dropped.
msg_user_flood_connect = Connect flood detected, connection refused.
msg_user_flood_search = Search flood detected, search is stopped.
diff --git a/src/core/config.xml b/src/core/config.xml
index b5e949d..1561478 100644
--- a/src/core/config.xml
+++ b/src/core/config.xml
@@ -17,7 +17,7 @@
-
+
Server bind address
@@ -58,7 +58,7 @@
-
+
Comma separated list of alternative ports to listen to
-
+
A common hub redirect address.
-
+
A redirect address in case a client connects using "adc://" when "adcs://" is required.
Certificate file
0.3.0
diff --git a/src/core/hub.h b/src/core/hub.h
index cef1c96..7c4c5b7 100644
--- a/src/core/hub.h
+++ b/src/core/hub.h
@@ -27,7 +27,7 @@ enum status_message
status_msg_hub_registered_users_only = -3, /* hub is for registered users only */
status_msg_inf_error_nick_missing = -4, /* no nickname given */
status_msg_inf_error_nick_multiple = -5, /* multiple nicknames given */
- status_msg_inf_error_nick_invalid = -6, /* generic/unkown */
+ status_msg_inf_error_nick_invalid = -6, /* generic/unknown */
status_msg_inf_error_nick_long = -7, /* nickname too long */
status_msg_inf_error_nick_short = -8, /* nickname too short */
status_msg_inf_error_nick_spaces = -9, /* nickname cannot start with spaces */
@@ -50,8 +50,8 @@ enum status_message
status_msg_user_share_size_high = -41, /* User is sharing too much. */
status_msg_user_slots_low = -42, /* User has too few slots open. */
status_msg_user_slots_high = -43, /* User has too many slots open. */
- status_msg_user_hub_limit_low = -44, /* Use is on too few hubs. */
- status_msg_user_hub_limit_high = -45, /* Use is on too many hubs. */
+ status_msg_user_hub_limit_low = -44, /* User is on too few hubs. */
+ status_msg_user_hub_limit_high = -45, /* User is on too many hubs. */
status_msg_proto_no_common_hash = -50, /* No common hash algorithms */
status_msg_proto_obsolete_adc0 = -51, /* Client is using an obsolete protocol version */
diff --git a/src/network/connection.c b/src/network/connection.c
index 3828d54..fbf6a08 100644
--- a/src/network/connection.c
+++ b/src/network/connection.c
@@ -178,7 +178,7 @@ static int net_connect_job_check(struct net_connect_job* job)
int af = job->addr.ss_family;
enum net_connect_status status;
- int ret = net_connect(net_con_get_sd(con), (struct sockaddr*) &job->addr, af == AF_INET ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in));
+ int ret = net_connect(net_con_get_sd(con), (struct sockaddr*) &job->addr, af == AF_INET ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6));
if (ret == 0 || (ret == -1 && net_error() == EISCONN))
{
LOG_TRACE("net_connect_job_check(): Socket connected!");
diff --git a/src/network/openssl.c b/src/network/openssl.c
index db2daf3..2b160bd 100644
--- a/src/network/openssl.c
+++ b/src/network/openssl.c
@@ -127,7 +127,7 @@ extern void net_ssl_context_destroy(struct ssl_context_handle* ctx_)
int ssl_load_certificate(struct ssl_context_handle* ctx_, const char* pem_file)
{
struct net_context_openssl* ctx = (struct net_context_openssl*) ctx_;
- if (SSL_CTX_use_certificate_file(ctx->ssl_ctx, pem_file, SSL_FILETYPE_PEM) < 0)
+ if (SSL_CTX_use_certificate_chain_file(ctx->ssl_ctx, pem_file) < 0)
{
LOG_ERROR("SSL_CTX_use_certificate_file: %s", ERR_error_string(ERR_get_error(), NULL));
return 0;
@@ -302,6 +302,7 @@ void net_ssl_destroy(struct net_connection* con)
{
struct net_ssl_openssl* handle = get_handle(con);
SSL_free(handle->ssl);
+ hub_free(handle);
}
void net_ssl_callback(struct net_connection* con, int events)
diff --git a/src/plugins/mod_topic.c b/src/plugins/mod_topic.c
index 64a644e..7a42e62 100644
--- a/src/plugins/mod_topic.c
+++ b/src/plugins/mod_topic.c
@@ -25,7 +25,7 @@
struct topic_plugin_data
{
struct plugin_command_handle* topic;
- struct plugin_command_handle* cleartopic;
+ struct plugin_command_handle* resettopic;
struct plugin_command_handle* showtopic;
};
@@ -33,19 +33,20 @@ static int command_topic_handler(struct plugin_handle* plugin, struct plugin_use
{
struct cbuffer* buf = cbuf_create(128);
struct plugin_command_arg_data* arg = plugin->hub.command_arg_next(plugin, cmd, plugin_cmd_arg_type_string);
+ char* topic = arg ? arg->data.string : "";
- plugin->hub.set_description(plugin, arg ? arg->data.string : NULL);
- cbuf_append_format(buf, "*** %s: Topic set to \"%s\"", cmd->prefix, arg->data.string);
+ plugin->hub.set_description(plugin, topic);
+ cbuf_append_format(buf, "*** %s: Topic set to \"%s\"", cmd->prefix, topic);
plugin->hub.send_message(plugin, user, cbuf_get(buf));
cbuf_destroy(buf);
return 0;
}
-static int command_cleartopic_handler(struct plugin_handle* plugin, struct plugin_user* user, struct plugin_command* cmd)
+static int command_resettopic_handler(struct plugin_handle* plugin, struct plugin_user* user, struct plugin_command* cmd)
{
struct cbuffer* buf = cbuf_create(128);
plugin->hub.set_description(plugin, NULL);
- cbuf_append_format(buf, "*** %s: Topic cleared.", cmd->prefix);
+ cbuf_append_format(buf, "*** %s: Topic reset.", cmd->prefix);
plugin->hub.send_message(plugin, user, cbuf_get(buf));
cbuf_destroy(buf);
return 0;
@@ -67,17 +68,17 @@ int plugin_register(struct plugin_handle* plugin, const char* config)
struct topic_plugin_data* data = (struct topic_plugin_data*) hub_malloc(sizeof(struct topic_plugin_data));
data->topic = (struct plugin_command_handle*) hub_malloc_zero(sizeof(struct plugin_command_handle));
- data->cleartopic = (struct plugin_command_handle*) hub_malloc_zero(sizeof(struct plugin_command_handle));
+ data->resettopic = (struct plugin_command_handle*) hub_malloc_zero(sizeof(struct plugin_command_handle));
data->showtopic = (struct plugin_command_handle*) hub_malloc_zero(sizeof(struct plugin_command_handle));
PLUGIN_INITIALIZE(plugin, "Topic plugin", "1.0", "Add commands for changing the hub topic (description)");
PLUGIN_COMMAND_INITIALIZE(data->topic, (void*) data, "topic", "+m", auth_cred_operator, command_topic_handler, "Set new topic");
- PLUGIN_COMMAND_INITIALIZE(data->cleartopic, (void*) data, "cleartopic", "", auth_cred_operator, command_cleartopic_handler, "Clear the current topic");
+ PLUGIN_COMMAND_INITIALIZE(data->resettopic, (void*) data, "resettopic", "", auth_cred_operator, command_resettopic_handler, "Set topic to default");
PLUGIN_COMMAND_INITIALIZE(data->showtopic, (void*) data, "showtopic", "", auth_cred_guest, command_showtopic_handler, "Shows the current topic");
plugin->hub.command_add(plugin, data->topic);
- plugin->hub.command_add(plugin, data->cleartopic);
+ plugin->hub.command_add(plugin, data->resettopic);
plugin->hub.command_add(plugin, data->showtopic);
plugin->ptr = data;
@@ -90,10 +91,10 @@ int plugin_unregister(struct plugin_handle* plugin)
struct topic_plugin_data* data = (struct topic_plugin_data*) plugin->ptr;
plugin->hub.command_del(plugin, data->topic);
- plugin->hub.command_del(plugin, data->cleartopic);
+ plugin->hub.command_del(plugin, data->resettopic);
plugin->hub.command_del(plugin, data->showtopic);
hub_free(data->topic);
- hub_free(data->cleartopic);
+ hub_free(data->resettopic);
hub_free(data->showtopic);
hub_free(data);
plugin->ptr = NULL;