diff options
author | Telyn <telyn@telynz.uk> | 2018-01-31 11:30:50 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-31 11:30:50 +0000 |
commit | 9ef70ed3d53e11dacc5d4df4478d5ff452a2dd6d (patch) | |
tree | ace44f0ea0a81d7d369df74c3d95c219905e7fa6 /utils/test-smack.rb | |
parent | 0be1fa0ebadf9435a760582d17f47ff96dc0851c (diff) | |
parent | 9af0d1761552601db30de7a991d90d64ec6c88f5 (diff) |
Release to master
Diffstat (limited to 'utils/test-smack.rb')
-rwxr-xr-x | utils/test-smack.rb | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/utils/test-smack.rb b/utils/test-smack.rb deleted file mode 100755 index 022f9d0..0000000 --- a/utils/test-smack.rb +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/jruby -# CLASSPATH="$CLASSPATH:/home/yann/projects/mauvealert/jars/smack.jar:/home/yann/projects/mauvealert/jars/smackx.jar -# ./test-smack - -require 'java' -require '../jars/smack.jar' -require '../jars/smackx.jar' -require 'rubygems' -require 'rainbow' -require 'pp' - -include_class "org.jivesoftware.smack.XMPPConnection" -include_class "org.jivesoftware.smackx.muc.MultiUserChat" - -user_jid='mauvealert' -password='WojIsEv8ScaufOm1' -msg = "What fresh hell is this? -- Dorothy Parker." -begin - - print "XMPP object instanciated.\n".color(:green) - xmpp = XMPPConnection.new("chat.bytemark.co.uk") - - - print "Connection done.\n".color(:green) - xmpp.connect - if true != xmpp.isConnected - print "Failed to connect".color(:red) - return -1 - end - - - print "Login.\n".color(:green) - xmpp.login(user_jid, password, "Testing_smack") - if true != xmpp.isAuthenticated() - print "Failed to authenticate\n".color(:red) - return -1 - end - if true == xmpp.isSecureConnection() - print "Connection is secure\n".color(:green) - else - print "Connection is NOT secure.\n".color(:yellow) - end - - - print "Get chat manager.\n".color(:green) - chat = xmpp.getChatManager.createChat( - "yann@chat.bytemark.co.uk", nil) - - print "Sending message to #{chat.getParticipant}.\n".color(:green) - chat.sendMessage(msg) - - - print "Joining, sending a message and leaving a room.\n".color(:green) - #muc = MultiUserChat.new(xmpp, "office@conference.chat.bytemark.co.uk") - muc = MultiUserChat.new(xmpp, "test@conference.chat.bytemark.co.uk") - muc.join("Mauve alert bot") - muc.sendMessage(msg) - sleep 1 - #muc.leave() - - - print "Adieu monde cruel!\n".color(:green) - xmpp.disconnect - - - print "all done.\n".color(:green) -rescue => ex - print "EPIC FAIL: Raised #{ex.class} because #{ex.message}\n\n".color(:red) - raise ex -end - -=begin -require 'java' -require './jars/smack.jar' -require './jars/smackx.jar' -include_class "org.jivesoftware.smack.XMPPConnection" -include_class "org.jivesoftware.smackx.muc.MultiUserChat" -user_jid='mauvealert' -password='WojIsEv8ScaufOm1' -msg = "What fresh hell is this? -- Dorothy Parker." -xmpp = XMPPConnection.new("chat.bytemark.co.uk") -xmpp.connect -xmpp.login(user_jid, password, "mauve_test") - -jid="yann@chat.bytemark.co.uk" -chat = xmpp.getChatManager.createChat(jid, nil) -chat.sendMessage(msg) - -xmpp.getRoster().reload() -xmpp.getRoster().getPresence(jid).isAvailable() -xmpp.getRoster().getPresence(jid).getStatus() - -muc = MultiUserChat.new(xmpp, 'office@conference.chat.bytemark.co.uk/mauvealert') -muc.join("Mauve alert bot") -muc.sendMessage(msg) - -muc2 = MultiUserChat.new(xmpp, "test@conference.chat.bytemark.co.uk") -muc2.join("Mauve alert bot") -muc2.sendMessage(msg) - -=end |