Revision: 6077 Author: iratqq Date: Fri Nov 20 03:18:55 2009 Log: * scm/canna-custom.scm (canna-user-name): - New variable. (canna-lib-open-with-server): - Check server name. * scm/cannav3-socket.scm (canna-lib-init): - Use canna-user-name.
http://code.google.com/p/uim/source/detail?r=6077 Modified: /trunk/scm/canna-custom.scm /trunk/scm/cannav3-socket.scm ======================================= --- /trunk/scm/canna-custom.scm Wed Nov 4 08:13:55 2009 +++ /trunk/scm/canna-custom.scm Fri Nov 20 03:18:55 2009 @@ -323,6 +323,12 @@ (N_ "Canna server name") (N_ "long description will be here.")) +(define-custom 'canna-user-name (user-name) + '(canna-advanced cannaserver) + '(string ".*") + (N_ "Canna user name") + (N_ "long description will be here.")) + ;; activity dependency (custom-add-hook 'custom-preserved-canna-server-name 'custom-activity-hooks @@ -336,6 +342,11 @@ custom-preserved-canna-server-name "")))) +(custom-add-hook 'canna-user-name + 'custom-activity-hooks + (lambda () + custom-activate-canna-server-name?)) + ;; decode #f from canna-server-name (custom-add-hook 'custom-activate-canna-server-name? 'custom-get-hooks ======================================= --- /trunk/scm/cannav3-socket.scm Fri Nov 20 02:55:00 2009 +++ /trunk/scm/cannav3-socket.scm Fri Nov 20 03:18:55 2009 @@ -239,9 +239,11 @@ (define canna-lib-cannaserver #f) (define (canna-lib-open-with-server server) - (if canna-server-name - (tcp-connect server "canna") - (unix-domain-socket-connect "/tmp/.iroha_unix/IROHA"))) + (let ((server-name (if (equal? server "") + "localhost"))) + (if canna-server-name + (tcp-connect server-name "canna") + (unix-domain-socket-connect "/tmp/.iroha_unix/IROHA")))) (define (canna-lib-init server) (set! canna-lib-cannaserver server) @@ -249,7 +251,7 @@ (let ((s (canna-lib-open-with-server server))) (and s (begin - (canna-lib-initialize s (user-name)) + (canna-lib-initialize s canna-user-name) (set! *canna-lib-socket* s) #t)))))
