Skip to content
Snippets Groups Projects
Commit d66edafb authored by Olivier Dion's avatar Olivier Dion
Browse files

agent/agent: Use parameter instead of fluid

Change-Id: I365b4346d123b0cc8c71a17e62e25bae37e5fc49
parent 562f8c8a
No related branches found
No related tags found
No related merge requests found
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
#:export (ensure-account #:export (ensure-account
ensure-account-from-archive)) ensure-account-from-archive))
(define-public account-id (make-fluid "afafafafafafafaf")) (define-public account-id (make-parameter "afafafafafafafaf"))
(define-public peer-id (make-fluid)) (define-public peer-id (make-parameter #f))
(define* (ensure-account% this-account-id account-details #:optional (wait-for-announcement? #t)) (define* (ensure-account% this-account-id account-details #:optional (wait-for-announcement? #t))
(if wait-for-announcement? (if wait-for-announcement?
...@@ -51,11 +51,11 @@ ...@@ -51,11 +51,11 @@
(account:add account-details this-account-id))) (account:add account-details this-account-id)))
(let ((details (account:get-details this-account-id))) (let ((details (account:get-details this-account-id)))
(fluid-set! peer-id (assoc-ref details "Account.username")))) (peer-id (assoc-ref details "Account.username"))))
(define* (ensure-account #:key (wait-for-announcement? #t)) (define* (ensure-account #:key (wait-for-announcement? #t))
(jami:info "Ensure account") (jami:info "Ensure account")
(ensure-account% (fluid-ref account-id) '(("Account.type" . "RING") (ensure-account% (account-id) '(("Account.type" . "RING")
("Account.displayName" . "AGENT") ("Account.displayName" . "AGENT")
("Account.alias" . "AGENT") ("Account.alias" . "AGENT")
("Account.archivePassword" . "") ("Account.archivePassword" . "")
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
(define* (ensure-account-from-archive path #:key (wait-for-announcement? #t)) (define* (ensure-account-from-archive path #:key (wait-for-announcement? #t))
(jami:info "Ensure account from archive ~a" path) (jami:info "Ensure account from archive ~a" path)
(ensure-account% (fluid-ref account-id) `(("Account.type" . "RING") (ensure-account% (account-id) `(("Account.type" . "RING")
("Account.displayName" . "AGENT") ("Account.displayName" . "AGENT")
("Account.alias" . "AGENT") ("Account.alias" . "AGENT")
("Account.archivePassword" . "") ("Account.archivePassword" . "")
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
(agent:ensure-account) (agent:ensure-account)
(let ((account (fluid-ref agent:account-id)) (let ((account (agent:account-id))
(peer "FIXME")) (peer "FIXME"))
(when (string= peer "FIXME") (when (string= peer "FIXME")
......
...@@ -10,9 +10,9 @@ ...@@ -10,9 +10,9 @@
(agent:ensure-account) (agent:ensure-account)
(jami:info "Agent peer-id: ~a" (fluid-ref agent:peer-id)) (jami:info "Agent peer-id: ~a" (agent:peer-id))
(let ((account (fluid-ref agent:account-id))) (let ((account (agent:account-id)))
(jami:on-signal 'incoming-call/media (jami:on-signal 'incoming-call/media
(lambda (account-id call-id peer media-lst) (lambda (account-id call-id peer media-lst)
(when (string= account-id account) (when (string= account-id account)
......
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
(sigaction SIGALRM (lambda _ (setup-timer))) (sigaction SIGALRM (lambda _ (setup-timer)))
(let ((account (fluid-ref agent:account-id)) (let ((account (agent:account-id))
(details (next-details!))) (details (next-details!)))
(progress "SIGALRM - Changing account details: ~a" details) (progress "SIGALRM - Changing account details: ~a" details)
(account:send-register account #f) (account:send-register account #f)
...@@ -104,13 +104,13 @@ ...@@ -104,13 +104,13 @@
#t)) #t))
#f))) #f)))
(with-mutex mtx (with-mutex mtx
(set! this-call-id (call:place-call (fluid-ref agent:account-id) peer)) (set! this-call-id (call:place-call (agent:account-id) peer))
(let ((ret (wait-condition-variable cnd mtx (let ((ret (wait-condition-variable cnd mtx
(+ (current-time) timeout)))) (+ (current-time) timeout))))
(unless ret (atomic-box-set! continue #f)) (unless ret (atomic-box-set! continue #f))
ret)))) ret))))
(let ((account (fluid-ref agent:account-id)) (let ((account (agent:account-id))
(success 0) (success 0)
(failure 0) (failure 0)
(reset (call/cc (lambda (k) (reset (call/cc (lambda (k)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment