Skip to content

Commit

Permalink
update logging in XMPP service
Browse files Browse the repository at this point in the history
  • Loading branch information
mindcrime committed Apr 22, 2017
1 parent f7c37a7 commit 05887e2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
Expand Up @@ -89,6 +89,7 @@ class ShareController
{
try
{
log.debug( "Trying to send xmpp message to address: " + address );
xmppNotificationService.sendChat( address, "\n" + messageSubject + "\n" + messageText );
}
catch( Exception e )
Expand Down
Expand Up @@ -8,17 +8,25 @@ import org.jivesoftware.smack.packet.Message

class XmppNotificationService {

def grailsApplication;
def grailsApplication;

boolean transactional = false

def sendChat(String to, String msg) {

log.debug( "Sending notification to: [${to}] )");
ConnectionConfiguration cc = new ConnectionConfiguration(
grailsApplication.config.chat.host,
grailsApplication.config.chat.port,
grailsApplication.config.chat.serviceName)

String chatHost = grailsApplication.config.chat.host;
String chatPort = grailsApplication.config.chat.port;
String chatServiceName = grailsApplication.config.chat.serviceName;

log.debug( "chat configuration. Host: ${chatHost}, port: ${chatPort}, serviceName: ${chatServiceName}.");


ConnectionConfiguration cc = new ConnectionConfiguration(
chatHost,
chatPort,
chatServiceName)

cc.setSASLAuthenticationEnabled( false );
XMPPConnection connection = new XMPPConnection(cc)
Expand All @@ -27,7 +35,8 @@ class XmppNotificationService {
try {

connection.connect()
connection.login(grailsApplication.config.chat.username,
String chatUserName = grailsApplication.config.chat.username;
connection.login( chatUserName,
grailsApplication.config.chat.password)

def chatmanager = connection.getChatManager()
Expand Down

0 comments on commit 05887e2

Please sign in to comment.