summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile2
-rw-r--r--make-image.lisp14
-rw-r--r--package.lisp3
-rw-r--r--xmpp-send.asd14
-rw-r--r--xmpp-send.lisp39
6 files changed, 73 insertions, 0 deletions
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 <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")))
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*))