Skip to content

Instantly share code, notes, and snippets.

@tyama
Forked from ksky/gtalk.groovy
Created March 16, 2010 17:17
Show Gist options
  • Save tyama/334251 to your computer and use it in GitHub Desktop.
Save tyama/334251 to your computer and use it in GitHub Desktop.
@Grab('jivesoftware:smack:3.0.4')
@Grab('jivesoftware:smackx:3.0.4')
import org.jivesoftware.smack.*
(username, password) = ['<<from_username>>', '<<from_password>>']
to = '<<to_username>>@gmail.com'
con = new XMPPConnection(
new ConnectionConfiguration('talk.google.com', 5222, 'gmail.com'))
con.connect()
con.login(username, password)
chat = con.chatManager.createChat(to, { chat, msg ->
chat.sendMessage(msg.body)
} as MessageListener)
chat.sendMessage("Say something to me. I'll echo it.")
while(true) { sleep 1000 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment