diff --git a/extensions/beep.scm b/extensions/beep.scm index 75f421e..9a31aa7 100644 --- a/extensions/beep.scm +++ b/extensions/beep.scm @@ -18,8 +18,8 @@ (if (= (system "beep -f 1 -l 0 >> /dev/null 2>&1") 0) (add-hook! ft-message-receive-hook - (lambda (time from nickname message) - (system "beep -f 600 -l 10; beep -f 800 -l 10; beep -f 200 -l 10&"))) + (lambda (time from nickname message) + (system "beep -f 600 -l 10; beep -f 800 -l 10; beep -f 200 -l 10&"))) (add-hook! ft-message-receive-hook - (lambda (time from nickname message) - (ft-beep 200 20)))) + (lambda (time from nickname message) + (ft-beep 200 20)))) diff --git a/extensions/broadcast.scm b/extensions/broadcast.scm index 6a75e95..2790974 100644 --- a/extensions/broadcast.scm +++ b/extensions/broadcast.scm @@ -29,15 +29,15 @@ " Broadcast messages to all the roster " (let ((online-buddies (list))) (for-each (lambda (roster-item) - (and (cadr roster-item) - (set! online-buddies - (append online-buddies - (list (car roster-item)))))) - (ft-get-roster-list)) + (and (cadr roster-item) + (set! online-buddies + (append online-buddies + (list (car roster-item)))))) + (ft-get-roster-list)) (if (> (string-length message) 0) - (send-messages-to-all online-buddies - message) - (ft-display (_ "usage: /broadcast [MESSAGE]"))))) + (send-messages-to-all online-buddies + message) + (ft-display (_ "usage: /broadcast [MESSAGE]"))))) (add-command! /broadcast "/broadcast" "/broadcast [MESSAGE]" "Send messages to all buddies") (add-command! /broadcast "*" "* [MESSAGE]" "Send messages to all the buddies") \ No newline at end of file diff --git a/extensions/color.scm b/extensions/color.scm index ae079b9..6731f0e 100644 --- a/extensions/color.scm +++ b/extensions/color.scm @@ -45,23 +45,23 @@ (define (ignore-message! pattern) "ignore messages matching the pattern" (set! ignored-msg-pattern-list - (cons pattern ignored-msg-pattern-list))) + (cons pattern ignored-msg-pattern-list))) (define (ignored-message? message) "tell if this message has to be ignored" (letrec ((local-ignored-message? - (lambda (pattern-list message) - (if (= (length pattern-list) 0) - #f - (if (= (length pattern-list) 1) - (regexp-match? (string-match - (car pattern-list) message)) - (if (regexp-match? (string-match - (car pattern-list) message)) - #t - (local-ignored-message? - (cdr pattern-list) message))))))) + (lambda (pattern-list message) + (if (= (length pattern-list) 0) + #f + (if (= (length pattern-list) 1) + (regexp-match? (string-match + (car pattern-list) message)) + (if (regexp-match? (string-match + (car pattern-list) message)) + #t + (local-ignored-message? + (cdr pattern-list) message))))))) (local-ignored-message? ignored-msg-pattern-list message))) @@ -71,27 +71,27 @@ "specify color for buddies" (if (assoc buddy auto-color-list) (set! auto-color-list - (delete (cons - buddy - (cdr (assoc buddy auto-color-list))) - auto-color-list))) + (delete (cons + buddy + (cdr (assoc buddy auto-color-list))) + auto-color-list))) (set! auto-color-list - (append auto-color-list - (list (cons buddy color))))) + (append auto-color-list + (list (cons buddy color))))) (define (get-buddy-color buddy) (if (assoc buddy auto-color-list) '() (begin - (set! auto-color-list - (append - auto-color-list - (list (cons - buddy - (car (list-ref color-list - (modulo - (length auto-color-list) - (length color-list)))))))))) + (set! auto-color-list + (append + auto-color-list + (list (cons + buddy + (car (list-ref color-list + (modulo + (length auto-color-list) + (length color-list)))))))))) (cdr (assoc buddy auto-color-list))) (define (color-message msg color) @@ -106,25 +106,25 @@ (if (ignored-message? msg) (ft-hook-return) (if (equal? enable-colors-flag "yes") - (begin - (if (get-buddy-color from) - (begin - (ft-display - (string-append - (if (> (string-length timestamp) 0) - (color-message (string-append "[" timestamp "] ") - (get-buddy-color from)) - (color-message (strftime "%I:%M%p " (localtime (current-time))) - (get-buddy-color from))) - (color-message (if (> (string-length nickname) 0) - nickname - from) - (get-buddy-color from)) - (if (string-prefix? "/me " msg) - (color-message (substring msg 3) (get-buddy-color from)) - (color-message (string-append " -> " msg) (get-buddy-color from)) - ))) - (ft-hook-return))))))) + (begin + (if (get-buddy-color from) + (begin + (ft-display + (string-append + (if (> (string-length timestamp) 0) + (color-message (string-append "[" timestamp "] ") + (get-buddy-color from)) + (color-message (strftime "%I:%M%p " (localtime (current-time))) + (get-buddy-color from))) + (color-message (if (> (string-length nickname) 0) + nickname + from) + (get-buddy-color from)) + (if (string-prefix? "/me " msg) + (color-message (substring msg 3) (get-buddy-color from)) + (color-message (string-append " -> " msg) (get-buddy-color from)) + ))) + (ft-hook-return))))))) (add-hook! ft-message-receive-hook append-color) diff --git a/extensions/connection.scm b/extensions/connection.scm index 48e8e5d..bc0c2ba 100644 --- a/extensions/connection.scm +++ b/extensions/connection.scm @@ -20,12 +20,12 @@ (define (connect-handle ret) (cond ((= ret 0) #t) - ((= ret -6) (ft-display (_ "Already connected"))) - ((= ret -1) (ft-display (_ "Server not set"))) - ((= ret -2) (ft-display (_ "JID not set"))) - ((= ret -3) (ft-display (_ "SSL support not available"))) - ((= ret -5) (ft-display (_ "Proxy Server not set"))) - (else (ft-display (string-append (_ "Error, could not connect : ") + ((= ret -6) (ft-display (_ "Already connected"))) + ((= ret -1) (ft-display (_ "Server not set"))) + ((= ret -2) (ft-display (_ "JID not set"))) + ((= ret -3) (ft-display (_ "SSL support not available"))) + ((= ret -5) (ft-display (_ "Proxy Server not set"))) + (else (ft-display (string-append (_ "Error, could not connect : ") (number->string ret)))))) (define (set-if-not-empty! set-fn! var default-var) @@ -34,7 +34,7 @@ (if (string=? var "") #f (and (set-fn! var) - #t))) + #t))) (define (read-line-clean) (sans-surrounding-whitespace (read-line))) @@ -45,7 +45,6 @@ (define (domain->server domain) (cond ((string=? domain "jabber.org") "jabber.org") ((string=? domain "facebook.com") "chat.facebook.com") - ((string=? domain "fb.com") "chat.facebook.com") ((string=? domain "chat.facebook.com") "chat.facebook.com") (else domain))) @@ -132,8 +131,8 @@ (and (if (> (ft-get-conn-status) 0) (begin - (ft-display (_ "Already Logged in. /disconnect first")) - #f)) + (ft-display (_ "Already Logged in. /disconnect first")) + #f)) (read-jid) (read-password) (read-server) @@ -142,12 +141,12 @@ (read-port) (read-proxy) (if (ft-get-proxy?) - (begin - (read-proxyserver) - (read-proxyport) - (read-proxyuname) - (read-proxypasswd) - "")) + (begin + (read-proxyserver) + (read-proxyport) + (read-proxyuname) + (read-proxypasswd) + "")) (connect-handle (ft-connect)))) (add-command! /login "/login" "/login" "Interactive login to jabber server - blocking") diff --git a/extensions/dict-buddy.scm b/extensions/dict-buddy.scm index 54aa697..5a38d5a 100644 --- a/extensions/dict-buddy.scm +++ b/extensions/dict-buddy.scm @@ -22,7 +22,7 @@ (if (= (string-length args) 0) (system "dict --help") (begin - ; (fh-set-current-target-buddy! "dict" "send") - (system (string-append "dict -P more \"" args "\""))))) + ; (fh-set-current-target-buddy! "dict" "send") + (system (string-append "dict -P more \"" args "\""))))) (add-command! /dict "/dict" "/dict [OPTIONS] [WORD]" "lookup in dictionary") diff --git a/extensions/dyn-commands.scm b/extensions/dyn-commands.scm index 43e6d18..4d3077b 100644 --- a/extensions/dyn-commands.scm +++ b/extensions/dyn-commands.scm @@ -24,18 +24,18 @@ "Adds a dynamic command" (if (procedure? func) (set! dynamic-command-registry - (assoc-set! dynamic-command-registry - command - (list func syntax description))) + (assoc-set! dynamic-command-registry + command + (list func syntax description))) (display (string-append (_ "freetalk: error: command [") - command - (_ "] not bound to any procedure\n"))))) + command + (_ "] not bound to any procedure\n"))))) (define (remove-command! command) "Removes a dynamic command" (set! dynamic-command-registry - (assoc-remove! dynamic-command-registry - command))) + (assoc-remove! dynamic-command-registry + command))) (define (dynamic-command-proc command args) ((lambda (cmd-entry) @@ -48,28 +48,28 @@ (define (help args) "display help message" (let ((command-name (sans-surrounding-whitespace args)) - (command-doc (assoc-ref dynamic-command-registry (sans-surrounding-whitespace args)))) + (command-doc (assoc-ref dynamic-command-registry (sans-surrounding-whitespace args)))) (if (not (string-null? args)) - (if (not (list? command-doc)) - (display (_ "no such command\n")) - (display (string-append command-name - " - " - (cadr command-doc) - "\n\t" - (caddr command-doc) - "\n" - ))) - (for-each (lambda (command-entry) - (display (string-append (car command-entry) - " - " - (caddr command-entry) - "\n\t" - (cadddr command-entry) - "\n" - ))) - (sort dynamic-command-registry - (lambda (a b) - (string (string-length id) 0) - #t - (begin - (display (_ "Bad ID\n")) - #f)) - (if (> (string-length file) 0) - #t - (begin - (display (_ "Invalid filename\n")) - #f)) - (ft-send-file id file))))))) + (split-discarding-char #\space + (sans-surrounding-whitespace args) + (lambda (id file) + (and (if (> (string-length id) 0) + #t + (begin + (display (_ "Bad ID\n")) + #f)) + (if (> (string-length file) 0) + #t + (begin + (display (_ "Invalid filename\n")) + #f)) + (ft-send-file id file))))))) (add-command! /send-file "/send-file" "/send-file [USER@SERVER]" "send a file to a buddy") @@ -43,22 +43,22 @@ (define (/allow-file args) "Allow a buddy to transfer file" (split-discarding-char #\space - (sans-surrounding-whitespace args) - (lambda (cookie file) - (if (> (string-length cookie) 0) - (ft-set-allow-file (string->number cookie) file) - (ft-display (_ "Missing cookie number"))))) + (sans-surrounding-whitespace args) + (lambda (cookie file) + (if (> (string-length cookie) 0) + (ft-set-allow-file (string->number cookie) file) + (ft-display (_ "Missing cookie number"))))) (remove-command! "/allow-file")) (define (notify-file jid file errno cookie) (if (= errno 1) (begin - (add-command! /allow-file "/allow-file" "/allow-file" "Allow transfer of file from far end") - (ft-display (string-append "[" jid " wants to send file " file "]")) - (ft-display (string-append (_ "[use /allow-file ") (number->string cookie) (_ " [file-name] to accept]")))) + (add-command! /allow-file "/allow-file" "/allow-file" "Allow transfer of file from far end") + (ft-display (string-append "[" jid " wants to send file " file "]")) + (ft-display (string-append (_ "[use /allow-file ") (number->string cookie) (_ " [file-name] to accept]")))) (begin - (if (= errno 2) - (ft-display (string-append "[" jid (_ " does not support IBB for file transfer]"))) - (ft-display (string-append (_ "[failed to open file ") file "]")))))) + (if (= errno 2) + (ft-display (string-append "[" jid (_ " does not support IBB for file transfer]"))) + (ft-display (string-append (_ "[failed to open file ") file "]")))))) (add-hook! ft-notify-file-hook notify-file) \ No newline at end of file diff --git a/extensions/hacker-romance.scm b/extensions/hacker-romance.scm index e0f62fa..0086b53 100644 --- a/extensions/hacker-romance.scm +++ b/extensions/hacker-romance.scm @@ -27,34 +27,34 @@ (if (= count 1) '() (begin - (sleep (+ 1 (random 3 (seed->random-state (current-time))))) - (burst-of-romance buddy (- count 1) message) - ))) + (sleep (+ 1 (random 3 (seed->random-state (current-time))))) + (burst-of-romance buddy (- count 1) message) + ))) (define (/burst-of-romance args) (let ((args-list (string-split args #\ ))) (if (>= (length (string-split args #\ )) 3) - (let - ((buddy (car args-list)) - (count (string->number (cadr args-list))) - (message (string-join (cddr args-list)))) - (if (and (> (string-length message) 0) - (> count 0)) - (burst-of-romance buddy count message))) - (ft-display (_ "usage: /burst-of-romance BUDDY COUNT MESSAGE"))))) + (let + ((buddy (car args-list)) + (count (string->number (cadr args-list))) + (message (string-join (cddr args-list)))) + (if (and (> (string-length message) 0) + (> count 0)) + (burst-of-romance buddy count message))) + (ft-display (_ "usage: /burst-of-romance BUDDY COUNT MESSAGE"))))) (add-command! /burst-of-romance "/burst-of-romance" - "/burst-of-romance BUDDY COUNT MESSAGE" - "send COUNT number of MESSAGEs to BUDDY as though you typed by hand") + "/burst-of-romance BUDDY COUNT MESSAGE" + "send COUNT number of MESSAGEs to BUDDY as though you typed by hand") (define (nstr str count) "return COUNT number of CHARs" (if (string=? str " ") " " (if (> count 0) - (string-append (nstr str (- count 1)) str) - ""))) + (string-append (nstr str (- count 1)) str) + ""))) (define (burst str min max) "explode the STR string with MIN and MAX character count" @@ -62,31 +62,31 @@ "" (begin (string-append - (nstr (list->string (list (car (string->list str)))) - (+ min (random max rand-state))) - (burst (list->string (cdr (string->list str))) min max))))) + (nstr (list->string (list (car (string->list str)))) + (+ min (random max rand-state))) + (burst (list->string (cdr (string->list str))) min max))))) (define (/burst args) "dynamic command interface to burst procedure" (let* ((args-list (split-discarding-char #\space args (lambda (x y) (list x y)))) - (buddy (car args-list)) - (message (cadr args-list))) + (buddy (car args-list)) + (message (cadr args-list))) (if (> (string-length message) 0) - (ft-send-message buddy (burst message min-chars max-chars)) - (ft-display (_ "usage: /burst BUDDY MESSAGE"))))) + (ft-send-message buddy (burst message min-chars max-chars)) + (ft-display (_ "usage: /burst BUDDY MESSAGE"))))) (add-command! /burst "/burst" - "/burst BUDDY MESSAGE" - "Send IRC greeting style MESSAGE") + "/burst BUDDY MESSAGE" + "Send IRC greeting style MESSAGE") (define (/greet args) "IRC style greeting command" (if (> (string-length args) 0) (ft-send-message args - (burst (car (string-split args #\@)) - min-chars max-chars)) + (burst (car (string-split args #\@)) + min-chars max-chars)) (ft-display (_ "usage: /greet BUDDY")))) (add-command! /greet "/greet" - "/greet BUDDY" - "greet like in IRC") + "/greet BUDDY" + "greet like in IRC") diff --git a/extensions/history.scm b/extensions/history.scm index 53050b1..958317a 100644 --- a/extensions/history.scm +++ b/extensions/history.scm @@ -44,38 +44,38 @@ (define (history filename buddy message) "log the message to history file" (history-raw filename - (string-append - (local-date-time) " [" buddy "] " message "\n"))) + (string-append + (local-date-time) " [" buddy "] " message "\n"))) (define (history-create-dirs) "create history folders" ;;; if we are running for the first time, then create ;;; ~/.freetalk/history (catch 'system-error - (lambda () - (mkdir (string-append (ft-get-config-dir) - "/history"))) - (lambda args #f)) + (lambda () + (mkdir (string-append (ft-get-config-dir) + "/history"))) + (lambda args #f)) ;;; if we are logging in for first time, then create ;;; ~/.freetalk/history/ (catch 'system-error - (lambda () - (mkdir history-path)) - (lambda args #f))) + (lambda () + (mkdir history-path)) + (lambda args #f))) ;;; hook procedure for logging all sent messages (define (log-sent-message to message) "hook procedure for logging all sent messages" (history (string-append history-path "/" to) - (ft-get-jid) - message)) + (ft-get-jid) + message)) ;;; hook procedure for logging all revceived messages (define (log-received-message time from nickname message) "hook procedure for logging all revceived messages" (history (string-append history-path "/" from) - from - message)) + from + message)) ;;; hook procedure for logging all revceived offline messages ;(define (log-received-offline-message from message time) @@ -91,9 +91,9 @@ (if success (begin (set! history-path (string-append - (ft-get-config-dir) - "/history/" - (ft-get-jid))) + (ft-get-config-dir) + "/history/" + (ft-get-jid))) (set! session-file (string-append history-path "/SESSION")) (history-create-dirs)))) @@ -114,6 +114,6 @@ (if (= (string-length args) 0) (system (string-append history-page-cmd session-file)) ; (if (= (string-length args) 1) - (system (string-append history-page-cmd history-path "/" args)))) + (system (string-append history-page-cmd history-path "/" args)))) (add-command! /history "/history" "/history [BUDDY]" "Display history page by page") diff --git a/extensions/login.scm b/extensions/login.scm index 4950fac..a5d8240 100644 --- a/extensions/login.scm +++ b/extensions/login.scm @@ -22,36 +22,36 @@ (and (string=? (ft-get-jid) "") (ft-set-jid! (sans-surrounding-whitespace - (and (display "Jabber ID: ") - (read-line))))) + (and (display "Jabber ID: ") + (read-line))))) ;; check if both user and domain are present (if (not (string-rindex (ft-get-jid) #\@)) (begin (display (string-append "freetalk: Jabber ID [" - (ft-get-jid) - "] should contain full user@domain\n")) + (ft-get-jid) + "] should contain full user@domain\n")) (exit 1))) (define (domain->server domain) (cond ((string=? domain "facebook.com") "chat.facebook.com") - ((string=? domain "fb.com") "chat.facebook.com") - (else domain))) + ((string=? domain "chat.facebook.com") "chat.facebook.com") + (else domain))) (or (string=? (ft-get-jid) "") (and (string=? (ft-get-server) "") - (split-discarding-char #\@ (ft-get-jid) - (lambda (jid domain) - (ft-set-server! (domain->server domain)))))) + (split-discarding-char #\@ (ft-get-jid) + (lambda (jid domain) + (ft-set-server! (domain->server domain)))))) (and (not (string=? (ft-get-jid) "")) (not (string=? (ft-get-server) "")) (ft-connect)) (add-hook! ft-login-hook (lambda (success) - (and success - (ft-set-prompt! (string-append - (ft-get-jid) - "> "))))) + (and success + (ft-set-prompt! (string-append + (ft-get-jid) + "> "))))) (add-hook! ft-disconnect-hook (lambda (reason) - (ft-set-prompt! "~\\/~ "))) + (ft-set-prompt! "~\\/~ "))) diff --git a/extensions/loudscream.scm b/extensions/loudscream.scm index 4993ddd..274326b 100644 --- a/extensions/loudscream.scm +++ b/extensions/loudscream.scm @@ -21,34 +21,35 @@ (define-syntax node-set-attrs (syntax-rules () ((_ node attrs) (if (null? attrs) '() - (map (lambda (attr) - (lm-message-node-set-attribute node (car attr) (cadr attr))) - attrs))))) + (map (lambda (attr) + (lm-message-node-set-attribute node (car attr) + (cadr attr))) + attrs))))) (define-syntax node-transform (syntax-rules () ((_ parent ()) '()) ((_ parent ((name attrs childer) . rest)) ; childer is child of the child (let ((child (lm-message-node-add-child parent name ""))) - (node-set-attrs child attrs) - (node-transform child childer) - (node-transform parent rest))) + (node-set-attrs child attrs) + (node-transform child childer) + (node-transform parent rest))) ((_ parent (str)) (lm-message-node-set-value parent str)) ((_ parent str) (lm-message-node-set-value parent str)))) (define-syntax iq (syntax-rules () ((_ attrs . body) (let* ((m (lm-message-new "" 'iq)) - (n (lm-message-get-node m))) - (node-set-attrs n attrs) - (node-transform n body))))) + (n (lm-message-get-node m))) + (node-set-attrs n attrs) + (node-transform n body))))) (define-syntax presence (syntax-rules () ((_ to attrs . body) (let* ((m (lm-message-new to 'presence)) - (n (lm-message-get-node m))) - (node-set-attrs n (quote attrs)) - (node-transform n body) - m)))) + (n (lm-message-get-node m))) + (node-set-attrs n (quote attrs)) + (node-transform n body) + m)))) ;;; Guile's macroexpand doesn't work for hygenic macros. ;;; This is the next best thing, although it has the unfortunate @@ -58,8 +59,8 @@ (define-syntax expand (syntax-rules () ((_ form) (let ((expand-aux-fn (lambda () form))) - (expand-aux-fn) - (pretty-print (procedure-source expand-aux-fn)))))) + (expand-aux-fn) + (pretty-print (procedure-source expand-aux-fn)))))) ; (define-syntax expand ; (syntax-rules () @@ -79,19 +80,19 @@ (define (safe-repl args) (if (not seed) (set! seed (call-with-current-continuation - (lambda (escape) - (dynamic-wind - (lambda () - (set! go-to-repl escape)) - (lambda () - (ft-give-repl) - #f ;; Never reached so second time on - ;; we always get back to same seed'ed repl - ) - (lambda () - (set! go-to-repl #f)) - ) - ))) + (lambda (escape) + (dynamic-wind + (lambda () + (set! go-to-repl escape)) + (lambda () + (ft-give-repl) + #f ;; Never reached so second time on + ;; we always get back to same seed'ed repl + ) + (lambda () + (set! go-to-repl #f)) + ) + ))) (seed))) (add-command! safe-repl "/repl" "/repl" "drop into a repl") diff --git a/extensions/mr-oxford.scm b/extensions/mr-oxford.scm index ce37d5c..34d80db 100644 --- a/extensions/mr-oxford.scm +++ b/extensions/mr-oxford.scm @@ -23,16 +23,16 @@ (display "Loading dictionary [/usr/share/dict/words]... ") (let ((word-count 0)) (catch 'system-error - (lambda () - (for-each-line (lambda (word) - (ft-dict-prepend! word) - (set! word-count (1+ word-count))) - "/usr/share/dict/words")) - (lambda args #f)) + (lambda () + (for-each-line (lambda (word) + (ft-dict-prepend! word) + (set! word-count (1+ word-count))) + "/usr/share/dict/words")) + (lambda args #f)) (display (string-append "[" (number->string word-count) "] words\n"))) ;; Add sent-words to readline context" (add-hook! ft-message-send-hook - (lambda (to msg) - (map ft-dict-insert! (sentence->words msg)))) + (lambda (to msg) + (map ft-dict-insert! (sentence->words msg)))) diff --git a/extensions/pipe.scm b/extensions/pipe.scm index bb892d1..2499463 100644 --- a/extensions/pipe.scm +++ b/extensions/pipe.scm @@ -24,21 +24,21 @@ ((port (open-input-pipe cmd)) (line (read-line port))) (while (not (eof-object? line)) - (ft-send-message buddy line) - (display line)(newline) -; (usleep 100000) ; for proper message sequencing - (set! line (read-line port))) + (ft-send-message buddy line) + (display line)(newline) +; (usleep 100000) ; for proper message sequencing + (set! line (read-line port))) (close-pipe port))) (define (/pipe args) "dynamic command interface to pipe facility" (let* ((args-list (split-discarding-char #\space args (lambda (x y) (list x y)))) - (buddy (car args-list)) - (cmd (cadr args-list))) + (buddy (car args-list)) + (cmd (cadr args-list))) (if (> (string-length cmd) 0) - (send-message-pipe buddy cmd) - (ft-display (_ "usage: /pipe BUDDY COMMAND [OPTIONS]"))))) + (send-message-pipe buddy cmd) + (ft-display (_ "usage: /pipe BUDDY COMMAND [OPTIONS]"))))) (add-command! /pipe "/pipe" - "/pipe BUDDY COMMAND [OPTIONS]" - "send the output of COMMAND to BUDDY") + "/pipe BUDDY COMMAND [OPTIONS]" + "send the output of COMMAND to BUDDY") diff --git a/extensions/proud-of-freetalk.scm b/extensions/proud-of-freetalk.scm index 64bef2d..c8a4e84 100644 --- a/extensions/proud-of-freetalk.scm +++ b/extensions/proud-of-freetalk.scm @@ -31,8 +31,8 @@ (and (string=? "?messenger" msg) (ft-send-message-no-hook from "?messenger->freetalk") (begin (ft-display (string-append (_ "Told [") - from - (_ "] that I'm proud of using Freetalk")))) + from + (_ "] that I'm proud of using Freetalk")))) (ft-hook-return))) (define (freetalk? buddy) @@ -42,21 +42,21 @@ (define (proud-of-ft-handler timestamp from nickname msg) "handle the freetalk? reply" (if (string=? "?messenger-" - (car (string-separate msg #\>))) + (car (string-separate msg #\>))) ;; ?messenger->MESSENGER-NAME reply message (if (string=? "?messenger->freetalk" msg) - (begin - (ft-display - (string-append (_ "Yes [") from (_ "] is using [") - (cadr (string-separate msg #\>)) - "]")) - (ft-hook-return)) - (begin - (ft-display - (string-append (_ "No, but [") from (_ "] is using [") - (cadr (string-separate msg #\>)) - "]")) - (ft-hook-return))))) + (begin + (ft-display + (string-append (_ "Yes [") from (_ "] is using [") + (cadr (string-separate msg #\>)) + "]")) + (ft-hook-return)) + (begin + (ft-display + (string-append (_ "No, but [") from (_ "] is using [") + (cadr (string-separate msg #\>)) + "]")) + (ft-hook-return))))) (add-hook! ft-message-receive-hook proud-of-freetalk) diff --git a/extensions/roster.scm b/extensions/roster.scm index d2934f3..aa450d8 100644 --- a/extensions/roster.scm +++ b/extensions/roster.scm @@ -20,8 +20,8 @@ (if (= (string-length args) 0) (ft-display (_ "Incomplete syntax")) (begin - (ft-add-buddy! (sans-surrounding-whitespace args)) - (ft-subscription-allow (sans-surrounding-whitespace args))))) + (ft-add-buddy! (sans-surrounding-whitespace args)) + (ft-subscription-allow (sans-surrounding-whitespace args))))) (add-command! /add "/add" "/add [USER@SERVER]" "add new buddy to list") @@ -29,8 +29,8 @@ (if (= (string-length args) 0) (ft-display (_ "Incomplete syntax")) (begin - (ft-remove-buddy! (sans-surrounding-whitespace args)) - (ft-subscription-deny (sans-surrounding-whitespace args))))) + (ft-remove-buddy! (sans-surrounding-whitespace args)) + (ft-subscription-deny (sans-surrounding-whitespace args))))) (add-command! /remove "/remove" "/remove [USER@SERVER]" "remove buddy from list") @@ -51,8 +51,8 @@ (status-msg (list-ref item 4))) (if online (ft-display (string-append " * " jid (if (> (string-length nickname) 0) - (string-append " (" nickname ") ") - " ") + (string-append " (" nickname ") ") + " ") (if (> (string-length show-msg) 0) (string-append "-> [" (pretty-print-show-msg show-msg) "]") "") @@ -60,16 +60,16 @@ (string-append " (" status-msg ")") ""))) (and (string=? args "all") (ft-display (string-append " " jid (if (> (string-length nickname) 0) - (string-append " (" nickname ") ") - " "))))))) + (string-append " (" nickname ") ") + " "))))))) (ft-get-roster-list))) (add-command! /who "/who" "/who" "display buddy list") (define (/whoami args) (ft-display (string-append (_ "Jabber ID: ") (ft-get-jid) "\n" - (_ "Jabber Server: ") (ft-get-server) "\n" - (_ "Status: ") (ft-get-status-msg)))) + (_ "Jabber Server: ") (ft-get-server) "\n" + (_ "Status: ") (ft-get-status-msg)))) (add-command! /whoami "/whoami" "/whoami" "display who is this") (add-command! /whoami "/whomomlikes" "/whomomlikes" "same as /whoami") @@ -91,7 +91,7 @@ (if (= (string-length args) 0) (ft-display (_ "Incomplete syntax")) (apply ft-roster-set-nickname (map sans-surrounding-whitespace - (string-separate args #\Space))))) + (string-separate args #\Space))))) (add-command! /alias "/alias" "/alias buddy nickname" "Set the nickname of a buddy") (define (presence-recv jid online nickname show-msg status-msg) @@ -107,10 +107,10 @@ (not (string=? old-status-msg status-msg))) ; using old-jid is a simple way to strip away the resource part ;) (ft-display (string-append old-jid - (if (> (string-length old-nickname) 0) - (string-append " (" old-nickname ")") - "") - (_ " is now") + (if (> (string-length old-nickname) 0) + (string-append " (" old-nickname ")") + "") + (_ " is now") (if online (_ " Online") (_ " Offline")) diff --git a/extensions/shell.scm b/extensions/shell.scm index 4df4ec3..6805aa1 100644 --- a/extensions/shell.scm +++ b/extensions/shell.scm @@ -25,9 +25,9 @@ "dynamic command interface to shell facility" (if (= (string-length args) 0) (begin - (display (_ "Press \"C-d\" to get back to freetalk")) - (newline) - (system "sh")) + (display (_ "Press \"C-d\" to get back to freetalk")) + (newline) + (system "sh")) (system args))) (add-command! /shell "/shell" "/shell [COMMAND] [ARGS]" "shell mode") @@ -48,7 +48,7 @@ (add-command! /date "/date" "/date [OPTIONS]" "print current date with all date OPTIONS") (add-hook! ft-quit-hook (lambda (dummy) (display - (string-append " ... ... \n" + (string-append " ... ... \n" " .. .. \n" " .. .. \n" " ...~~`'~~... \n" @@ -65,22 +65,22 @@ " .... .. .. \n" " WW WW WW WW \n" " ---------------------------------------- \n" - " Thank you for using freetalk \n" + " Thank you for using freetalk \n" " ---------------------------------------- \n")))) (define (message-from-reason reason) (cond ((= reason 0) "User Request") - ((= reason 1) "Network error (Timeout)") - ((= reason 2) "Protocol error (Hangup)") - ((= reason 3) (cond ((= (ft-get-conn-status) 3) - "Possible login from another location") - (else "Invalid authentication"))) - (else (string-append "Unknown error: " (number->string reason))))) + ((= reason 1) "Network error (Timeout)") + ((= reason 2) "Protocol error (Hangup)") + ((= reason 3) (cond ((= (ft-get-conn-status) 3) + "Possible login from another location") + (else "Invalid authentication"))) + (else (string-append "Unknown error: " (number->string reason))))) (add-hook! ft-disconnect-hook (lambda (reason) - (ft-display (string-append - "Disconnected from " - (ft-get-server) - ": " - (message-from-reason reason))))) + (ft-display (string-append + "Disconnected from " + (ft-get-server) + ": " + (message-from-reason reason))))) diff --git a/extensions/state.scm b/extensions/state.scm index a6f148e..ddc18ae 100644 --- a/extensions/state.scm +++ b/extensions/state.scm @@ -71,9 +71,9 @@ (add-command! (lambda (str) - (if (> (string-length str) 0) - (ft-load (sans-surrounding-whitespace str)) - (ft-display (_ "usage: /load [FILE]")))) - "/load" "/load [FILE]" "load an extension file") + (if (> (string-length str) 0) + (ft-load (sans-surrounding-whitespace str)) + (ft-display (_ "usage: /load [FILE]")))) + "/load" "/load [FILE]" "load an extension file") (add-command! (lambda (args) (ft-reset-fs-state!)) "/setup" "/setup" "Write fresh ~/.freetalk") diff --git a/extensions/url.scm b/extensions/url.scm index a12dc87..740e2e6 100644 --- a/extensions/url.scm +++ b/extensions/url.scm @@ -27,9 +27,9 @@ (if success (begin (set! url-history-path (string-append - (ft-get-config-dir) - "/history/" - (ft-get-jid))) + (ft-get-config-dir) + "/history/" + (ft-get-jid))) (set! url-session-file (string-append history-path "/SESSION"))))) (add-hook! ft-login-hook url-post-startup) @@ -40,6 +40,6 @@ (if (= (string-length args) 0) (system (string-append urlview-cmd url-session-file)) ; (if (= (string-length args) 1) - (system (string-append urlview-cmd url-history-path "/" args)))) + (system (string-append urlview-cmd url-history-path "/" args)))) (add-command! /urlview "/urlview" "/urlview [BUDDY]" "handle URLs") diff --git a/extensions/utils.scm b/extensions/utils.scm index f155723..5c5e0a6 100644 --- a/extensions/utils.scm +++ b/extensions/utils.scm @@ -23,8 +23,9 @@ (define (/version args) "display version info" (display (string-append (_ "freetalk (FreeTalk) ") (ft-version) "\n" - (_ "Copyright (C) 2005-2014 FreeTalk Core Team.\n") - (_ "This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n")))) + (_ "Copyright (C) 2005-2014 FreeTalk Core Team.\n") + (_ "This is free software; see the source for copying conditions.\n") + (_ "There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n")))) (add-command! /version "/version" "/version" "display freetalk version information") @@ -45,8 +46,8 @@ (if (number? item) (string->symbol (number->string item)) (if (string? item) - (string->symbol item) - item))) + (string->symbol item) + item))) (define (list->asv li any) "convert list to any separated vector" @@ -69,27 +70,26 @@ (if (= (length li) 0) '() (if (= (length li) 1) - (list - (symbol->string - (any->symbol (car li)))) - (append (list - (symbol->string - (any->symbol (car li)))) - (list->strlist (cdr li)))))) + (list + (symbol->string + (any->symbol (car li)))) + (append (list + (symbol->string + (any->symbol (car li)))) + (list->strlist (cdr li)))))) (define (send-messages-to-all roster-list message) "Send messages to all" (for-each (lambda (buddy) - (ft-send-message-no-hook buddy message)) - roster-list)) + (ft-send-message-no-hook buddy message)) + roster-list)) (define (local-date-time) (string-append (strftime "%F" (localtime (current-time))) - " " + " " (strftime "%T" (localtime (current-time))))) - (define (skip-comment port) (let ((char (peek-char port))) (if (or (eof-object? char) @@ -102,44 +102,44 @@ (define (skip-whitespace port) (let ((char (peek-char port))) (cond ((or (eof-object? char) - (char=? #\newline char)) - char) - ((char-whitespace? char) - (read-char port) - (skip-whitespace port)) -;; ((char=? #\# char) -;; (read-char port) -;; (skip-comment port)) - (else char)))) + (char=? #\newline char)) + char) + ((char-whitespace? char) + (read-char port) + (skip-whitespace port)) +;; ((char=? #\# char) +;; (read-char port) +;; (skip-comment port)) + (else char)))) (define (read-token port delim) (letrec ((loop - (lambda (chars) - (let ((char (peek-char port))) - (cond ((eof-object? char) - (do-eof char chars)) - ((char=? #\newline char) - (do-eot chars)) - ((char-whitespace? char) - (do-eot chars)) -;; (let ((terminator (skip-comment port))) -;; (if (eof-object? char) -;; (do-eof char chars) -;; (do-eot chars)))) - (else - (read-char port) - (loop (cons char chars))))))) + (lambda (chars) + (let ((char (peek-char port))) + (cond ((eof-object? char) + (do-eof char chars)) + ((char=? #\newline char) + (do-eot chars)) + ((char-whitespace? char) + (do-eot chars)) +; (let ((terminator (skip-comment port))) +;; (if (eof-object? char) +;; (do-eof char chars) +;; (do-eot chars)))) + (else + (read-char port) + (loop (cons char chars))))))) (do-eof - (lambda (eof chars) - (if (null? chars) - eof - (do-eot chars)))) + (lambda (eof chars) + (if (null? chars) + eof + (do-eot chars)))) (do-eot - (lambda (chars) - (if (null? chars) - #f - (list->string (reverse! chars)))))) + (lambda (chars) + (if (null? chars) + #f + (list->string (reverse! chars)))))) (skip-whitespace port) (loop '()))) @@ -148,25 +148,24 @@ (with-input-from-string sentence (lambda () (letrec - ((next-token - (lambda () - (read-token (current-input-port) #\#))) - (append-word - (lambda (word-list) - (let - ((word (next-token))) - (if (eof-object? word) - word-list - (begin - (append-word - (append word-list (list word))))))))) - (append-word '()))))) + ((next-token + (lambda () + (read-token (current-input-port) #\#))) + (append-word + (lambda (word-list) + (let + ((word (next-token))) + (if (eof-object? word) + word-list + (begin + (append-word + (append word-list (list word))))))))) + (append-word '()))))) (define (blank-line? line) "return true if line is blank" (null? (sentence->words line))) - ;;; string utils ;; for string-match procedure @@ -179,39 +178,38 @@ (with-input-from-string sentence (lambda () (letrec - ((next-token (lambda () - (read (current-input-port)))) - (append-word (lambda (word-list) - (let - ((word (next-token))) - (if (eof-object? word) - word-list - (begin - (append-word (append word-list - (list word))))))))) - (append-word '()))))) + ((next-token (lambda () + (read (current-input-port)))) + (append-word (lambda (word-list) + (let + ((word (next-token))) + (if (eof-object? word) + word-list + (begin + (append-word (append word-list + (list word))))))))) + (append-word '()))))) (define (list->sentence li) "convert list to space separated sentence" (let ((word (if (symbol? (car li)) - (symbol->string (car li)) - (number->string (car li))))) + (symbol->string (car li)) + (number->string (car li))))) (if (= (length li) 1) - word - (string-append word " " (list->sentence (cdr li)))))) - + word + (string-append word " " (list->sentence (cdr li)))))) (define (string-separate str ch) (let ((index (string-index str ch))) (if index - (cons (substring str 0 index) - (string-separate (substring str - (+ index 1) - (string-length str)) - ch)) - (list str)))) + (cons (substring str 0 index) + (string-separate (substring str + (+ index 1) + (string-length str)) + ch)) + (list str)))) (define (blank-line? line) @@ -230,10 +228,10 @@ "skip blank lines and read the next line" (let ((line (read-line fport))) (if (eof-object? line) - "" - (if (not (blank-line? line)) - line - (read-next-line fport))))) + "" + (if (not (blank-line? line)) + line + (read-next-line fport))))) (define (string-string? str find-string) @@ -245,9 +243,9 @@ "convert flat yymmdd num to (yy mm dd) list" (let* ((date-str (list->string - (map (lambda (c) - (if (eq? c #\space) #\0 c)) - (string->list (format #f "~6d" date))))) + (map (lambda (c) + (if (eq? c #\space) #\0 c)) + (string->list (format #f "~6d" date))))) (yy (substring date-str 0 2)) (mm (substring date-str 2 4)) (dd (substring date-str 4 6)))