[Gd-chatter] r10758 - in trunk/libraries/xmpp: . xmpp-test
turbo24prg at gwydiondylan.org
turbo24prg at gwydiondylan.org
Tue May 30 19:53:38 CEST 2006
Author: turbo24prg
Date: Tue May 30 19:53:36 2006
New Revision: 10758
Modified:
trunk/libraries/xmpp/client.dylan
trunk/libraries/xmpp/message.dylan
trunk/libraries/xmpp/query.dylan
trunk/libraries/xmpp/xmpp-test/xmpp-test.dylan
Log:
Bug: 7313
* newline bug
* everything will be rewritten
Modified: trunk/libraries/xmpp/client.dylan
==============================================================================
--- trunk/libraries/xmpp/client.dylan (original)
+++ trunk/libraries/xmpp/client.dylan Tue May 30 19:53:36 2006
@@ -59,12 +59,10 @@
if (parsing-tag? = #f)
if (received = '<')
parsing-tag? := #t;
- if (size(buffer) > 0 & ~ every?(method(x) x = '\n' end, buffer) & current-element)
- //let xml-text = make(<char-string>, text: buffer);
- format-out("||| %= %=\n", current-element, buffer);
- format-out("||| %=\n", current-element.node-children);
- current-element.node-children := concatenate(current-element.node-children, vector(make(<char-string>, text: buffer)));
- format-out("||| %= %=\n", current-element, buffer);
+ if (size(buffer) > 0 & current-element)
+ if (~ every?(method(x) x = '\n' end, buffer))
+ current-element.node-children := concatenate(current-element.node-children, vector(make(<char-string>, text: buffer)));
+ end if;
buffer := "";
end if;
tag := add!(tag, received);
@@ -73,7 +71,6 @@
//!!! error: not well-formed xml: chars not contained in root element
format-out("!!! error: not well-formed xml: chars not contained in root element\n");
elseif (stream-running? & current-element)
- //!!! collect chars into text of current-element!!!
buffer := add(buffer, received);
read-next();
end if;
@@ -266,19 +263,20 @@
end block;
end method dispatch;
-define method authenticate (client :: <xmpp-client>, password, #key digest = #t)
- let authentication = #f;
- let authentication-request = #f;
- if (digest)
- //!!!
- else
- authentication-request := make-authentication-request(client.jid);
- authentication := make-authentication(client.jid, password);
- end if;
- //!!!
- send-with-id(client, authentication-request, awaits-result?: #t);
- ///!!! verify!!!
- send-with-id(client, authentication, awaits-result?: #t);
+define generic authenticate (client :: <xmpp-client>, password, digest) => (authenticated? :: <boolean>);
+define method authenticate (client :: <xmpp-client>, password, digest == #f)
+ => (authenticated? :: <boolean>);
+ let possibilities = send-with-id(client, make-authentication-request(client.jid), awaits-result?: #t);
+/* if (possibilities.type = #"result" &
+ elements(possibilities.query, "username") &
+ elements(possibilities.query, "resource") &
+ elements(possibilities.query, "password"))
+
+ ...
+
+ possibilities.query.password!!!
+*/
+ let success = send-with-id(client, make-authentication(client.jid, password), awaits-result?: #t);
end method authenticate;
define method connected? (client :: <xmpp-client>)
Modified: trunk/libraries/xmpp/message.dylan
==============================================================================
--- trunk/libraries/xmpp/message.dylan (original)
+++ trunk/libraries/xmpp/message.dylan Tue May 30 19:53:36 2006
@@ -48,7 +48,7 @@
=> (res :: false-or(<string>));
let bodies = elements(message, "body");
if (~ empty?(bodies))
- first(bodies).text;
+ first(bodies).unfiltered-text;
else
#f;
end if;
Modified: trunk/libraries/xmpp/query.dylan
==============================================================================
--- trunk/libraries/xmpp/query.dylan (original)
+++ trunk/libraries/xmpp/query.dylan Tue May 30 19:53:36 2006
@@ -3,5 +3,10 @@
author:
copyright:
-define element query ()
+define element query () //("query")
end element query;
+
+/*
+define element authentication-query ("query", "jabber:iq:auth")
+end element query;
+*/
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 Tue May 30 19:53:36 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: "dylan", domain: "pentabarf.org", resource: "xmpp"));
+ let client = make(<xmpp-client>, jid: make(<jid>, node: "foo", domain: "192.168.0.1", resource: "xmpp"));
add!(client.message-callbacks, callback1);
// add!(client.message-callbacks, callback2);
@@ -249,16 +249,16 @@
let stream = make(<xmpp-stream>, to: client.jid.domain);
block()
- if (~ connect(client, host: "benkstein.net", port: 4222))
+ if (~ connect(client))
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, "test", digest: #f);
+ authenticate(client, "foo", #f);
send(client, make(<presence>, priority: 23));
- send(client, make(<message>, to: "turbo24prg at jabber.ccc.de", type: #"chat", body: "This is turbot speaking, your friendly JabberBot written in Dylan."));
- send(client, make(<message>, to: "turbo24prg at jabber.ccc.de", type: #"chat", body: "I'll echo everything you say!"));
+// 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);
@@ -274,6 +274,5 @@
exit-application(0);
end function main;
-
// Invoke our main() function.
main(application-name(), application-arguments());
More information about the chatter
mailing list