I have the following code in a channel message hook to get the server context and print to the server window:
my $network = HexChat::get_info('network');
my $networkContext = HexChat::find_context(undef, $network);
HexChat::set_context($networkContext);
HexChat::print('test');
It works if I already have the server window open, or a channel on a different server, but if the current window is a channel on the server I request the context for I get the context of the current channel instead of the server. Is there any way to force find_context to always get the server context so 'test' is printed in the server window instead of the current channel's window