From 5cde1d497d47664226a01a2068dc11d758d02b6f Mon Sep 17 00:00:00 2001 From: Pedro Silva Date: Tue, 2 Apr 2013 11:57:43 +0100 Subject: Implement nnttrss-{login,logout,logged-in-p} --- nnttrss.el | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/nnttrss.el b/nnttrss.el index 41a217d..52856ad 100644 --- a/nnttrss.el +++ b/nnttrss.el @@ -39,6 +39,29 @@ JSON object. Returns the JSON response as a plist or nil." (if (= status 0) content (nnheader-report 'nnttrss (plist-get content :error))))))) +(defun nnttrss-login (address user password) + "Login to the server at ADDRESS using USER and PASSWORD +credentials. Returns a session id string or nil." + (let ((response (nnttrss-post-request `(:op "login" + :user ,user + :password ,password) + address))) + (plist-get response :session_id))) + +(defun nnttrss-logout (address session-id) + "Logout of the server at ADDRESS using SESSION-ID credentials." + (nnttrss-post-request `(:op "logout" + :sid ,session-id) + address)) + +(defun nnttrss-logged-in-p (address session-id) + "Return t if there is a valid session at ADDRESS with + SESSION-ID, false otherwise." + (let ((response (nnttrss-post-request `(:op "isLoggedIn" + :sid ,session-id) + address))) + (plist-get response :status))) + (gnus-declare-backend "nnttrss" 'address 'prompt-address) -- cgit v1.2.3