From 690604a71dbcfd82eb007e83430c3a176cfd694c Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 9 May 2013 13:57:52 +0200 Subject: [PATCH] Initial commit --- .gitignore | 1 + Makefile | 2 ++ make-image.lisp | 14 ++++++++++++++ package.lisp | 3 +++ xmpp-send.asd | 14 ++++++++++++++ xmpp-send.lisp | 39 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 73 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 make-image.lisp create mode 100644 package.lisp create mode 100644 xmpp-send.asd create mode 100644 xmpp-send.lisp diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4ae5ea6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +xmpp-send diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e6677ec --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +xmpp-send: xmpp-send.lisp make-image.lisp + sbcl --disable-debugger --load make-image.lisp diff --git a/make-image.lisp b/make-image.lisp new file mode 100644 index 0000000..2d36021 --- /dev/null +++ b/make-image.lisp @@ -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) diff --git a/package.lisp b/package.lisp new file mode 100644 index 0000000..09c2719 --- /dev/null +++ b/package.lisp @@ -0,0 +1,3 @@ +(defpackage :org.ryuslash.xmpp-send + (:use :cl :xmpp) + (:export :xmpp-send)) diff --git a/xmpp-send.asd b/xmpp-send.asd new file mode 100644 index 0000000..950727e --- /dev/null +++ b/xmpp-send.asd @@ -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 " + :version "0.1.0" + :maintainer "Tom Willemsen " + :description "Send a quick message through XMPP." + :serial t + :depends-on (:cl-xmpp :cl-xmpp-tls) + :components ((:file "package") + (:file "xmpp-send"))) diff --git a/xmpp-send.lisp b/xmpp-send.lisp new file mode 100644 index 0000000..7c0a530 --- /dev/null +++ b/xmpp-send.lisp @@ -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*))