[Gd-chatter] r10795 - in trunk/libraries/xmpp: . xmpp-test
turbo24prg at gwydiondylan.org
turbo24prg at gwydiondylan.org
Fri Jun 9 21:00:29 CEST 2006
Author: turbo24prg
Date: Fri Jun 9 21:00:27 2006
New Revision: 10795
Modified:
trunk/libraries/xmpp/client.dylan
trunk/libraries/xmpp/xmpp-exports.dylan
trunk/libraries/xmpp/xmpp-test/xmpp-test-exports.dylan
trunk/libraries/xmpp/xmpp-test/xmpp-test.dylan
Log:
Bug: 7313
* join listener thread
Modified: trunk/libraries/xmpp/client.dylan
==============================================================================
--- trunk/libraries/xmpp/client.dylan (original)
+++ trunk/libraries/xmpp/client.dylan Fri Jun 9 21:00:27 2006
@@ -2,7 +2,7 @@
synopsis:
author:
copyright:
-
+
define class <xmpp-client> (<object>)
slot jid :: <jid>,
required-init-keyword: jid:;
@@ -14,6 +14,7 @@
slot lock :: <lock> = make(<lock>);
slot notification :: <notification>;
slot available-stanza :: false-or(<element>) = #f;
+ slot listener :: <thread>;
end class <xmpp-client>;
define method initialize (client :: <xmpp-client>, #rest rest, #key, #all-keys)
@@ -25,7 +26,7 @@
=> (connected :: <boolean>);
start-sockets();
client.socket := make(<tcp-socket>, host: host | client.jid.domain, port: port);
- make(<thread>, priority: $background-priority, function: curry(listen, client));
+ client.listener := make(<thread>, priority: $background-priority, function: curry(listen, client));
if (~ stream)
stream := make(<xmpp-stream>, to: client.jid.domain);
end if;
Modified: trunk/libraries/xmpp/xmpp-exports.dylan
==============================================================================
--- trunk/libraries/xmpp/xmpp-exports.dylan (original)
+++ trunk/libraries/xmpp/xmpp-exports.dylan Fri Jun 9 21:00:27 2006
@@ -80,6 +80,7 @@
state, state-setter,
callbacks,
callbacks-setter,
+ listener,
add-callback,
connect, disconnect,
send, authenticate,
Modified: trunk/libraries/xmpp/xmpp-test/xmpp-test-exports.dylan
==============================================================================
--- trunk/libraries/xmpp/xmpp-test/xmpp-test-exports.dylan (original)
+++ trunk/libraries/xmpp/xmpp-test/xmpp-test-exports.dylan Fri Jun 9 21:00:27 2006
@@ -21,4 +21,5 @@
use meta;
use %productions;
use printing;
+ use threads;
end module;
Modified: trunk/libraries/xmpp/xmpp-test/xmpp-test.dylan
==============================================================================
--- trunk/libraries/xmpp/xmpp-test/xmpp-test.dylan (original)
+++ trunk/libraries/xmpp/xmpp-test/xmpp-test.dylan Fri Jun 9 21:00:27 2006
@@ -147,13 +147,13 @@
format-out("%=\n", m);
normalize(m);
format-out("%=\n", m);
-*/
+
let foo-stanza = make(<message>);
let xxx = make(<element>, name: "x");
add-element(foo-stanza, xxx);
format-out("%=\n", object-class(first(foo-stanza.node-children)));
format-out("%=\n", object-class(first(elements(foo-stanza, "x"))));
-/*
+
let test-table = make(<table>);
test-table[#"x"] := <x>;
format-out("%=\n", test-table[#"x"]);
@@ -240,7 +240,7 @@
#f;
end);
*/
- let client = make(<xmpp-client>, jid: make(<jid>, node: "foo", domain: "192.168.0.1", resource: "xmpp"));
+ let client = make(<xmpp-client>, jid: make(<jid>, node: "dylan", domain: "pentabarf.org", resource: "xmpp"));
add-callback(client, <message>, callback1);
// add!(client.message-callbacks, callback1);
@@ -250,21 +250,23 @@
let stream = make(<xmpp-stream>, to: client.jid.domain);
block()
- if (~ connect(client))
+ if (~ connect(client, host: "benkstein.net", port: 4222))
exit-application(1);
end if;
format-out("Connected to xmpp server at %s port: %d\n",
client.socket.remote-host.host-name,
client.socket.remote-port);
- authenticate(client, "foo", #f);
+ authenticate(client, "test", #f);
send(client, make(<presence>, priority: 23));
// send(client, make(<message>, to: "ghul at jabber.org", type: #"chat", body: "This is turbot speaking, your friendly JabberBot written in Dylan."));
// send(client, make(<message>, to: "ghul at jabber.org", type: #"chat", body: "I'll echo everything you say!"));
// let result = send(client, make(<message>, to: "dylan at pentabarf.org/Psi", body: "This is turbot speaking."), awaits-result?: #t);
// format-out("### (X3) %=\n", result);
-
- while (#t)
+/* while (#t)
+ sleep(23);
end while;
+*/
+ join-thread(client.listener);
disconnect(client);
format-out("Connection closed. Bye\n");
cleanup
More information about the chatter
mailing list