Index: src/main/java/hudson/plugins/jabber/im/transport/JabberPublisherDescriptor.java =================================================================== --- src/main/java/hudson/plugins/jabber/im/transport/JabberPublisherDescriptor.java (revision 28599) +++ src/main/java/hudson/plugins/jabber/im/transport/JabberPublisherDescriptor.java Mon Mar 22 12:08:44 MDT 2010 @@ -47,6 +47,8 @@ public static final String PARAMETERNAME_PORT = JabberPublisherDescriptor.PREFIX + "port"; public static final String PARAMETERNAME_HOSTNAME = JabberPublisherDescriptor.PREFIX + "hostname"; public static final String PARAMETERNAME_SSL = JabberPublisherDescriptor.PREFIX + "ssl"; + public static final String PARAMETERNAME_SASL = JabberPublisherDescriptor.PREFIX + "enableSASL"; + public static final String PARAMETERNAME_SMACK_RECONNECT = JabberPublisherDescriptor.PREFIX + "smackReconnect"; public static final String PARAMETERNAME_PRESENCE = JabberPublisherDescriptor.PREFIX + "exposePresence"; public static final String PARAMETERNAME_PASSWORD = JabberPublisherDescriptor.PREFIX + "password"; public static final String PARAMETERNAME_JABBERID = JabberPublisherDescriptor.PREFIX + "jabberId"; @@ -97,6 +99,8 @@ private String hudsonPassword; private String groupChatNickname; private boolean exposePresence = true; + private boolean enableSASL = true; + private boolean smackReconnect = false; private String initialGroupChats; private String commandPrefix = DEFAULT_COMMAND_PREFIX; private String defaultIdSuffix; @@ -329,6 +333,14 @@ else return String.valueOf(port); } + public boolean isEnableSASL() { + return enableSASL; + } + + public boolean isSmackReconnect() { + return smackReconnect; + } + public boolean isExposePresence() { return this.exposePresence; } @@ -422,6 +434,8 @@ String en = req.getParameter(PARAMETERNAME_ENABLED); this.enabled = Boolean.valueOf(en != null); this.exposePresence = req.getParameter(JabberPublisherDescriptor.PARAMETERNAME_PRESENCE) != null; + this.enableSASL = req.getParameter(JabberPublisherDescriptor.PARAMETERNAME_SASL) != null; + this.smackReconnect = req.getParameter(JabberPublisherDescriptor.PARAMETERNAME_SMACK_RECONNECT) != null; this.subscriptionMode = Util.fixEmptyAndTrim(req.getParameter(JabberPublisherDescriptor.PARAMETERNAME_SUBSCRIPTION_MODE)); applyHostname(req); applyPort(req); Index: src/main/resources/hudson/plugins/jabber/im/transport/JabberPublisher/global.jelly =================================================================== --- src/main/resources/hudson/plugins/jabber/im/transport/JabberPublisher/global.jelly (revision 28599) +++ src/main/resources/hudson/plugins/jabber/im/transport/JabberPublisher/global.jelly Mon Mar 22 13:35:28 MDT 2010 @@ -1,64 +1,78 @@ + xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form"> - + - + - + - - - - - - + + + + + + - + - + value="${descriptor.initialGroupChats}"/> - - - - - - - - + + + + + + + + - + - + value="${descriptor.defaultIdSuffix}"/> - + + + + + + + - - - - - - - - + + + + + + + + value="${descriptor.commandPrefix}"/> - - - + + + value="${descriptor.groupChatNickname}"/> - - - + + + value="${descriptor.hudsonUserName}"/> - - - + + + value="${descriptor.hudsonPassword}"/> - - - - + + + + Index: src/main/webapp/help-smack-reconnect.html =================================================================== --- src/main/webapp/help-smack-reconnect.html Mon Mar 22 12:08:44 MDT 2010 +++ src/main/webapp/help-smack-reconnect.html Mon Mar 22 12:08:44 MDT 2010 @@ -0,0 +1,3 @@ +
+ The jabber plugin has its own built-in connection monitoring that should handle reconnection. SMACK also has a built-in reconnection mechanism that is disabled by default. You can enable this if you are having unstable connections to see if it helps. +
\ No newline at end of file Index: src/main/webapp/help-sasl.html =================================================================== --- src/main/webapp/help-sasl.html Mon Mar 22 11:41:05 MDT 2010 +++ src/main/webapp/help-sasl.html Mon Mar 22 11:41:05 MDT 2010 @@ -0,0 +1,8 @@ +
+ SASL authentication is enabled by default. Some connections will fail if this is set. +

+ If your connection doesn't work, and you see an error in the logs that reads: + WARNING: SASL authentication failed using mechanism PLAIN + you should disable SASL authentication. +

+
\ No newline at end of file Index: src/main/java/hudson/plugins/jabber/im/transport/JabberIMConnection.java =================================================================== --- src/main/java/hudson/plugins/jabber/im/transport/JabberIMConnection.java (revision 28598) +++ src/main/java/hudson/plugins/jabber/im/transport/JabberIMConnection.java Mon Mar 22 12:08:44 MDT 2010 @@ -86,6 +86,8 @@ private IMPresence impresence; private String imStatusMessage; + private boolean enableSASL; + private boolean smackReconnect; private final JabberPublisherDescriptor desc; private final Authentication authentication; @@ -101,6 +103,8 @@ this.port = desc.getPort(); this.nick = JabberUtil.getUserPart(desc.getJabberId()); this.passwd = desc.getPassword(); + this.enableSASL = desc.isEnableSASL(); + this.smackReconnect = desc.isSmackReconnect(); this.groupChatNick = desc.getGroupChatNickname() != null ? desc.getGroupChatNickname() : this.nick; this.botCommandPrefix = desc.getCommandPrefix(); @@ -216,8 +220,10 @@ // Currently, we handle reconnects ourself. // Maybe we should change it in the future, but currently I'm // not sure what Smack's reconnect feature really does. - cfg.setReconnectionAllowed(false); + cfg.setReconnectionAllowed(this.smackReconnect); + cfg.setSASLAuthenticationEnabled(this.enableSASL); + this.connection = new XMPPConnection(cfg); this.connection.connect(); @@ -288,7 +294,7 @@ return c; } } - + final Chat chat = this.connection.getChatManager().createChat(chatPartner, null); Bot bot = new Bot(new JabberChat(chat, this), this.groupChatNick, this.desc.getHost(), this.botCommandPrefix, this.authentication);