[Gd-chatter] r10837 - in trunk/libraries: base64 koala/sources/koala registry/generic xmpp

turbo24prg at gwydiondylan.org turbo24prg at gwydiondylan.org
Wed Jul 26 19:35:35 CEST 2006


Author: turbo24prg
Date: Wed Jul 26 19:35:31 2006
New Revision: 10837

Added:
   trunk/libraries/base64/
   trunk/libraries/base64/base64.dylan
      - copied, changed from r10811, trunk/libraries/koala/sources/xml-rpc-common/base64.dylan
   trunk/libraries/base64/base64.lid   (contents, props changed)
   trunk/libraries/base64/library.dylan   (contents, props changed)
   trunk/libraries/registry/generic/base64   (contents, props changed)
   trunk/libraries/xmpp/library.dylan
      - copied, changed from r10823, trunk/libraries/xmpp/xmpp-exports.dylan
Removed:
   trunk/libraries/xmpp/xmpp-exports.dylan
Modified:
   trunk/libraries/koala/sources/koala/header-values.dylan
   trunk/libraries/koala/sources/koala/headers.dylan
   trunk/libraries/koala/sources/koala/library-unix.dylan
   trunk/libraries/koala/sources/koala/library.dylan
   trunk/libraries/xmpp/callback.dylan
   trunk/libraries/xmpp/client.dylan
   trunk/libraries/xmpp/xmpp.dylan
   trunk/libraries/xmpp/xmpp.lid
Log:
Job: minor
* extracted and created a common base64 library
* some useless fixes on xmpp
* better http-auth in koala



Copied: trunk/libraries/base64/base64.dylan (from r10811, trunk/libraries/koala/sources/xml-rpc-common/base64.dylan)
==============================================================================
--- trunk/libraries/koala/sources/xml-rpc-common/base64.dylan	(original)
+++ trunk/libraries/base64/base64.dylan	Wed Jul 26 19:35:31 2006
@@ -1,4 +1,4 @@
-Module:    xml-rpc-common
+Module:    base64
 Synopsis:  Base64 encoding/decoding
 Author:    Carl Gay
 License:   This code is in the public domain

Added: trunk/libraries/base64/base64.lid
==============================================================================
--- (empty file)
+++ trunk/libraries/base64/base64.lid	Wed Jul 26 19:35:31 2006
@@ -0,0 +1,3 @@
+library: base64
+files: library
+       base64

Added: trunk/libraries/base64/library.dylan
==============================================================================
--- (empty file)
+++ trunk/libraries/base64/library.dylan	Wed Jul 26 19:35:31 2006
@@ -0,0 +1,24 @@
+Module:    dylan-user
+Synopsis:  Base64 encoding/decoding
+Author:    Carl Gay
+License:   This code is in the public domain
+Warranty:  Distributed WITHOUT WARRANTY OF ANY KIND
+
+define library base64
+  use common-dylan;
+  use dylan-basics;
+  use io;
+  export base64;
+end;
+
+define module base64
+  use dylan;
+  use common-extensions, exclude: { format-to-string };
+  use dylan-basics, exclude: { split };
+  use streams;
+  export
+    base64-encode,
+    base64-decode;
+end;
+
+

Modified: trunk/libraries/koala/sources/koala/header-values.dylan
==============================================================================
--- trunk/libraries/koala/sources/koala/header-values.dylan	(original)
+++ trunk/libraries/koala/sources/koala/header-values.dylan	Wed Jul 26 19:35:31 2006
@@ -252,14 +252,16 @@
                                            epos :: <integer>)
   let dpos = whitespace-position(str, bpos, epos) | epos;
   let (b, e) = trim-whitespace(str, dpos, epos);
-  if (string-match("basic", str, b, e))
+
+  if (string-match("Basic", str, bpos, dpos))
     // base64 encoding of userid:password.  Should decode and return
     // (userid . password).  or maybe avalue with "userid"=userid, etc.
-    trimmed-substring(str, dpos, epos)
+    let username+password = string-split(base64-decode(trimmed-substring(str, dpos, epos)), ':');
+    pair(first(username+password), last(username+password));
   else
     make(<avalue>,
          value: substring(str, b, e),
-         alist: extract-attribute-value-alist(str, dpos, epos, ','))
+         alist: extract-attribute-value-alist(str, dpos, epos, ','));
   end;
 end;
 

