summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/operserv.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/operserv.c b/src/operserv.c
index 2f595b038..42b1b94b5 100644
--- a/src/operserv.c
+++ b/src/operserv.c
@@ -4564,15 +4564,23 @@ static int do_set(User * u)
#ifdef USE_MYSQL
} else if (stricmp(option, "SQL") == 0) {
if (stricmp(setting, "on") == 0) {
- if (rdb_init()) {
- notice_lang(s_OperServ, u, OPER_SET_SQL_ON);
+ if (!MysqlHost) {
+ notice_lang(s_OperServ, u, OPER_SET_SQL_ERROR_DISABLED);
} else {
- notice_lang(s_OperServ, u, OPER_SET_SQL_ERROR_INIT);
+ if (rdb_init()) {
+ notice_lang(s_OperServ, u, OPER_SET_SQL_ON);
+ } else {
+ notice_lang(s_OperServ, u, OPER_SET_SQL_ERROR_INIT);
+ }
}
} else if (stricmp(setting, "off") == 0) {
- /* could call rdb_close() but that does nothing - TSL */
- do_mysql = 0;
- notice_lang(s_OperServ, u, OPER_SET_SQL_OFF);
+ if (!MysqlHost) {
+ notice_lang(s_OperServ, u, OPER_SET_SQL_ERROR_DISABLED);
+ } else {
+ /* could call rdb_close() but that does nothing - TSL */
+ do_mysql = 0;
+ notice_lang(s_OperServ, u, OPER_SET_SQL_OFF);
+ }
} else {
notice_lang(s_OperServ, u, OPER_SET_SQL_ERROR);
}