diff --git a/src/9p-client/conditions.lisp b/src/9p-client/conditions.lisp new file mode 100644 index 0000000..328b77d --- /dev/null +++ b/src/9p-client/conditions.lisp @@ -0,0 +1,32 @@ +(in-package :9p-client) + +(define-condition 9p-error (error) + ((error-value + :initarg :error-value + :reader error-value) + (message-type + :initarg :message-type + :reader message-type) + (tag + :initarg :tag + :reader tag)) + (:report (lambda (condition stream) + (format stream + "message-type ~a tag ~a: ~a" + (message-type condition) + (tag condition) + (error-value condition)))) + (:documentation "Error for 9p protocol")) + + +(define-condition 9p-initialization-error (error) + ((tag + :initarg :tag + :reader tag) + (rtag + :initarg :rtag + :reader rtag)) + (:report (lambda (condition stream) + (format stream "error initialization tag sent ~a, got ~a instead" + (tag condition) (rtag condition)))) + (:documentation "Error for 9p protocol")) diff --git a/src/9p-client/message-types.lisp b/src/9p-client/message-types.lisp new file mode 100644 index 0000000..115b9af --- /dev/null +++ b/src/9p-client/message-types.lisp @@ -0,0 +1,53 @@ +(in-package :9p-client) + +(defparameter *tversion* 100) + +(defparameter *rversion* 101) + +(defparameter *tauth* 102) + +(defparameter *rauth* 103) + +(defparameter *tattach* 104) + +(defparameter *rattach* 105) + +(defparameter *terror* 106) ; there is no terror + +(defparameter *rerror* 107) + +(defparameter *tflush* 108) + +(defparameter *rflush* 108) + +(defparameter *twalk* 110) + +(defparameter *rwalk* 109) + +(defparameter *topen* 112) + +(defparameter *ropen* 113) + +(defparameter *tcreate* 114) + +(defparameter *rcreate* 115) + +(defparameter *tread* 116) + +(defparameter *rread* 117) + +(defparameter *twrite* 118) + +(defparameter *rwrite* 119) + +(defparameter *tclunk* 120) + +(defparameter *rclunk* 121) + +(defparameter *tremove* 122) + +(defparameter *rremove* 123) + +(defparameter *tstat* 124) + +(defparameter *rstat* 125) diff --git a/src/9p-client/package.lisp b/src/9p-client/package.lisp new file mode 100644 index 0000000..cacc9e4 --- /dev/null +++ b/src/9p-client/package.lisp @@ -0,0 +1,21 @@ +;; tinmop: an humble gemini and pleroma client +;; Copyright (C) 2020 cage + +;; This program is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +(defpackage :9p-client + (:use + :cl + :alexandria) + (:export)) diff --git a/src/api-client.lisp b/src/api-client.lisp index ade7a35..066e981 100644 --- a/src/api-client.lisp +++ b/src/api-client.lisp @@ -472,9 +472,9 @@ database." :spoiler-text subject :visibility visibility)) -(defun-api-call search-user (username &key (limit 1)) +(defun-api-call search-user (username &key (limit 1) (resolve nil)) "Find user identified by username" - (tooter:search-accounts *client* username :limit limit)) + (tooter:search-accounts *client* username :limit limit :resolve resolve)) (defun-api-call follow-user (user-id) "Follow user identified by user-id" diff --git a/src/program-events.lisp b/src/program-events.lisp index fc4d128..7ea16c4 100644 --- a/src/program-events.lisp +++ b/src/program-events.lisp @@ -732,7 +732,8 @@ (string= (tooter:account-name a) username)) remote-accounts-matching))) - (tooter:id matched-account))) + (values (tooter:id matched-account) + username))) (defmacro with-process-follower ((username user-id &optional (local-complete-username-fn #'db:all-unfollowed-usernames)) diff --git a/tinmop.asd b/tinmop.asd index bac271c..4e50408 100644 --- a/tinmop.asd +++ b/tinmop.asd @@ -84,6 +84,11 @@ (:file "emoji-shortcodes") (:file "software-configuration") (:file "tui-utils") + (:module 9p-client + :components ((:file "package") + (:file "message-types") + (:file "conditions") + (:file "client"))) (:module gemini :components ((:file "package") (:file "gemini-constants")