From edbfac2943647a3e797b799e861d0442ba19a26e Mon Sep 17 00:00:00 2001 From: nemunaire Date: Mon, 15 Sep 2014 07:55:35 +0200 Subject: [PATCH] Alias module: avoid infinite recursion if an alias substitute by the same command --- modules/alias.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/alias.py b/modules/alias.py index 7685f02..aec5411 100644 --- a/modules/alias.py +++ b/modules/alias.py @@ -153,12 +153,18 @@ def treat_variables(res): @hook("pre_PRIVMSG_cmd") def treat_alias(msg): if msg.cmds[0] in DATAS.getNode("aliases").index: + oldcmd = msg.cmds[0] msg.text = msg.text.replace(msg.cmds[0], DATAS.getNode("aliases").index[msg.cmds[0]]["origin"], 1) + msg.qual = "def" msg.parse_content() - return treat_alias(msg) + # Avoid infinite recursion + if oldcmd == msg.cmds[0]: + return msg + else: + return treat_alias(msg) else: msg.text = replace_variables(msg.text, msg)