From 8d47e6b4db05579eb87706d68a546b293282d6d7 Mon Sep 17 00:00:00 2001 From: Kevin Granade Date: Thu, 30 Aug 2012 20:29:54 -0500 Subject: [PATCH] Create an identica-create-account function to create a status.net account object from the old account globals and call it from former location of code.. --- identica-mode.el | 50 +++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/identica-mode.el b/identica-mode.el index 3ae4cef..df9e010 100644 --- a/identica-mode.el +++ b/identica-mode.el @@ -640,28 +640,34 @@ of identica-stripe-face." (nconc text-property-default-nonsticky '((face . t)(mouse-face . t)(uri . t)(source . t)(uri-in-text . t))) - ;; Create an account object based on the various custom variables. - ;; Insert it into the statusnet accounts list. - (setq statusnet-accounts - (cons (make-statusnet-account - :server statusnet-server - :port statusnet-port - :username identica-username - :auth-mode identica-auth-mode - :password identica-password - :textlimit statusnet-server-textlimit - :oauth-data (if (string= identica-auth-mode "oauth") - (make-statusnet-oauth-data - :consumer-key identica-mode-oauth-consumer-key - :consumer-secret identica-mode-oauth-consumer-secret - :request-url statusnet-request-url - :access-url statusnet-access-url - :authorize-url statusnet-authorize-url - :access-token nil) - nil) - :last-timeline-retrieved nil) - statusnet-accounts)) - (setq sn-current-account (car statusnet-accounts))) + (identica-create-account)) + +(defun identica-create-account () + "Create an account object based on the various custom variables. + Insert it into the statusnet accounts list. +This needs to be called from any globally-accessable entry point." + (unless (boundp 'statusnet-account-created) + (setq statusnet-account-created t) + (setq statusnet-accounts + (cons (make-statusnet-account + :server statusnet-server + :port statusnet-port + :username identica-username + :auth-mode identica-auth-mode + :password identica-password + :textlimit statusnet-server-textlimit + :oauth-data (if (string= identica-auth-mode "oauth") + (make-statusnet-oauth-data + :consumer-key identica-mode-oauth-consumer-key + :consumer-secret identica-mode-oauth-consumer-secret + :request-url statusnet-request-url + :access-url statusnet-access-url + :authorize-url statusnet-authorize-url + :access-token nil) + nil) + :last-timeline-retrieved nil) + statusnet-accounts)) + (setq sn-current-account (car statusnet-accounts)))) (defmacro case-string (str &rest clauses) `(cond