diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-04-09 08:33:49 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-04-09 08:33:49 (GMT) |
commit | eab71b765fe0422e5ab7d40536efec3136411a05 (patch) | |
tree | 8eccda86056e4ba9fdb6185917221c197df21f68 /Sluift | |
parent | 3fa6694fe14ac40f726efbea9b6d7dbc9e9131ca (diff) | |
download | swift-contrib-eab71b765fe0422e5ab7d40536efec3136411a05.zip swift-contrib-eab71b765fe0422e5ab7d40536efec3136411a05.tar.bz2 |
Fixed line endings in Wonderland script.
Diffstat (limited to 'Sluift')
-rwxr-xr-x | Sluift/Examples/Wonderland.lua | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/Sluift/Examples/Wonderland.lua b/Sluift/Examples/Wonderland.lua index cf79371..58c00ca 100755 --- a/Sluift/Examples/Wonderland.lua +++ b/Sluift/Examples/Wonderland.lua @@ -1,52 +1,52 @@ ---
--- Copyright (c) 2011 Remko Tronçon
--- Licensed under the GNU General Public License v3.
--- See Documentation/Licenses/GPLv3.txt for more information.
---
-
--- This script creates the wonderland world example.
---
-
-require "sluift"
---sluift.debug = true
-
-characters = {
- {jid = "alice@wonderland.lit", name = "Alice", groups = {}, presence = "<presence/>"},
- {jid = "hatter@wonderland.lit", name = "Mad Hatter", groups = {}, presence = "<presence><show>away</show><status>At the Tea Party</status></presence>"},
- {jid ="queen@wonderland.lit", name = "Queen of Hearts", groups = {}, presence = "<presence><show>dnd</show><status>Executing</status></presence>"},
- {jid = "rabbit@wonderland.lit", name = "White Rabbit", groups = {"Animals"}, presence = "<presence><status>Oh dear!</status></presence>"},
- {jid = "turtle@wonderland.lit", name = "Mock Turtle", groups = {"Animals"}, presence = "<presence/>"},
-}
-
-clients = {}
-for _, character in ipairs(characters) do
- print("Connecting " .. character["name"] .. "...")
- client = sluift.new_client(character["jid"], os.getenv("SLUIFT_PASS"))
- client:set_options({compress = false, tls = false})
- client:connect()
- client:get_contacts()
- client:send(character["presence"])
- table.insert(clients, client)
- for _, contact in ipairs(characters) do
- if contact["jid"] ~= character["jid"] then
- client:add_contact(contact)
- end
- end
-end
-
-print("Confirming subscriptions")
-for _, client in ipairs(clients) do
- for _, contact in ipairs(characters) do
- client:confirm_subscription(contact["jid"])
- end
-end
-
-print("Done. Waiting ...")
-while true do
- for _, client in ipairs(clients) do
- client:for_event(function(e)
- if e["type"] == "message" then client:send_message(e["from"], "Off with their heads!") end
- end, 1000)
- end
- sluift.sleep(1000)
-end
+-- +-- Copyright (c) 2011 Remko Tronçon +-- Licensed under the GNU General Public License v3. +-- See Documentation/Licenses/GPLv3.txt for more information. +-- + +-- This script creates the wonderland world example. +-- + +require "sluift" +--sluift.debug = true + +characters = { + {jid = "alice@wonderland.lit", name = "Alice", groups = {}, presence = "<presence/>"}, + {jid = "hatter@wonderland.lit", name = "Mad Hatter", groups = {}, presence = "<presence><show>away</show><status>At the Tea Party</status></presence>"}, + {jid ="queen@wonderland.lit", name = "Queen of Hearts", groups = {}, presence = "<presence><show>dnd</show><status>Executing</status></presence>"}, + {jid = "rabbit@wonderland.lit", name = "White Rabbit", groups = {"Animals"}, presence = "<presence><status>Oh dear!</status></presence>"}, + {jid = "turtle@wonderland.lit", name = "Mock Turtle", groups = {"Animals"}, presence = "<presence/>"}, +} + +clients = {} +for _, character in ipairs(characters) do + print("Connecting " .. character["name"] .. "...") + client = sluift.new_client(character["jid"], os.getenv("SLUIFT_PASS")) + client:set_options({compress = false, tls = false}) + client:connect() + client:get_contacts() + client:send(character["presence"]) + table.insert(clients, client) + for _, contact in ipairs(characters) do + if contact["jid"] ~= character["jid"] then + client:add_contact(contact) + end + end +end + +print("Confirming subscriptions") +for _, client in ipairs(clients) do + for _, contact in ipairs(characters) do + client:confirm_subscription(contact["jid"]) + end +end + +print("Done. Waiting ...") +while true do + for _, client in ipairs(clients) do + client:for_event(function(e) + if e["type"] == "message" then client:send_message(e["from"], "Off with their heads!") end + end, 1000) + end + sluift.sleep(1000) +end |