Initial commit

This commit is contained in:
Tom Willemse 2013-05-09 13:57:52 +02:00
commit 690604a71d
6 changed files with 73 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
xmpp-send

2
Makefile Normal file
View File

@ -0,0 +1,2 @@
xmpp-send: xmpp-send.lisp make-image.lisp
sbcl --disable-debugger --load make-image.lisp

14
make-image.lisp Normal file
View File

@ -0,0 +1,14 @@
#-sbcl
(error "This lisp implementation is not supported.")
(require 'asdf)
(asdf:oos 'asdf:load-op 'xmpp-send)
(save-lisp-and-die
"xmpp-send" :toplevel
(lambda ()
(sb-posix:putenv (format nil "SBCL_HOME=~A" #.(sb-ext:posix-getenv "SBCL_HOME")))
(org.ryuslash.xmpp-send:xmpp-send sb-ext:*posix-argv*)
0)
:executable t)

3
package.lisp Normal file
View File

@ -0,0 +1,3 @@
(defpackage :org.ryuslash.xmpp-send
(:use :cl :xmpp)
(:export :xmpp-send))

14
xmpp-send.asd Normal file
View File

@ -0,0 +1,14 @@
(defpackage :xmpp-send-system
(:use :cl :asdf))
(in-package :xmpp-send-system)
(defsystem :xmpp-send
:name "XMPP Send"
:author "Tom Willemse <tom@ryuslash.org>"
:version "0.1.0"
:maintainer "Tom Willemsen <tom@ryuslash.org>"
:description "Send a quick message through XMPP."
:serial t
:depends-on (:cl-xmpp :cl-xmpp-tls)
:components ((:file "package")
(:file "xmpp-send")))

39
xmpp-send.lisp Normal file
View File

@ -0,0 +1,39 @@
(in-package :org.ryuslash.xmpp-send)
(defvar *connection* nil
"The connection to the jabber server.")
(defvar *host* nil
"The host to log-in on.")
(defvar *username* nil
"The username to log-in with, should not contain the jabber host.")
(defvar *password* nil
"The password to log-in with.")
(defvar *resource* nil
"The resource to use when logging in.")
(defun get-rc-location ()
"Get the location of the RC file."
(let ((xdg (sb-ext:posix-getenv "XDG_CONFIG_HOME"))
(home (sb-ext:posix-getenv "HOME")))
(pathname
(apply 'concatenate 'string
(or xdg home)
(unless xdg "/.config")
'("/xmpp-send/rc.lisp")))))
;; (defun send (args)
;; (handler-case (message *connection* (car args) (cadr args))))
(defun xmpp-send (args)
;; Load init file
(let ((*package* (in-package :org.ryuslash.xmpp-send)))
(load (get-rc-location) :if-does-not-exist nil))
(setf *connection* (connect-tls :hostname *host*))
(auth *connection* *username* *password* *resource*)
(xmpp:message *connection* (cadr args) (caddr args) :type :chat)
(disconnect *connection*))