--- a/CMakeLists.txt Tue May 19 00:44:52 2009 +0300
+++ b/CMakeLists.txt Tue May 19 01:16:55 2009 +0300
@@ -19,6 +19,10 @@
## User options
option(DEBUG "Enable debugging output" ON)
+set(TEST_USER "test@jabber.org" CACHE TEXT "Testing: Your jabber account name")
+set(TEST_PASSWORD "greatsecret" CACHE TEXT "Testing: Password for your jabber account")
+set(TEST_TO "test@jabber.org/mcabber" CACHE TEXT "Testing: Target jabber entity")
+set(TEST_FINGERPRINT "00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff" CACHE TEXT "Testing: Your jabber server SSL fingerprint")
## Define targets
add_library(loudmouth MODULE util.c lm_types.c lm_proxy.c lm_ssl.c lm_connection.c lm_message.c lm_message_node.c lm_message_handler.c lm.c)
@@ -73,8 +77,7 @@
add_custom_command(OUTPUT ${lua-lm_BINARY_DIR}/loudmouth.html COMMAND ${PERL_EXECUTABLE} ${lua-lm_SOURCE_DIR}/docgen.pl ${lua-lm_SOURCES} > ${lua-lm_BINARY_DIR}/loudmouth.html DEPENDS ${lua-lm_SOURCE_DIR}/docgen.pl ${lua-lm_SOURCES} WORKING_DIRECTORY ${lua-lm_SOURCE_DIR})
add_custom_target(doc ALL DEPENDS ${lua-lm_BINARY_DIR}/loudmouth.html)
endif()
-add_custom_target(test COMMAND env "LUA_PATH=${lua-lm_SOURCE_DIR}/?.lua;${LUA_PATH}" "LUA_CPATH=${lua-lm_SOURCE_DIR}/?.so;${lua-lm_BINARY_DIR}/?.so;${LUA_CPATH}" lua ${lua-lm_SOURCE_DIR}/test.lua DEPENDS loudmouth VERBATIM)
-add_custom_target(test1 COMMAND env "LUA_PATH=${lua-lm_SOURCE_DIR}/?.lua;${LUA_PATH}" "LUA_CPATH=${lua-lm_SOURCE_DIR}/?.so;${lua-lm_BINARY_DIR}/?.so;${LUA_CPATH}" lua ${lua-lm_BINARY_DIR}/test.lua DEPENDS loudmouth VERBATIM)
+add_custom_target(test COMMAND env "LUA_PATH=${lua-lm_SOURCE_DIR}/?.lua;${LUA_PATH}" "LUA_CPATH=${lua-lm_SOURCE_DIR}/?.so;${lua-lm_BINARY_DIR}/?.so;${LUA_CPATH}" lua "${lua-lm_SOURCE_DIR}/test.lua" "${TEST_USER}" "${TEST_PASSWORD}" "${TEST_TO}" "${TEST_FINGERPRINT}" DEPENDS loudmouth VERBATIM)
## Set up installer
install(TARGETS loudmouth DESTINATION lib/lua/5.1)
--- a/test.lua Tue May 19 00:44:52 2009 +0300
+++ b/test.lua Tue May 19 01:16:55 2009 +0300
@@ -9,10 +9,10 @@
sent = false
-server = 'jabber.kiev.ua'
-username = arg[1]
-password = arg[2]
-fingerprint = 'D5:F9:7B:6F:90:CC:E9:3C:36:AE:5E:3A:47:E4:C5:65'
+server, username = arg[1]:match ( '(.+)@(.-)' )
+password = arg[2]
+recipient = arg[3] or arg[1]
+fingerprint = arg[4] or '01:23:45:67:89:ab:cd:ef:fe:dc:ba:98:76:54:32:10'
--[[
-- What's goes on, pretty close to C api,
@@ -48,11 +48,11 @@
print ( "Sending..." )
connection:send (
- lm.message.new( 'isbear@jabber.kiev.ua', 'message' )
+ lm.message.new( recipient, 'message' )
:child ( 'body', 'Hello, this is just a test' ) )
connection:send (
- lm.message.new( 'isbear@jabber.kiev.ua/lair', 'iq', 'get' )
+ lm.message.new( recipient, 'iq', 'get' )
:child( 'query', '' ):attribute ( 'xmlns', 'jabber:iq:version' ),
function ( connection, message )
node = message:child ( 'query' )
@@ -94,13 +94,13 @@
print ( 'connected' )
connection:send (
- lm.message.create { mtype = "message", to = 'isbear@jabber.kiev.ua',
+ lm.message.create { mtype = "message", to = recipient,
body = { 'Hello, this is just a test' },
} )
print ( 'sent' )
connection:send (
- lm.message.create { mtype = "iq-get", to = "isbear@jabber.kiev.ua/lair",
+ lm.message.create { mtype = "iq-get", to = recipient,
query = { xmlns = "jabber:iq:version" }
},
function ( connection, message )