Nuno, are you putting IP address 192.168.1.165 in the Server field of your Spark? What is the name of your Openfire server? You can check it when logged into Admin Console (Server Name). You should put Server Name value instead of IP into Server field. Then go to Advanced menu on the Login screen and uncheck Automatically discover host and port, then put 192.168.1.165 into host field and press OK. Then try logging in.
I already try putting, on the Connection box (inside advanced connections preferences), my ip (as 192.x.x.x) and also like my dns (as mydomain.com) and nothing has worked so far.
My server name in Admin Console (Server Name) is ‘192.168.1.165’.
By the way, I never have “Automatically discover host and port” checked.