Modified: trunk/libraries/koala/sources/koala/headers.dylan
==============================================================================
--- trunk/libraries/koala/sources/koala/headers.dylan	(original)
+++ trunk/libraries/koala/sources/koala/headers.dylan	Wed Jul 26 19:35:31 2006
@@ -238,7 +238,7 @@
 // cf RFC 2069
 // Returns string for "basic" and <avalue> for others.
 define sealed method parse-header-value (key == #"authorization", data :: <field-type>)
-  => (credentials :: type-union(<string>, <avalue>))
+  => (credentials :: type-union(<pair>, <avalue>))
   //(define-header-keywords "realm" "nonce" "username" "uri" "response" "digest" "algorithm" "opaque"
   //			"basic" "digest")
   parse-single-header(data, parse-authorization-value)

Modified: trunk/libraries/koala/sources/koala/library-unix.dylan
==============================================================================
--- trunk/libraries/koala/sources/koala/library-unix.dylan	(original)
+++ trunk/libraries/koala/sources/koala/library-unix.dylan	Wed Jul 26 19:35:31 2006
@@ -23,6 +23,7 @@
   use dylan-basics;                             // basic dylan utils
 //  use sql-odbc;
 //  use win32-kernel;
+  use base64;  
 
   export koala;
   export koala-extender;
@@ -241,7 +242,8 @@
 
   create
     moved-permanently-redirectr,
-    see-other-redirect;
+    see-other-redirect,
+    unauthorized-error;
 
   create
     http-error-code,
@@ -267,7 +269,9 @@
 define module httpi                             // http internals
   use dylan;
   use threads;               // from dylan lib
-  use common-extensions, exclude: { format-to-string, split };
+  use common-extensions,
+    rename: { split => string-split },
+    exclude: { format-to-string };
   use dylan-basics;
   use simple-random;
   use utilities,
@@ -305,6 +309,7 @@
   use xml-parser,
     prefix: "xml$";
   use xml-rpc-common;
+  use base64;
 //  use win32-kernel, import: { LoadLibrary, FreeLibrary };
 end module httpi;
 

Modified: trunk/libraries/koala/sources/koala/library.dylan
==============================================================================
--- trunk/libraries/koala/sources/koala/library.dylan	(original)
+++ trunk/libraries/koala/sources/koala/library.dylan	Wed Jul 26 19:35:31 2006
@@ -23,7 +23,8 @@
   use dylan-basics;                             // basic dylan utils
   use sql-odbc;
   use win32-kernel;
-
+  use base64;
+  
   export koala;
   export koala-extender;
   export dsp;
@@ -241,7 +242,8 @@
 
   create
     moved-permanently-redirectr,
-    see-other-redirect;
+    see-other-redirect,
+    unauthorized-error;
 
   create
     http-error-code,
@@ -267,7 +269,9 @@
 define module httpi                             // http internals
   use dylan;
   use threads;               // from dylan lib
-  use common-extensions, exclude: { format-to-string, split };
+  use common-extensions,
+    rename: { split => string-split },
+    exclude: { format-to-string };
   use dylan-basics;
   use simple-random;
   use utilities,
@@ -306,6 +310,7 @@
     prefix: "xml$";
   use xml-rpc-common;
   use win32-kernel, import: { LoadLibrary, FreeLibrary };
+  use base64;
 end module httpi;
 
 define module dsp

Added: trunk/libraries/registry/generic/base64
==============================================================================
--- (empty file)
+++ trunk/libraries/registry/generic/base64	Wed Jul 26 19:35:31 2006
@@ -0,0 +1 @@
+abstract://dylan/base64/base64.lid

Modified: trunk/libraries/xmpp/callback.dylan
==============================================================================
--- trunk/libraries/xmpp/callback.dylan	(original)
+++ trunk/libraries/xmpp/callback.dylan	Wed Jul 26 19:35:31 2006
@@ -1,7 +1,7 @@
 module: xmpp
-synopsis: 
-author: 
-copyright:
+synopsis:  
+author: turbo24prg
+copyright: none
 
 define class <callback> (<priority-queueable-mixin>)
   slot reference :: <symbol>,

Modified: trunk/libraries/xmpp/client.dylan
==============================================================================
--- trunk/libraries/xmpp/client.dylan	(original)
+++ trunk/libraries/xmpp/client.dylan	Wed Jul 26 19:35:31 2006
@@ -1,7 +1,7 @@
 module: xmpp
 synopsis: 
-author: 
-copyright:
+author: turbo24prg 
+copyright: 
 
 define class <xmpp-client> (<object>)
   slot jid :: <jid>,
@@ -11,7 +11,7 @@
   slot state :: one-of(#"disconnected", #"connected") = #"disconnected";
   slot callbacks :: <table> = make(<table>);
   virtual slot password;
-  slot lock :: <lock> = make(<lock>);
+  slot lock :: <lock>;
   slot notification :: <notification>;
   slot available-stanza :: false-or(<element>) = #f;
   slot listener :: <thread>;
@@ -19,6 +19,7 @@
 
 define method initialize (client :: <xmpp-client>, #rest rest, #key, #all-keys)
   next-method();
+  client.lock := make(<lock>); 
   client.notification := make(<notification>, lock: client.lock);
 end method initialize;
 

Copied: trunk/libraries/xmpp/library.dylan (from r10823, trunk/libraries/xmpp/xmpp-exports.dylan)
==============================================================================
--- trunk/libraries/xmpp/xmpp-exports.dylan	(original)
+++ trunk/libraries/xmpp/library.dylan	Wed Jul 26 19:35:31 2006
@@ -2,6 +2,8 @@
 
 define library xmpp
   use common-dylan;
+  use system,
+    import: { date };
   use io;
   use network;
   use xml-parser;
@@ -22,6 +24,7 @@
   use xml-stream-parser;
   use simple-xml;
   use priority-queue;
+  use date;
   
   //XXX
   use standard-io;

Modified: trunk/libraries/xmpp/xmpp.dylan
==============================================================================
--- trunk/libraries/xmpp/xmpp.dylan	(original)
+++ trunk/libraries/xmpp/xmpp.dylan	Wed Jul 26 19:35:31 2006
@@ -77,3 +77,8 @@
   add-attribute(element, make(<attribute>, name: "xml:lang", value: as(<string>, language)));
   language;
 end method language-setter;
+
+define function generate-id ()
+ => (id :: <string>);
+  integer-to-string(date-microseconds(current-date())); 
+end function generate-id;

Modified: trunk/libraries/xmpp/xmpp.lid
==============================================================================
--- trunk/libraries/xmpp/xmpp.lid	(original)
+++ trunk/libraries/xmpp/xmpp.lid	Wed Jul 26 19:35:31 2006
@@ -1,5 +1,5 @@
 library: xmpp
-files: xmpp-exports
+files: library
   xmpp
   stream
   jid



More information about the chatter mailing list