summaryrefslogtreecommitdiffstats
path: root/xmpp-send.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp-send.lisp')
-rw-r--r--xmpp-send.lisp39
1 files changed, 39 insertions, 0 deletions
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*))