| 26 | import jnode.module.JnodeModuleException; |
| 27 | |
| 28 | public class XMPPModule extends JnodeModule { |
| 29 | private final XMPPClient client; |
| 30 | private static final Logger logger = Logger.getLogger(XMPPModule.class); |
| 31 | |
| 32 | public XMPPModule(String configFile) throws JnodeModuleException { |
| 33 | super(configFile); |
| 34 | client = new XMPPClient(properties); |
| 35 | if (!client.testConnection()) { |
| 36 | throw new JnodeModuleException("Invalid XMPP configuration"); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | @Override |
| 41 | public void handle(IEvent event) { |
| 42 | // TODO Auto-generated method stub |
| 43 | |
| 44 | } |
| 45 | |
| 46 | @Override |
| 47 | public void start() { |
| 48 | synchronized (client) { |
| 49 | while (true) { |
| 50 | logger.l3("Running XMPP client..."); |
| 51 | client.run(); |
| 52 | try { |
| 53 | client.wait(); |
| 54 | } catch (InterruptedException e) { |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | } |