I am writing an ejabberd module to filter packets. I need to get the hostname to pull some configs using gen_mod:get_module_opt().
I have 4 important functions :
start(Host, _Opt): This is an ejabberd function to load my module. I get theHostatom herefilter_packet({From, To, XML}): This is my packet filter hook. I cannot pass custom params to this function, as it is a hook in ejabberd.get_translation(XmlData):filter_packet()callsget_translation()in a loopfetch_translation(XmlData): called recursively fromget_translation(). This is where I am callinggen_mod:get_module_opt(), and hence need theHost.
My question is, how can I take Host from start() and put it in a global variable, so that fetch_translation can access it?